Commit 9ce2a1f8 by Kim Jinsung

Merge branch 'features/1.2.0_34866' into 'features/1.2.0'

Features/1.2.0 34866

See merge request !32
parents 30ad4bb2 3329f676
......@@ -380,4 +380,59 @@ public class OperationDao extends AbstractDao {
updateNeedSyncFlg(operationDto.operationId, true);
}
}
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM t_operation AS top ");
sql.append(" INNER JOIN r_operation_content AS rop ");
sql.append(" ON top.operation_id = rop.operation_id ");
sql.append(" AND rop.operation_content_flg = 1 ");
sql.append(" INNER JOIN r_operation_group_master_relation AS rogm ");
sql.append(" ON top.operation_id = rogm.operation_id ");
sql.append(" WHERE top.need_sync_flg = 1");
sql.append(" AND rogm.operation_group_master_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
}
/**
* 作業グループに紐づく同期可能な作業リストが存在するかチェック
* @param operationGroupMasterId
* @return
*/
public boolean hasNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
List<OperationDto> operationDtoList = getNeedSyncOperationByGroupMasterId(operationGroupMasterId);
return operationDtoList != null && operationDtoList.size() > 0;
}
/**
* 定期点検で同期が必要な作業を取得
* @return
*/
public List<OperationDto> getDeactivatedRoutineOperation() {
String curDate = DateTimeUtil.toStringInTimeZone(new Date(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
StringBuffer sql = new StringBuffer();
sql.append(" SELECT top.*, ");
sql.append(" CASE ");
sql.append(" WHEN report_type = 1 THEN ( ");
sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ttr.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ttr.report_end_date, 'localtime')) ");
sql.append(" FROM t_task tt ");
sql.append(" INNER JOIN t_task_report ttr ");
sql.append(" ON tt.task_key = ttr.task_key ");
sql.append(" AND tt.del_flg = 0 ");
sql.append(" AND datetime(ttr.report_end_date) >= datetime('" + curDate + "') ");
sql.append(" WHERE tt.operation_id = top.operation_id ");
sql.append(" ORDER BY ttr.report_start_date ASC LIMIT 1 ) ");
sql.append(" ELSE '' ");
sql.append(" END AS report_period ");
sql.append(" FROM t_operation AS top");
sql.append(" WHERE top.need_sync_flg = 0");
sql.append(" AND top.report_type = 1");
return rawQueryGetDtoList(sql.toString(), null, OperationDto.class);
}
}
\ No newline at end of file
......@@ -121,6 +121,10 @@ public class ContentDownloader {
public void addContentDownloadListener(ContentDownloadListener contentDownloadListener) {
// ダウンロードリスナーが既にセットされてる場合、何もしない
if (contentDownloadListenerSet.contains(contentDownloadListener)) {
return;
}
contentDownloadListenerSet.add(contentDownloadListener);
}
......@@ -466,8 +470,9 @@ public class ContentDownloader {
* @throws NetworkDisconnectedException
* @throws AcmsException
* @since 1.0.0
* @return true : 正常 false : 異常
*/
public void resume(long contentId) throws NetworkDisconnectedException, AcmsException {
public boolean resume(long contentId) throws NetworkDisconnectedException, AcmsException {
if (!networkAdapter.isNetworkConnected()) {
throw new NetworkDisconnectedException();
}
......@@ -475,12 +480,12 @@ public class ContentDownloader {
ContentDto contentDto = getOperableContent(contentId, DownloadStatusType.Downloading);
if (contentDto == null) {
Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId);
return;
return false;
}
synchronized (contentDto) {
if (contentDto.isDownloading()) {
Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId);
return;
return false;
}
if (contentDto.downloader != null && !isFullActive()) {
contentDto.status = DownloadStatusType.Downloading.type();
......@@ -492,6 +497,7 @@ public class ContentDownloader {
kickTask();
}
}
return true;
}
public void autoDownload() {
......
......@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil;
......@@ -67,6 +68,7 @@ public class ContentRefresher {
// masterDataを取得するため登録
private ApertureMasterDataLogic apertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class);
private OperationGroupMasterLogic operationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
public static ContentRefresher getInstance() {
......@@ -167,6 +169,9 @@ public class ContentRefresher {
// CMSでメンテナンスされる絞り検索マスタデータをアプリから取得できるようにJSONファイルを生成する。
apertureMasterDataLogic.initializeApertureMasterData();
// 作業種別情報を取得
operationGroupMasterLogic.setOperationGroupMaster();
if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
Logger.d(TAG, "stop refresh worker before content update.");
setFail();
......
......@@ -96,8 +96,6 @@ public class OperationLogic extends AbstractLogic {
public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得
setWorkingGroupList();
// 作業種別・作業種別に紐づいた作業IDを取得
mOperationGroupMasterLogic.setOperationGroupMaster();
// 作業一覧取得し、登録・更新・削除する
retrieveServerOperation();
}
......
......@@ -472,8 +472,8 @@
<string name="date_label_routineTask">作業期間</string>
<string name="msg_no_report_data">作業データがありません。</string>
<string name="msg_permission_dialog_mic">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。</string>
<string name="msg_routineTask_report_disable_not_list">情報更新中には点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_refreshing">作業一覧画面以外では点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_refreshing">情報更新中には点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_not_list">作業一覧画面以外では点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_meeting_room">作業一覧画面以外では点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_not_updated">情報更新されてませんので点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_no_operation">作業が存在しないので点検作業報告画面へ遷移できません。</string>
......@@ -523,6 +523,17 @@
<string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string>
<!-- 1.2.0 -->
<string name="msg_operation_enable_meeting_room_connected">会議室入室中の為、このボタンは利用できません。\n共通資料画面から資料を選択してください。</string>
<string name="batch_sync">一括同期</string>
<string name="batch_syncing">一括同期中...</string>
<string name="msg_confirm_batch_sync">表示中の全作業を一括同期しますか?</string>
<string name="msg_batch_sync_disconnect_network">インターネットに接続されていない為、同期処理を中止します。</string>
<string name="msg_batch_sync_content_download_fail">作業ベース資料のダウンロードに失敗しました。</string>
<string name="msg_batch_sync_new_content_updating">新着更新処理中の為、一括同期できません。</string>
<string name="msg_batch_sync_error">「%1$s」の同期に失敗しました。同期処理を中止します。\n</string>
<string name="msg_batch_sync_move_operation_view">一括同期中には点検作業報告画面へ遷移できません。</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">会議室設定(1)</string>
......@@ -678,8 +689,8 @@
<string name="date_label_routineTask_1">作業期間(1)</string>
<string name="msg_no_report_data_1">作業データがありません。(1)</string>
<string name="msg_permission_dialog_mic_1">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(1)</string>
<string name="msg_routineTask_report_disable_not_list_1">情報更新中には点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_refreshing_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_refreshing_1">情報更新中には点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_not_list_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_meeting_room_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_not_updated_1">情報更新されてませんので点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_no_operation_1">作業が存在しないので点検作業報告画面へ遷移できません。(1)</string>
......@@ -854,8 +865,8 @@
<string name="date_label_routineTask_2">作業期間(2)</string>
<string name="msg_no_report_data_2">作業データがありません。(2)</string>
<string name="msg_permission_dialog_mic_2">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(2)</string>
<string name="msg_routineTask_report_disable_not_list_2">情報更新中には点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_refreshing_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_refreshing_2">情報更新中には点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_not_list_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_meeting_room_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_not_updated_2">情報更新されてませんので点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_no_operation_2">作業が存在しないので点検作業報告画面へ遷移できません。(2)</string>
......@@ -1030,8 +1041,8 @@
<string name="date_label_routineTask_3">作業期間(3)</string>
<string name="msg_no_report_data_3">作業データがありません。(3)</string>
<string name="msg_permission_dialog_mic_3">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(3)</string>
<string name="msg_routineTask_report_disable_not_list_3">情報更新中には点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_refreshing_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_refreshing_3">情報更新中には点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_not_list_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_meeting_room_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_not_updated_3">情報更新されてませんので点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_no_operation_3">作業が存在しないので点検作業報告画面へ遷移できません。(3)</string>
......@@ -1206,8 +1217,8 @@
<string name="date_label_routineTask_4">作業期間(4)</string>
<string name="msg_no_report_data_4">作業データがありません。(4)</string>
<string name="msg_permission_dialog_mic_4">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(4)</string>
<string name="msg_routineTask_report_disable_not_list_4">情報更新中には点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_refreshing_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_refreshing_4">情報更新中には点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_not_list_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_meeting_room_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_not_updated_4">情報更新されてませんので点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_no_operation_4">作業が存在しないので点検作業報告画面へ遷移できません。(4)</string>
......@@ -1382,8 +1393,8 @@
<string name="date_label_routineTask_5">作業期間(5)</string>
<string name="msg_no_report_data_5">作業データがありません。(5)</string>
<string name="msg_permission_dialog_mic_5">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(5)</string>
<string name="msg_routineTask_report_disable_not_list_5">情報更新中には点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_refreshing_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_refreshing_5">情報更新中には点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_not_list_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_meeting_room_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_not_updated_5">情報更新されてませんので点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_no_operation_5">作業が存在しないので点検作業報告画面へ遷移できません。(5)</string>
......
......@@ -525,6 +525,17 @@
<string name="operation_category">분류</string>
<string name="type_all">전체</string>
<!-- 1.2.0 -->
<string name="msg_operation_enable_meeting_room_connected">회의실 접속 중에는 이 버튼을 사용하실수 없습니다. \n공통자료화면에서 자료를 선택해 주세요.</string>
<string name="batch_sync">일괄 동기</string>
<string name="batch_syncing">일괄 동기중...</string>
<string name="msg_confirm_batch_sync">표시 중인 모든 작업을 일괄 동기 하시겠습니까?</string>
<string name="msg_batch_sync_disconnect_network">인터넷에 접속 중이 아니므로, 동기처리를 중지합니다.</string>
<string name="msg_batch_sync_content_download_fail">작업 베이스 자료 파일 다운로드에 실패 하였습니다.</string>
<string name="msg_batch_sync_new_content_updating">새로운 정보갱신 중에는 일괄 동기을 하실 수 없습니다.</string>
<string name="msg_batch_sync_error">「%1$s」정보갱신에 실패하였습니다. 동기처리을 중지합니다.\n</string>
<string name="msg_batch_sync_move_operation_view">일괄 동기 처리 중에는 점검작업 보고화면으로 이동하실 수 없습니다.</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">회의실 설정(1)</string>
......
......@@ -529,6 +529,16 @@
<string name="operation_category">Category</string>
<string name="type_all">All</string>
<string name="msg_operation_enable_meeting_room_connected">Because you are in a conference room, this button is not available right now. \n Please select the document from common document</string>
<string name="batch_sync">batch sync</string>
<string name="batch_syncing">batch syncing...</string>
<string name="msg_confirm_batch_sync">Do you want to synchronize all the displayed operation?</string>
<string name="msg_batch_sync_disconnect_network">There are not connected to the internet, we will stop the synchronization process.</string>
<string name="msg_batch_sync_content_download_fail">Failed to download operation base content.</string>
<string name="msg_batch_sync_new_content_updating">Batch synchronization can not be performed because new data is being updated.</string>
<string name="msg_batch_sync_error">「%1$s」 failed. Cancel synchronization processing.\n</string>
<string name="msg_batch_sync_move_operation_view">You can not transition to the inspection work report screen because you are in a batch synchronization.</string>
<!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0-->
<string name="meetingroom_setting_1">Meeting room setting(1)</string>
......
......@@ -77,6 +77,15 @@
android:textStyle="bold" />
</RadioGroup>
<ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/search_result"
android:layout_width="wrap_content"
......
......@@ -43,7 +43,7 @@
<RadioButton
android:id="@+id/operation_location_type_all"
android:layout_width="80dp"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
......@@ -52,15 +52,17 @@
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/type_all"
android:textSize="10sp"
android:textStyle="bold" />
<RadioButton
android:id="@+id/operation_location_type_group"
android:layout_width="80dp"
android:layout_width="60dp"
android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background"
android:button="@null"
android:gravity="center"
android:textSize="10sp"
android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color"
android:text="@string/operation_category"
......@@ -68,6 +70,14 @@
</RadioGroup>
<ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync" />
<ImageButton
android:id="@+id/btn_common_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -49,7 +49,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> msg = remoteMessage.getData();
Log.d(TAG,"onMessageReceived(): msg :"+ msg);
Logger.d(TAG,"onMessageReceived(): msg :"+ msg);
try {
UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
MemberInfoDto memberInfo = logic.getMemberInfo();
......
......@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.cl.util;
import jp.agentec.abook.abv.bl.acms.client.json.content.MediaInfoJSON;
import jp.agentec.abook.abv.bl.acms.client.json.content.PageObjectJSON;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentObjectLogDao;
......@@ -13,6 +14,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.websocket.MeetingManager;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.helper.ABookPermissionHelper;
import jp.agentec.adf.util.DateTimeUtil;
import org.json.adf.JSONException;
......@@ -51,8 +53,9 @@ public class ContentLogUtil {
int readingLogId = contentReadingLogLogic.startContentReadLog(contentId);
// 位置情報取得許可、サービスオプション、ビルドオプションチェック
if (permissionAccessLocation && checkUsableReadinglogGps(contentId)) {
// 位置情報取得
ABookPermissionHelper helper = new ABookPermissionHelper(context, Constant.ABookPermissionType.AccessFineLocation, null);
if (checkUsableReadinglogGps(contentId) && helper.checkMultiPermissions(false)) { //20190529 アプリ側の位置情報許可チェックはしない
// 位置情報取得
locationManagerUtil = new LocationManagerUtil(context, new LocationManagerUtil.LocationManagerUtilListener() {
@Override
public void onGetLocationFailed() {
......
......@@ -321,8 +321,8 @@ public abstract class ABVActivity extends Activity {
}
}
protected void startActivity(Intent intend, NaviConsts ABVNavi) {
super.startActivity(intend);
protected void startActivity(Intent intent, NaviConsts ABVNavi) {
super.startActivity(intent);
ActivityHandlingHelper.transitionNavi(this, ABVNavi);
}
......@@ -800,7 +800,7 @@ public abstract class ABVActivity extends Activity {
showSimpleAlertDialog(getString(titleResId), getString(bodyResId));
}
protected void showSimpleAlertDialog(final String title, final String body) {
public void showSimpleAlertDialog(final String title, final String body) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
......
......@@ -98,9 +98,11 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.DisplayUtil;
import jp.agentec.abook.abv.ui.common.util.Initializer;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.HelpActivity;
import jp.agentec.abook.abv.ui.home.activity.LoginActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
......@@ -122,10 +124,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
protected ImageButton btnDownload;
protected ActivityHandlingHelper activityHandlingHelper;
protected Size mDisplaySize;
// 一括同期ビュー(コントロール)
protected ABVBatchSyncView batchSyncView;
/**
* メッセージ表示タイプ
*/
......@@ -207,7 +212,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
protected void onPause() {
super.onPause();
contentDownloader.removeContentDownloadListener(this);
if (!(this instanceof OperationListActivity)) {
// 作業一覧ではない場合、ダウンロードリスナーを削除する
contentDownloader.removeContentDownloadListener(this);
}
}
@Override
......@@ -218,6 +226,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override
protected void onApplicationBroughtFromBackground() {
if (isShowingBatchSync()) {
// 一括同期中は以下の処理を行わないようにする
return;
}
new Handler().post(new Runnable() {
@Override
public void run() {
......@@ -583,11 +595,23 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
contentLogic.deleteContent(dto, deletePhysical);
}
/**
* ダウンロード処理(wifiチェック/トーストメッセージ表示)
* @param contentId
* @return
*/
protected boolean contentDownload(long contentId) {
return contentDownload(contentId, true);
return contentDownload(contentId, true, true);
}
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag) {
/**
* ダウンロード処理
* @param contentId
* @param needCheckWifiFlag
* @param isShowToast
* @return
*/
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag, final boolean isShowToast) {
boolean result = true;
try {
if (needCheckWifiFlag) {
......@@ -595,7 +619,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
showWifiDisconnectAlert(R.string.C_E_SYSTEM_0005, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
contentDownload(contentId, false);
contentDownload(contentId, false, isShowToast);
}
}, new DialogInterface.OnClickListener() {
@Override
......@@ -609,45 +633,34 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else {
// 空き容量が少ない場合警告を表示
if (!StorageUtil.isFreeSpaceEnough(this)) {
handleErrorMessageToast(ErrorCode.STORAGE_WARNING);
Logger.w(TAG, "[storage free space enough]");
if (isShowToast) {
handleErrorMessageToast(ErrorCode.STORAGE_WARNING);
}
}
contentDownloader.download(contentId);
}
} catch (NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException" + e);
handleErrorMessageToast(ErrorCode.NETWORK);
if (isShowToast) {
handleErrorMessageToast(ErrorCode.NETWORK);
}
result = false;
} catch (ABVException e) {
if (btnDownload != null) {
btnDownload.setVisibility(View.INVISIBLE);
}
Logger.e("ABVException", e.toString());
result = false;
} catch (Exception e) {
Logger.e(TAG, "Exception " + e);
handleErrorMessageToast(ErrorCode.E107);
result = false;
} finally {
try {
List<ContentDto> contentList = contentDao.getUnfinishedDownloadAll();
if (contentList != null && contentList.size() > 0) {
if (btnDownload != null) {
btnDownload.setVisibility(View.VISIBLE);
}
} else {
if (btnDownload != null) {
btnDownload.setVisibility(View.INVISIBLE);
}
}
} catch (Exception e) {
Logger.e(TAG, "Exception " + e);
if (isShowToast) {
handleErrorMessageToast(ErrorCode.E107);
result = false;
}
result = false;
}
return result;
}
// Wifi非接続時のアラート表示
public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException {
showWifiDisconnectAlert(messageId, R.string.download, positive, negative);
......@@ -697,8 +710,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
}
public abstract boolean contentValidCheckAndDownload(long contentId);
public void startContentViewActivity(long contentId) {
startContentViewActivity(contentId, 0);
}
......@@ -745,6 +756,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
intent.putExtra(ABookKeys.HELP_VIEW_TYPE, helpViewType);
intent.setClassName(getApplicationContext().getPackageName(), className);
startActivity(intent);
}
/**
* 一括同期処理中であるか確認
* @return
*/
public boolean isShowingBatchSync() {
return batchSyncView != null && batchSyncView.isShowing();
}
}
......@@ -551,11 +551,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
}
}
@Override
public boolean contentValidCheckAndDownload(long contentId) {
return false; // dummy
}
protected void setMeetingParticipantCount(boolean isVisible, View toolBar) {
final TextView textView = (TextView)toolBar.findViewById(R.id.txt_meeting_participant);
if (textView == null) {
......
......@@ -24,6 +24,7 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.LogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
......@@ -52,7 +53,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
// 新着更新処理の終了後、プルダウンを完了させるためのビュー
protected PullToRefreshBase refreshBaseView;
protected String urlPassword; // Reader用
//Gettisの場合:プッシュ―メッセージを経由してコンテンツダウンロード場合対応
private String mPushMessage = ""; //コンテンツ追加の機能をの引数が増えないようにこの変数を追加
......@@ -262,31 +262,14 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
* @param contentId 対象コンテンツID
* @return boolean チェックの成功可否
*/
@Override
public boolean contentValidCheckAndDownload(final long contentId) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentValidCheckAndDownload(contentId, true);
}
});
return true;
}
/**
* コンテンツの有効性チェックとダウンロードを行う
* @param contentId 対象コンテンツID
* @param refreshFlag 画面のリフレッシュさせるかのフラグ
* @return boolean チェックの成功可否
*/
public boolean contentValidCheckAndDownload(long contentId, boolean refreshFlag) {
public boolean contentValidCheckAndDownload(long contentId) {
boolean checkResult = false;
int status = contentValidCheckAndShowMessage(contentId, MessageType.TYPE_SHOW_TOAST);
if (status == ContentCheckResultType.SUCCESS) {
checkResult = contentDownload(contentId);
}
if (status == ContentCheckResultType.NO_AUTH_DELETE && refreshFlag) {
if (status == ContentCheckResultType.NO_AUTH_DELETE) {
// コンテンツのチェック結果が権限喪失の場合はリフレッシュ
handler.post(new Runnable() {
@Override
......
......@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.common.activity;
import android.content.DialogInterface;
import android.os.Bundle;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic;
......@@ -18,15 +19,19 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil;
public class ShowPushMessageDailogActivity extends ABVUIActivity {
private static final String TAG = "ShowPushMessageDailogActivity";
OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String data = getIntent().getExtras().getString(PushMessageKey.data);
String data = getIntent().getExtras() != null ? getIntent().getExtras().getString(PushMessageKey.data) : null;
if (StringUtil.isNullOrEmpty(data)) {
final long operationId = StringUtil.isNullOrEmpty(getIntent().getExtras().getString(PushMessageKey.operationId)) ? 0 : Long.parseLong(getIntent().getExtras().getString(PushMessageKey.operationId));
if (operationId > 0) {
Logger.d(TAG, "operationId : " + operationId);
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message));
// リソースパターンの適用
......@@ -47,29 +52,36 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
R.string.msg_routineTask_report_disable_meeting_room,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else {
OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto == null) {
// リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_no_operation,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else if (operationDto.needSyncFlg) {
// リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_updated,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
OperationListActivity operationListActivity = ActivityHandlingHelper.getInstance().getPreviousOperationListActivity();
if (operationListActivity != null && operationListActivity.isShowingBatchSync()) {
Logger.d(TAG, "is showing Batch Sync");
// 一括同期中は移動しない
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, getString(R.string.msg_batch_sync_move_operation_view));
} else {
OperationListActivity operationListActivity = ActivityHandlingHelper.getInstance().getPreviousOperationListActivity();
if (operationListActivity != null) {
operationListActivity.startTaskDirectionOrReportView(operationDto);
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto == null) {
Logger.d(TAG, "operationDto is null");
// リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_list,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
R.string.msg_routineTask_report_disable_no_operation,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else if (operationDto.needSyncFlg) {
Logger.d(TAG, "needSyncFlg is true");
// リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_updated,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else {
if (operationListActivity != null) {
Logger.d(TAG, "startTaskDirectionOrReportView");
operationListActivity.startTaskDirectionOrReportView(operationDto);
} else {
Logger.d(TAG, "operationListActivity is null");
// リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_list,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
}
}
}
}
......
package jp.agentec.abook.abv.ui.common.view;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.PixelFormat;
import java.util.Stack;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.CommonExecutor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.ContentDao;
import jp.agentec.abook.abv.bl.dto.ContentDto;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
/**
* Created by leej on 2019/08/26.
*/
public class ABVBatchSyncView extends ProgressDialog {
private static final String TAG = "ABVBatchSyncView";
private Stack<OperationDto> mBatchSyncOperationStack = new Stack<>();
private ContentDao contentDao = AbstractDao.getDao(ContentDao.class);
private OperationListActivity mOperationListActivity;
// Activityが破棄された場合、処理を中止するフラグ
private boolean isDestroy = false;
public ABVBatchSyncView(Context context) {
super(context);
mOperationListActivity = (OperationListActivity)context;
init();
isDestroy = false;
}
// 初期化
private void init() {
if (getWindow() != null) {
setIndeterminate(false);
// キャンセルできないように設定・ナビゲーションバーのバックボタンも無効してくれる
setCancelable(false);
setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); //プログレスバー表示
getWindow().setFormat(PixelFormat.TRANSPARENT);
setMessage(getContext().getResources().getString(R.string.batch_syncing));
}
}
/**
* スタックをセット(同期対象情報)
* @param operationDtoStack
*/
public void setStack(Stack<OperationDto> operationDtoStack) {
setMax(operationDtoStack.size());
mBatchSyncOperationStack = operationDtoStack;
}
/**
* 閉じる処理
*/
public void closeProgressDialog() {
// プログレス値を0に初期化
setProgress(0);
dismiss();
}
/**
* スタック中の空チェック
* @return
*/
public boolean isStackEmpty() {
return mBatchSyncOperationStack.empty();
}
/**
* 一括同期処理(stackの中を全て同期する)
* ベース資料ダウンロードチェックして、未ダウンロードであればダウンロードして同期
*/
public void batchOperationSyncForCheckDonwload() {
if (isDestroy || isStackEmpty()) {
// Activity破棄フラグがtrue、またはスタックが存在しなければ、全て完了と見做す
closeProgressDialog();
Logger.d(TAG, "---batchSync is end");
return;
}
// ベース資料のダウンロードチェック
OperationDto peekOperationDto = mBatchSyncOperationStack.peek();
ContentDto contentDto = contentDao.getContent(peekOperationDto.contentId);
if (contentDto == null) {
Logger.e(TAG, "contentDto is null !");
closeProgressDialog();
return;
}
if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
if (!mOperationListActivity.operationContentDownload(contentDto)) {
// error
showBatchSyncErrorAlert(peekOperationDto, mOperationListActivity.getString(R.string.msg_batch_sync_content_download_fail));
}
return;
}
// 同期処理
batchOperationSync();
}
/**
* 一括同期処理(ベース資料はダウンロード済み)
*/
public void batchOperationSync() {
final OperationDto operationDto = mBatchSyncOperationStack.pop();
String errorMessage = mOperationListActivity.syncOperation(operationDto.operationId, operationDto.reportType, false);
if (errorMessage != null) {
showBatchSyncErrorAlert(operationDto, errorMessage);
} else {
// 正常
// 次のスタックがなければ、カウントしない
if (!isStackEmpty()) {
setProgress(getProgress() + 1);
}
// 次の作業を同期処理
batchOperationSyncForCheckDonwload();
}
}
// Activityが破棄された場合呼ばれる
public void setActivityDestroy() {
isDestroy = true;
}
/**
* 一括同期処理時、エラーアラート表示
* 一括同期中のプログレスバーは非表示にする
* @param operationDto
* @param errorMessage
*/
public void showBatchSyncErrorAlert(OperationDto operationDto, String errorMessage) {
// 異常
closeProgressDialog();
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
String convertErrorMsg = String.format(mOperationListActivity.getString(R.string.msg_batch_sync_error), operationDto.operationName) + errorMessage;
mOperationListActivity.showSimpleAlertDialog(mOperationListActivity.getString(R.string.app_name), convertErrorMsg);
} else {
// ネットワーク通信エラー
mOperationListActivity.showSimpleAlertDialog(mOperationListActivity.getString(R.string.app_name), mOperationListActivity.getString(R.string.msg_batch_sync_disconnect_network));
}
}
}
......@@ -52,11 +52,10 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationType;
......@@ -76,6 +75,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
......@@ -107,6 +107,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.KeyboardUtils;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.view.ABVListDialog;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.adapter.FixPushMessageAdapter;
......@@ -133,11 +134,12 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
public class OperationListActivity extends ABVUIActivity {
private static final String TAG = "OperationListActivity";
private ImageButton mViewModeButton;
private ImageButton mSearchButton;
private ImageButton mFilterButton;
private ImageButton mCommunicationButton;
private ImageButton mCommonContentButton;
private ImageButton mViewModeButton; // リスト・パンネル切り替えボタン
private ImageButton mSearchButton; // 検索ボタン
private ImageButton mFilterButton; // フィルタボタン
private ImageButton mCommunicationButton; // コミュニケーションボタン
private ImageButton mCommonContentButton; // 共通資料ボタン
private ImageButton mOperationBatchSyncButton; // 一括同期ボタン
public String mSearchWord;
public String mStartDateStr;
......@@ -156,10 +158,10 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mSearchDialog;
private Date mOperationLastEditDate;
private boolean isSyncGetTaskFileError;
private Dialog mPanoEntryDialog;
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
......@@ -207,6 +209,7 @@ public class OperationListActivity extends ABVUIActivity {
// 絞り検索マスタLogic
private ApertureMasterDataLogic mApertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class);
// ビューの作成
private class ReloadHandler implements Runnable {
@Override
......@@ -245,6 +248,10 @@ public class OperationListActivity extends ABVUIActivity {
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
mLocationTypeRadioGroup = (RadioGroup) findViewById(R.id.segment_group);
mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btc_batch_sync);
// 定期点検で同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合、needSyncFlgをtrueに更新
updateNeedSyncRoutineOperation();
// ビュー変更ボタンのタッチイベント
mViewModeButton.setOnClickListener(new View.OnClickListener() {
......@@ -299,15 +306,39 @@ public class OperationListActivity extends ABVUIActivity {
}
});
// 一括同期ボタン
mOperationBatchSyncButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showSimpleAlertDialog(getString(R.string.app_name), getString(R.string.request_network_connection));
return;
}
// 新着更新チェック
if (contentRefresher.isRefreshing()) {
showSimpleAlertDialog(getString(R.string.app_name), getString(R.string.msg_batch_sync_new_content_updating));
return;
}
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(OperationListActivity.this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
showBatchSyncDialog();
}
});
if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId))) {
final long operationId = Long.parseLong(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId));
String message = getIntent().getStringExtra(AppDefType.PushMessageKey.message);
if (operationId > 0) {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, getRString(R.string.app_name), message);
// リソースパターンの適用
alertDialog.setPositiveButton(PatternStringUtil.patternToInt(getApplicationContext(),
R.string.work_report,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
alertDialog.setPositiveButton(PatternStringUtil.patternToInt(getApplicationContext(), R.string.work_report, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
......@@ -321,6 +352,9 @@ public class OperationListActivity extends ABVUIActivity {
ErrorMessage.showErrorMessageToast(OperationListActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_meeting_room,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else if (isShowingBatchSync()) {
// 一括同期中は移動しない
ErrorMessage.showErrorMessageToast(OperationListActivity.this, getString(R.string.msg_batch_sync_move_operation_view));
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId);
......@@ -353,6 +387,7 @@ public class OperationListActivity extends ABVUIActivity {
alertDialog.show();
}
}
mAllOperationReportTypes = getOperationReportTypeList(true);
// リスト更新
setOperationListView();
......@@ -406,20 +441,30 @@ public class OperationListActivity extends ABVUIActivity {
// フィルターボタンを無効にする
mFilterButton.setImageDrawable(getRDrawable(R.drawable.ic_filter));
setEnabledImageButton(mFilterButton);
setEnabledImageButton(mFilterButton, false);
// 検索ボタンを無効にする
mSearchButton.setImageDrawable(getRDrawable(R.drawable.ic_operation_search));
setEnabledImageButton(mSearchButton);
setEnabledImageButton(mSearchButton, false);
// 一括同期ボタン表示
mOperationBatchSyncButton.setVisibility(View.VISIBLE);
} else {
// 全て
cancelToolbarEnabledIcon();
// ボタンを活性化
setEnabledImageButton(mFilterButton, true);
setEnabledImageButton(mSearchButton, true);
// 一括同期ボタン非表示
mOperationBatchSyncButton.setVisibility(View.GONE);
}
// 全て・作業種別のセグメントチェック設定
checkOperationGroupType(getABVUIDataCache().getOperationGroupMasterMode());
} else {
// アイコン非表示
mLocationTypeRadioGroup.setVisibility(View.GONE);
cancelToolbarEnabledIcon();
// 一括同期ボタンを非表示
mOperationBatchSyncButton.setVisibility(View.GONE);
// ボタンを活性化
setEnabledImageButton(mFilterButton, true);
setEnabledImageButton(mSearchButton, true);
}
// ツールバーの検索結果レイアウトの表示・非表示
......@@ -433,19 +478,17 @@ public class OperationListActivity extends ABVUIActivity {
mEndDateStr = null;
clearData();
}
// イメージボタンを無効にする
private void setEnabledImageButton(ImageButton button) {
button.setEnabled(false);
button.setColorFilter(0xaa808080);
}
/**
* ツールバーのアイコンを有効にする
*/
private void cancelToolbarEnabledIcon() {
mFilterButton.setEnabled(true);
mFilterButton.setColorFilter(null);
mSearchButton.setEnabled(true);
mSearchButton.setColorFilter(null);
// イメージボタンを無効/有効にする
private void setEnabledImageButton(ImageButton button, boolean enabled) {
if (enabled) {
// 活性化
button.setEnabled(true);
button.setColorFilter(null);
} else {
// 非活性化
button.setEnabled(false);
button.setColorFilter(0xaa808080);
}
}
/**
......@@ -509,8 +552,12 @@ public class OperationListActivity extends ABVUIActivity {
public void onResume() {
Logger.i(TAG, "onResume:start");
super.onResume();
if (isShowingBatchSync()) {
// 一括同期中の場合何もしない
return;
}
refreshOperationList();
// 作業指示・報告からプロジェクト一覧へ戻った時の同期処理
// 報告画面から作業一覧へ戻った時の同期処理
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
if (operationId != -1) {
final OperationDto operationDto = mOperationLogic.getOperation(operationId);
......@@ -524,7 +571,7 @@ public class OperationListActivity extends ABVUIActivity {
Logger.d(TAG, "onResume Sync operationId : " + operationId);
if (operationDto != null && operationDto.needSyncFlg) {
// 同期処理後、直列処理で新着更新を行う。
syncOperation(operationId, operationDto.reportType);
singleSyncOperation(operationId, operationDto.reportType);
} else {
closeProgressPopup();
}
......@@ -730,7 +777,7 @@ public class OperationListActivity extends ABVUIActivity {
contentPath = ABVEnvironment.getInstance().getPanoImageDirName(ContentFileExtractor.getInstance().getContentCacheDirWithExtract(operationDto.contentId));
}
// プロジェクトの指示/報告表示時、必要なJSONファイル作成
// 作業の報告画面を表示時、必要なJSONファイル作成
mOperationLogic.createJsonForOpenABookCheckPano(operationDto.operationId, operationDto.contentId, contentPath);
mOperationLogic.createJsonForOperationContent(operationDto.operationId, contentPath, operationDto.reportType == ReportType.RoutineTask);
......@@ -769,48 +816,61 @@ public class OperationListActivity extends ABVUIActivity {
@Override
public void onDownloadingContentZip(final ContentZipDownloadNotification notification) {
Logger.d(TAG, "[onDownloadingContentZip]");
super.onDownloadingContentZip(notification);
OperationContentDto operationContentDto = mOperationContentDao.getOperationContentForContentId(notification.getContentId());
if (operationContentDto != null) {
if (notification.downloadStatus == DownloadStatusType.Succeeded) {
OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId);
syncOperation(operationContentDto.operationId, operationDto.reportType, true);
if (isShowingBatchSync()) {
// 一括同期からの同期処理
Logger.d(TAG, "[onDownloadingContentZip] batchOperationSync start");
batchSyncView.batchOperationSync();
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId);
singleSyncOperation(operationContentDto.operationId, operationDto.reportType, true);
}
} else if (notification.downloadStatus == DownloadStatusType.Failed || notification.downloadStatus == DownloadStatusType.Canceled || notification.downloadStatus == DownloadStatusType.Paused) {
Logger.i(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus);
Logger.d(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus);
if (isShowingBatchSync()) {
// 一括同期からのダウンロード失敗時、エラーメッセージ表示
OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId);
batchSyncView.showBatchSyncErrorAlert(operationDto, getString(R.string.msg_batch_sync_content_download_fail));
}
closeProgressPopup();
}
}
}
// 作業の自動同期処理(onresumeで呼ばれる同期処理)
public void singleSyncOperation(final long operationId, int operationReportType) {
singleSyncOperation(operationId, operationReportType, false);
}
/**
* プロジェクト同期処理
* 作業同期処理(単一)
* @param operationId
* @param operationReportType
*/
public void syncOperation(final long operationId, int operationReportType) {
syncOperation(operationId, operationReportType, false);
public void singleSyncOperation(final long operationId, int operationReportType, boolean buttonEventFlg) {
String errorMessage = syncOperation(operationId, operationReportType, buttonEventFlg);
if (errorMessage != null) {
closeProgressPopup();
// エラーメッセージ表示
showSimpleAlertDialog(getString(R.string.app_name), errorMessage);
}
}
/**
* プロジェクト同期処理
* 作業同期処理
* @param operationId
* @param reportType
* @param buttonEventFlag
* @return result errorMessage
*/
public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
public String syncOperation(final long operationId, int reportType, boolean buttonEventFlag) {
final StringBuilder errorMsg = new StringBuilder();
Logger.i(TAG, "---sync start");
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(OperationListActivity.this, R.string.request_network_connection, Toast.LENGTH_SHORT);
closeProgressPopup();
return;
}
// 新着更新チェック
if (contentRefresher.isRefreshing()) {
// ignore
closeProgressPopup();
return;
}
try {
//コンテンツダウンロード関連プログレスバー値設定
progressDialogHorizontal.setProgress(20);
......@@ -833,12 +893,12 @@ public class OperationListActivity extends ABVUIActivity {
progressDialogHorizontal.setProgress(60);
// 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag);
if (reportType == ReportType.RoutineTask) {
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, errorMsg);
// mOperationLastEditDateがnullの場合、エラーと見做す
if (mOperationLastEditDate != null && reportType == ReportType.RoutineTask) {
if (buttonEventFlag) {
String dialogMsg = null;
// 定期点検プロジェクトの利用可能日付を取得
// 定期点検の利用可能日付を取得
String avilableDateStr = mOperationLogic.getRoutineTaskOperationAvailableDateStr(operationId);
if (!StringUtil.isNullOrEmpty(avilableDateStr)) {
// 利用可能メッセージ
......@@ -853,7 +913,7 @@ public class OperationListActivity extends ABVUIActivity {
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
if (!StringUtil.isNullOrEmpty(dialogMsg)) {
showSimpleAlertDialog(getString(R.string.app_name), dialogMsg);
errorMsg.append(dialogMsg);
}
}
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
......@@ -863,41 +923,29 @@ public class OperationListActivity extends ABVUIActivity {
switch (e.getCode()) {
case P_E_ACMS_P003:
// リソースパターンを適用
showSimpleAlertDialog(R.string.app_name, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.P003,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P003, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P004:
showSimpleAlertDialog(R.string.app_name, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.P004,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P004, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P005:
showSimpleAlertDialog(R.string.app_name, R.string.P005);
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P005, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
case P_E_ACMS_P006:
showSimpleAlertDialog(R.string.app_name, R.string.P006);
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P006, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break;
default:
Logger.e(TAG, "syncOperation", e);
handleErrorMessageToast(ErrorMessage.getErrorCode(e));
errorMsg.append(ErrorMessage.getErrorMessage(this, ErrorMessage.getErrorCode(e)));
break;
}
} catch (Exception e) {
Logger.e(TAG, e);
handler.post(new Runnable() {
@Override
public void run() {
handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_0001);
closeProgressPopup();
}
});
errorMsg.append(ErrorMessage.getErrorMessage(this, ABVExceptionCode.C_E_SYSTEM_0001));
} finally {
handler.post(new Runnable() {
@Override
public void run() {
// データの受信時、エラーキャッチのための変数を初期化
isSyncGetTaskFileError = false;
if (mOperationLastEditDate != null) {
mOperationLogic.finishedSyncOperation(operationId, mOperationLastEditDate);
progressDialogHorizontal.setProgress(100);
......@@ -909,6 +957,7 @@ public class OperationListActivity extends ABVUIActivity {
});
Logger.i(TAG, "---sync end");
}
return errorMsg.length() > 0 ? errorMsg.toString() : null;
}
// 設定画面へ遷移
......@@ -930,6 +979,11 @@ public class OperationListActivity extends ABVUIActivity {
* @param operationDto
*/
public void startPanoEdit(OperationDto operationDto) {
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
if (operationDto.contentId != null && operationDto.contentId != 0) {
showProgressPopup();
try {
......@@ -963,7 +1017,7 @@ public class OperationListActivity extends ABVUIActivity {
* @throws NoSuchAlgorithmException
* @throws ZipException
*/
public Date receptionTaskData(long operationId, Callback progressCallback, boolean buttonEventFlag) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
......@@ -997,7 +1051,6 @@ public class OperationListActivity extends ABVUIActivity {
mTaskReportDao.delete(localTaskReportDto);
}
}
localTaskReportList.remove(localTaskReportDto);
}
}
......@@ -1036,8 +1089,12 @@ public class OperationListActivity extends ABVUIActivity {
serverTaskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
if (isSyncGetTaskFileError) {
try {
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null;
}
if (localTaskReportDto != null) {
......@@ -1052,6 +1109,9 @@ public class OperationListActivity extends ABVUIActivity {
try {
refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null;
}
if (!serverTaskReportDto.jsonData.isEmpty()) {
......@@ -1074,8 +1134,9 @@ public class OperationListActivity extends ABVUIActivity {
}
}
}
progressCallback.callback(new Integer(progress));
if (progressCallback != null) {
progressCallback.callback(new Integer(progress));
}
}
// サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) {
......@@ -1083,7 +1144,9 @@ public class OperationListActivity extends ABVUIActivity {
mTaskDao.delete(taskDto);
}
lastEditDate = json.lastEditDate;
progressCallback.callback(new Integer(40));
if (progressCallback != null) {
progressCallback.callback(new Integer(40));
}
return lastEditDate;
}
......@@ -1108,21 +1171,12 @@ public class OperationListActivity extends ABVUIActivity {
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),null, true);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(getApplicationContext(), PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_error_task_report_receiving_failed,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_LONG);
throw e;
}
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),null, true);
}
}
......@@ -1141,7 +1195,7 @@ public class OperationListActivity extends ABVUIActivity {
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws ABVException, InterruptedException, ZipException, NoSuchAlgorithmException, IOException {
public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws Exception {
String reportStartDateHypn = DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
final String reportStartDateNone = DateTimeUtil.toString_yyyyMMddHHmmss_none(reportStartDate);
// 既存の添付ディレクトリ削除
......@@ -1151,25 +1205,16 @@ public class OperationListActivity extends ABVUIActivity {
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (getReportFileFlg) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start
int taskReportLevel = 0;
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone));
// #32926 end
String outputFilePath = mOperationLogic.getRoutineTaskReportFile(operationId, taskKey, taskId, taskReportId, taskReportInfoId, reportStartDateNone, reportAttachedFileName);
// #32926 start
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(getApplicationContext(), PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_error_task_report_receiving_failed,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
}
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start
int taskReportLevel = 0;
FileUtil.delete(ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone));
// #32926 end
String outputFilePath = mOperationLogic.getRoutineTaskReportFile(operationId, taskKey, taskId, taskReportId, taskReportInfoId, reportStartDateNone, reportAttachedFileName);
// #32926 start
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end
}
}
......@@ -1778,6 +1823,7 @@ public class OperationListActivity extends ABVUIActivity {
*/
public void openReportView(OperationDto operationDto) {
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
// 新着更新を止める
......@@ -1799,6 +1845,13 @@ public class OperationListActivity extends ABVUIActivity {
if (contentRefresher.isRefreshing()) {
return;
}
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
// リソースパターンの適用
showProgressView(PatternStringUtil.patternToString(getApplicationContext(),
R.string.synchronizing,
......@@ -1809,10 +1862,17 @@ public class OperationListActivity extends ABVUIActivity {
Logger.i(TAG, "[syncOperation] operationId=%s, contentId=%s", operationDto.operationId, operationDto.contentId);
// コンテンツダウンロード
ContentDto contentDto = contentDao.getContent(operationDto.contentId);
if (contentDto == null || !contentDto.downloadedFlg || contentDto.updatedFlg) {
contentDownload(operationDto.contentId, false);
if (contentDto == null) {
Logger.e(TAG, "contentDto is null !");
return;
}
if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
if (!operationContentDownload(contentDto)) {
Logger.e("operation sync baseFile download fail");
closeProgressPopup();
}
} else {
syncOperation(operationDto.operationId, operationDto.reportType, true);
singleSyncOperation(operationDto.operationId, operationDto.reportType, true);
}
}
});
......@@ -2020,7 +2080,7 @@ public class OperationListActivity extends ABVUIActivity {
* @param autoClose 直下階層が存在しない場合、ダイアログを自動で閉じる
*/
public void showOperationGroupMasterDialog(boolean isInit, boolean autoClose) {
if (isInit) {
if (isInit || operationCountMap == null) {
// 最後の階層レベルを取得
Integer lastLevel = mOperationGroupMasterLogic.getLastGroupLevel();
operationCountMap = new HashMap<Integer, Integer>();
......@@ -2052,7 +2112,7 @@ public class OperationListActivity extends ABVUIActivity {
});
// autoCloseがtrueの場合、下位階層が存在しなければreturnで以下の処理は行わない
if (autoClose && operationGroupMasterDtoList.size() < 1) {
if (autoClose && (operationGroupMasterDtoList == null || operationGroupMasterDtoList.size() < 1)) {
return;
}
......@@ -2198,4 +2258,123 @@ public class OperationListActivity extends ABVUIActivity {
private void setApertureMasterDataFetchDate() {
putUserPref(AppDefType.UserPrefKey.APERTURE_MASTER_DATA_FETCH_DATE, ABVDataCache.getInstance().getTempApertureMasterDataFetchDate());
}
/**
* カテゴリの一括同期ダイアログ表示
*/
private void showBatchSyncDialog() {
ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(this);
dialog.setTitle(getString(R.string.batch_sync));
dialog.setMessage(getString(R.string.msg_confirm_batch_sync));
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 一括同期開始
categoryBatchSync();
}
});
dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
if (mAlertDialog != null && this.mAlertDialog.isShowing()) {
mAlertDialog.dismiss();
}
this.mAlertDialog = dialog;
mAlertDialog.show();
}
/**
* カテゴリの一括同期ボタン
*/
public void categoryBatchSync() {
Logger.i(TAG, "---batch sync start");
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showSimpleAlertDialog(getString(R.string.app_name), getString(R.string.request_network_connection));
return;
}
// 作業種別に関連する作業リストを取得
List<OperationDto> operationList = mOperationDao.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId());
// 作業リストをスタックにセット
Stack<OperationDto> operationDtoStack = new Stack<OperationDto>();
operationDtoStack.addAll(operationList);
// 一括同期を設定
batchSyncView = new ABVBatchSyncView(this);
// batchSyncViewにスタックをセットして表示
batchSyncView.setStack(operationDtoStack);
batchSyncView.show();
// 一括同期処理
batchSyncView.batchOperationSyncForCheckDonwload();
}
/**
* 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
* needSyncFlgをtrueに更新する
*/
private void updateNeedSyncRoutineOperation() {
// サービスオプションチェック
if (ABVDataCache.getInstance().serviceOption.isRoutineTaskReport()) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合needSyncFlgをtrueに更新する
List<OperationDto> deactivatedRoutineOperationList = mOperationDao.getDeactivatedRoutineOperation();
for (OperationDto routineOperationDto : deactivatedRoutineOperationList) {
String syncedDate = getUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, routineOperationDto.operationId), "");
if (StringUtil.isNullOrEmpty(routineOperationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
mOperationLogic.updateSyncOperation(routineOperationDto.operationId, true);
}
}
}
}
/**
* 作業用コンテンツダウンロード時、ダウンロードかダウンロード再開か判定して行う。
* @param contentDto
* @return
*/
public boolean operationContentDownload(final ContentDto contentDto) {
if (contentDto.isDownloadPaused()) {
// ダウンロード途中で通信が切れた場合、一時停止のステータスに変更になるため、再開させる
try {
contentDownloader.resume(contentDto.contentId);
} catch (Exception e) {
Logger.e(TAG, "downloadContent failed. contentId=" + contentDto.contentId, e);
return false;
}
} else {
// ダウンロード
return contentDownload(contentDto.contentId, false, false);
}
return true;
}
/**
* 一括同期の活性化・非活性化チェック
*/
public void checkBatchNeedSyncButton(Integer operationGroupMasterId) {
if (mOperationDao.hasNeedSyncOperationByGroupMasterId(operationGroupMasterId)) {
// 選択したカテゴリ一覧でneedSyncFlgがtrueの作業が存在すれば、活性化する
setEnabledImageButton(mOperationBatchSyncButton, true);
} else {
// 一括同期ボタンを非活性化する
setEnabledImageButton(mOperationBatchSyncButton, false);
}
}
@Override
public void onDestroy() {
Logger.d(TAG, "onDestroy");
contentDownloader.removeContentDownloadListener(this);
batchSyncView.setActivityDestroy();
super.onDestroy();
}
}
......@@ -211,7 +211,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
mOperationRelatedContentSectionAdapter.setAdapterListener(new OperationRelatedContentSectionAdapter.OperationRelatedContentSectionListener() {
@Override
public boolean onContentDownload(long contentId) {
return contentValidCheckAndDownload(contentId, true);
return contentValidCheckAndDownload(contentId);
}
@Override
......@@ -324,7 +324,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
protected Void doInBackground(Void... params) {
for (ContentDto contentDto : downloadList) {
Logger.i(TAG, "downloading content=" + contentDto.contentName);
contentValidCheckAndDownload(contentDto.contentId, true);
contentValidCheckAndDownload(contentDto.contentId);
}
return null;
}
......
......@@ -118,30 +118,12 @@ public class OperationListAdapter extends AbstractOperationAdapter {
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) {
holder.ivSync.setVisibility(View.VISIBLE);
} else {
// needSyncFlgがfalseの場合
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
holder.ivSync.setVisibility(View.VISIBLE);
} else {
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
}
holder.ivSync.setVisibility(operationDto.needSyncFlg ? View.VISIBLE : View.INVISIBLE);
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
// 作業のコンテンツが存在しない場合は、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
if(operationDto.operationType == OperationType.PANO) {
if (operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
holder.ivPanoEdit.setVisibility(View.INVISIBLE);
......
......@@ -145,26 +145,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
// 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) {
holder.ivSync.setVisibility(View.VISIBLE);
} else {
// needSyncFlgがfalseの場合
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
holder.ivSync.setVisibility(View.VISIBLE);
} else {
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
}
holder.ivSync.setVisibility(operationDto.needSyncFlg ? View.VISIBLE : View.INVISIBLE);
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
// 作業のコンテンツが存在しない場合は、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
......
......@@ -2,6 +2,7 @@ package jp.agentec.abook.abv.ui.home.helper;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
......@@ -25,26 +26,25 @@ import jp.agentec.abook.abv.ui.viewer.activity.HTMLXWalkWebViewActivity;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
import static org.chromium.base.ContextUtils.getApplicationContext;
/**
* 権限チェック及び設定画面遷移
* Created by kim jinsung on 2018/09/21.
*/
public class ABookPermissionHelper {
private Activity mActivity;
private Context mContext;
private int mPermitionType;
private AlertDialog mAlertDialog;
private Callback mCallback;
public ABookPermissionHelper(Activity activity, int permissionType, Callback callback) {
mActivity = activity;
public ABookPermissionHelper(Context context, int permissionType, Callback callback) {
mContext = context;
mPermitionType = permissionType;
mCallback = callback;
}
public ABookPermissionHelper(Activity activity) {
mActivity = activity;
public ABookPermissionHelper(Context context) {
mContext = context;
}
public ArrayList<String> checkMultiPermissions() {
......@@ -55,30 +55,30 @@ public class ABookPermissionHelper {
return reqPermissions;
}
// 位置情報
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.ACCESS_FINE_LOCATION);
}
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.ACCESS_COARSE_LOCATION);
}
// ストレージ
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.READ_EXTERNAL_STORAGE);
}
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
// カメラ
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.CAMERA);
}
// マイク(オーディオ)
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.RECORD_AUDIO);
}
......@@ -95,77 +95,77 @@ public class ABookPermissionHelper {
switch (mPermitionType) {
case Constant.ABookPermissionType.ReadExternalStorage:
// ストレージ
if (ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(mActivity, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
if (mActivity instanceof HTMLWebViewActivity || mActivity instanceof HTMLXWalkWebViewActivity || mActivity instanceof OperationListActivity) {
if (ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.READ_EXTERNAL_STORAGE) != PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(mContext, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) {
if (mContext instanceof HTMLWebViewActivity || mContext instanceof HTMLXWalkWebViewActivity || mContext instanceof OperationListActivity) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_storage_album,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} else {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_storage_update,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
}
break;
case Constant.ABookPermissionType.AccessFineLocation:
// 位置情報
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PERMISSION_GRANTED) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_location,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PERMISSION_GRANTED) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_location,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
break;
case Constant.ABookPermissionType.Camera:
// カメラ
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.CAMERA) != PERMISSION_GRANTED) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_camera,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
break;
case Constant.ABookPermissionType.Audio:
// マイク(オーディオ)
if (ContextCompat.checkSelfPermission(mActivity,
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.RECORD_AUDIO) != PERMISSION_GRANTED) {
// リソースパターンの適用
permitionTextResourceId = PatternStringUtil.patternToInt(getApplicationContext(),
permitionTextResourceId = PatternStringUtil.patternToInt(mContext,
R.string.msg_permission_dialog_mic,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
}
break;
}
if (permitionTextResourceId > 0) {
if (showDialogFlg) {
ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(mActivity);
ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(mContext);
// リソースパターンの適用
dialog.setTitle(PatternStringUtil.patternToString(getApplicationContext(),
dialog.setTitle(PatternStringUtil.patternToString(mContext,
R.string.title_permission_dialog,
getUserPref(getApplicationContext(), AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
getUserPref(mContext, AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
dialog.setMessage(permitionTextResourceId);
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", mActivity.getPackageName(), null);
Uri uri = Uri.fromParts("package", mContext.getPackageName(), null);
intent.setData(uri);
mActivity.startActivity(intent);
mContext.startActivity(intent);
if (mCallback != null) {
mCallback.callback(true);
}
......
......@@ -74,6 +74,8 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
mAppActivity.closeOperationGroupMasterDialog();
}
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
mAppActivity.checkBatchNeedSyncButton(peekOperationGroupMasterDto.operationGroupMasterId);
// 作業種別IDで紐づく作業リストを取得
return mOperationGroupMasterLogic.getOperationByOperationGroupMasterId(peekOperationGroupMasterDto.operationGroupMasterId);
}
......
......@@ -103,7 +103,9 @@ public class HTMLWebViewActivity extends ParentWebViewActivity {
webView = (WebView) findViewById(R.id.webView2);
webView.setVisibility(View.VISIBLE);
webView.setVerticalScrollbarOverlay(true); // スクロールバー部分の隙間を消す
webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
if (Logger.isDebugEnabled()) {
webView.setWebContentsDebuggingEnabled(true); //デバッグモード(chromeからinspect可)
}
// webView.setWebViewClient(new WebViewClient());
// //ブラウザの描画領域を対象としたイベントをフック
WebSettings settings = webView.getSettings();
......
......@@ -119,8 +119,9 @@ public class HTMLXWalkWebViewActivity extends ParentWebViewActivity {
settings.setUseWideViewPort(true); // 画面の横幅にページの横幅を合わせる
settings.setDomStorageEnabled(true); // WebStorage有効化
settings.setCacheMode(XWalkSettings.LOAD_NO_CACHE);
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可)
if (Logger.isDebugEnabled()) {
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); //デバッグモード(chromeからinspect可)
}
final RelativeLayout fl = (RelativeLayout) findViewById(R.id.frameTopbar);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment