Commit 3e2de8d8 by Lee Jaebin

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

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