Commit b276ad7c by Kim Jinsung

Task #44587【And】カテゴリ選択時の一括更新アイコン機能追加

parent 23854c17
......@@ -1439,5 +1439,14 @@
<string name="title_all_operation">全作業</string>
<string name="category_list">カテゴリ一覧</string>
<string name="title_quick_report_output">帳票確認</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>
<string name="msg_batch_sync_fail_meeting_room_connected">会議室入室中の為、このボタンは利用できません。</string>
</resources>
......@@ -1447,5 +1447,14 @@
<string name="title_all_operation">전체 작업</string>
<string name="category_list">분류 목록</string>
<string name="title_quick_report_output">장표 확인</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>
<string name="msg_batch_sync_fail_meeting_room_connected">회의실 접속 중에는 이 버튼을 이용하실 수 없습니다.</string>
</resources>
\ No newline at end of file
......@@ -1445,5 +1445,14 @@
<string name="title_all_operation">All</string>
<string name="category_list">Select Category</string>
<string name="title_quick_report_output">Report confirmation</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>
<string name="msg_batch_sync_fail_meeting_room_connected">This button is not available because the meeting is connected.</string>
</resources>
\ No newline at end of file
......@@ -51,7 +51,12 @@
android:textColor="@color/text_dialog"
android:textSize="15dp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/btn_batch_sync"
style="@style/ToolBarIcon"
android:layout_toLeftOf="@+id/btn_search"
android:src="@drawable/btn_operation_batch_sync"
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_search"
android:layout_width="wrap_content"
......
......@@ -59,6 +59,13 @@
android:textStyle="bold" />
</LinearLayout>
<ImageButton
android:id="@+id/btn_batch_sync"
style="@style/ToolBarIcon"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@+id/btn_search"
android:src="@drawable/btn_operation_batch_sync"
android:visibility="gone" />
<ImageButton
android:id="@+id/btn_search"
......
......@@ -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,6 +98,7 @@ 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;
......@@ -125,7 +126,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected ImageButton btnDownload;
protected ActivityHandlingHelper activityHandlingHelper;
protected Size mDisplaySize;
// 一括同期ビュー(コントロール)
protected ABVBatchSyncView batchSyncView;
/**
* メッセージ表示タイプ
*/
......@@ -590,6 +592,17 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
}
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag) {
return contentDownload(contentId, true, true);
}
/**
* ダウンロード処理
* @param contentId
* @param needCheckWifiFlag
* @param isShowToast
* @return
*/
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag, final boolean isShowToast) {
boolean result = true;
try {
if (needCheckWifiFlag) {
......@@ -597,7 +610,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
......@@ -611,42 +624,29 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else {
// 空き容量が少ない場合警告を表示
if (!StorageUtil.isFreeSpaceEnough(this)) {
Logger.w(TAG, "[storage free space enough]");
if (isShowToast) {
handleErrorMessageToast(ErrorCode.STORAGE_WARNING);
}
}
contentDownloader.download(contentId);
}
} catch (NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException" + e);
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);
if (isShowToast) {
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);
handleErrorMessageToast(ErrorCode.E107);
result = false;
}
}
return result;
}
......@@ -749,4 +749,11 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
startActivity(intent);
}
/**
* 一括同期処理中であるか確認
* @return
*/
public boolean isShowingBatchSync() {
return batchSyncView != null && batchSyncView.isShowing();
}
}
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.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));
}
}
}
......@@ -75,6 +75,7 @@ public class OperationGroupMasterListHelper extends CategoryOperationListHelper<
}
OperationGroupMasterDto peekOperationGroupMasterDto = stack.peek();
mAppActivity.checkBatchNeedSyncButton(peekOperationGroupMasterDto.operationGroupMasterId);
// ソート方向
int operationSortType = mAppActivity.getSortCondition();
OperationSortingType operationSortingType = OperationSortingType.parse(operationSortType);
......
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