Commit 3e2de8d8 by Lee Jaebin

一括同期処理(コメント整理・ログ追加・要らない処理削除)

parent 9e1f318a
...@@ -840,9 +840,7 @@ public class ContentDownloader { ...@@ -840,9 +840,7 @@ public class ContentDownloader {
private void onDownloadingContentZip(HttpDownloadNotification notification, DownloadStatusType downloadStatus) { private void onDownloadingContentZip(HttpDownloadNotification notification, DownloadStatusType downloadStatus) {
ContentZipDownloadNotification dlNotification = new ContentZipDownloadNotification(notification, downloadStatus); ContentZipDownloadNotification dlNotification = new ContentZipDownloadNotification(notification, downloadStatus);
Logger.i(TAG, "--------------- dlNotification");
for (ContentDownloadListener listener : contentDownloadListenerSet) { for (ContentDownloadListener listener : contentDownloadListenerSet) {
Logger.i("---------------" + listener.getClass().toString());
listener.onDownloadingContentZip(dlNotification); listener.onDownloadingContentZip(dlNotification);
} }
} }
......
...@@ -1259,9 +1259,7 @@ public class OperationLogic extends AbstractLogic { ...@@ -1259,9 +1259,7 @@ public class OperationLogic extends AbstractLogic {
operationDto.reportType, operationDto.reportType,
taskReportSendDto.hotspotChangeFlg taskReportSendDto.hotspotChangeFlg
); );
if (progressCallback != null) {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
}
removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId); removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
......
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="@color/text_select"
android:text="@string/dummy_str"
/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:padding="6dp"
/>
...@@ -14,16 +14,14 @@ import jp.agentec.abook.abv.launcher.android.R; ...@@ -14,16 +14,14 @@ import jp.agentec.abook.abv.launcher.android.R;
*/ */
public class ABVBatchSyncView extends ProgressDialog { public class ABVBatchSyncView extends ProgressDialog {
private Context mContext;
private Stack<OperationDto> mBatchSyncOperationStack = new Stack<>(); private Stack<OperationDto> mBatchSyncOperationStack = new Stack<>();
public ABVBatchSyncView(Context context) { public ABVBatchSyncView(Context context) {
super(context); super(context);
mContext = context;
init(); init();
} }
// 初期化
private void init() { private void init() {
if (getWindow() != null) { if (getWindow() != null) {
setIndeterminate(false); setIndeterminate(false);
...@@ -34,29 +32,49 @@ public class ABVBatchSyncView extends ProgressDialog { ...@@ -34,29 +32,49 @@ public class ABVBatchSyncView extends ProgressDialog {
} }
} }
/**
* スタックをセット(同期対象情報)
* @param operationDtoStack
*/
public void setStack(Stack<OperationDto> operationDtoStack) { public void setStack(Stack<OperationDto> operationDtoStack) {
setMax(operationDtoStack.size()); setMax(operationDtoStack.size());
mBatchSyncOperationStack = operationDtoStack; mBatchSyncOperationStack = operationDtoStack;
} }
public OperationDto getOperationDtoByStack() { /**
* 参照のみ、stackには保存状態
* @return
*/
public OperationDto getOperationStackPeek() {
return mBatchSyncOperationStack.peek(); return mBatchSyncOperationStack.peek();
} }
/**
* stackからOperationDtoを取り出す
* @return
*/
public OperationDto getOperationStackPop() {
return mBatchSyncOperationStack.pop();
}
public boolean checkMaxProgress() { public boolean checkMaxProgress() {
return getMax() == getProgress() + 1; return getMax() == getProgress() + 1;
} }
/**
* 閉じる処理
*/
public void closeProgressDialog() { public void closeProgressDialog() {
// プログレス値を0に初期化
setProgress(0); setProgress(0);
dismiss(); dismiss();
} }
public Stack<OperationDto> getBatchSyncOperationStack() { /**
return mBatchSyncOperationStack; * スタック中の空チェック
} * @return
*/
public boolean empty() { public boolean isStackEmpty() {
return mBatchSyncOperationStack.empty(); return mBatchSyncOperationStack.empty();
} }
} }
...@@ -2307,6 +2307,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2307,6 +2307,7 @@ public class OperationListActivity extends ABVUIActivity {
List<OperationDto> operationList = mOperationDao.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId()); List<OperationDto> operationList = mOperationDao.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId());
// 一覧に作業が存在しない場合 // 一覧に作業が存在しない場合
if (operationList == null || operationList.isEmpty()) { if (operationList == null || operationList.isEmpty()) {
Logger.w(TAG, "categoryBatchSync operation is null or Empty");
return; return;
} }
...@@ -2316,8 +2317,11 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2316,8 +2317,11 @@ public class OperationListActivity extends ABVUIActivity {
operationDtoStack.push(operationDto); operationDtoStack.push(operationDto);
} }
// batchSyncViewにスタックをセットして表示
batchSyncView.setStack(operationDtoStack); batchSyncView.setStack(operationDtoStack);
batchSyncView.show(); batchSyncView.show();
// 一括同期処理
batchOperationSync(false); batchOperationSync(false);
} }
...@@ -2329,16 +2333,15 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2329,16 +2333,15 @@ public class OperationListActivity extends ABVUIActivity {
CommonExecutor.execute(new Runnable() { CommonExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
if (batchSyncView.empty()) { if (batchSyncView.isStackEmpty()) {
batchSyncView.closeProgressDialog(); batchSyncView.closeProgressDialog();
return; return;
} }
Stack<OperationDto> batchSyncStack = batchSyncView.getBatchSyncOperationStack();
if (!downloadedFlg) { if (!downloadedFlg) {
Logger.d(TAG, "batchOperation sync -- base file not downloaded"); Logger.d(TAG, "batchOperation sync -- base file not downloaded");
// ベースファイルのダウンロードチェック // ベースファイルのダウンロードチェック
OperationDto peekOperationDto = batchSyncStack.peek(); OperationDto peekOperationDto = batchSyncView.getOperationStackPeek();
ContentDto contentDto = contentDao.getContent(peekOperationDto.contentId); ContentDto contentDto = contentDao.getContent(peekOperationDto.contentId);
if (contentDto == null) { if (contentDto == null) {
Logger.e(TAG, "contentDto is null !"); Logger.e(TAG, "contentDto is null !");
...@@ -2353,7 +2356,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2353,7 +2356,7 @@ public class OperationListActivity extends ABVUIActivity {
} }
} }
final OperationDto operationDto = batchSyncStack.pop(); final OperationDto operationDto = batchSyncView.getOperationStackPop();
// TODO callback or return errorMsg どっちを使用すればいいか検討 // TODO callback or return errorMsg どっちを使用すればいいか検討
syncOperation(operationDto.operationId, operationDto.reportType, false, new Callback() { syncOperation(operationDto.operationId, operationDto.reportType, false, new Callback() {
@Override @Override
......
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