From 26b76fa3e099e1631a1eafa955788a18e4d35562 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 07:10:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=84=E3=82=8D=E3=81=84=E3=82=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scanner/ScannerManagerActivity.java | 7 +++--- .../viewer/ViewerContainerFragment.java | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java index 1a371c1b..50713ced 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java @@ -237,7 +237,7 @@ public class ScannerManagerActivity extends AppCompatActivity { Bitmap[] bitmaps = new Bitmap[croppedImages.size()]; croppedImages.toArray(bitmaps); logger.debug(TAG, "bitmaps.length: " + bitmaps.length); - addPagesToDocumentDetail(documentDetail, bitmaps, null).join(); + addPagesToDocumentDetail(documentDetail, bitmaps, "Initial Commit").join(); document.updateDocument(documentDetail).join(); dialog.dismiss(); finish(); @@ -249,7 +249,7 @@ public class ScannerManagerActivity extends AppCompatActivity { return CompletableFuture.runAsync(() -> { try { document.updateDocument(documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps).getDocumentDetail()).join(); - lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent(commitMessage == null ? "Update" : commitMessage); + lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent(commitMessage == null ? "NONE" : commitMessage); } catch (Exception e) { logger.error(TAG, "Error: " + e.getMessage()); logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a"); @@ -278,9 +278,8 @@ public class ScannerManagerActivity extends AppCompatActivity { return; } documentProcessor.updatePageAtIndex(croppedImages.get(0), index); - logger.debug(TAG, "documentProcessor.getPageCount(): " + documentProcessor.getPageCount() - + ", documentDetail.getPages().size(): " + documentDetail.getPages().size()); document.updateDocument(documentProcessor.getDocumentDetail()).join(); + lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent(index + "ページ目を更新"); // TODO-rca: メッセージを動的にする, 指定できるようにする dialog.dismiss(); }); } diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 98ff5f4b..6ccd0b7c 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -27,6 +27,8 @@ import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.common.LacertaApplyTagDialog; +import one.nem.lacerta.component.common.LacertaSelectRevDialog; +import one.nem.lacerta.component.common.LacertaSelectRevDialogListener; import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; @@ -236,7 +238,7 @@ public class ViewerContainerFragment extends Fragment { toolbar.inflateMenu(R.menu.viewer_menu); toolbar.setOnMenuItemClickListener(item -> { if (item.getItemId() == R.id.action_open_vcs_rev_list) { - Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + showRevList(); return true; } else if (item.getItemId() == R.id.action_rename) { renameDocument(); @@ -260,6 +262,25 @@ public class ViewerContainerFragment extends Fragment { }); } + private void showRevList() { + LacertaSelectRevDialog lacertaSelectRevDialog = new LacertaSelectRevDialog(); + lacertaSelectRevDialog.setDocumentId(this.documentId).setTitle("リビジョンの選択").setMessage("リビジョンを選択してください。").setNegativeButtonText("キャンセル"); + lacertaSelectRevDialog.setListener(new LacertaSelectRevDialogListener() { + @Override + public void onItemSelected(String revId) { + logger.debug("ViewerContainerFragment", "Dialog Result: revId: " + revId); + getParentFragmentManager().beginTransaction() + .replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName, revId)) + .commit(); + } + + @Override + public void onDialogCanceled() { + } + }); + lacertaSelectRevDialog.show(getParentFragmentManager(), "select_rev_dialog"); + } + private void applyTag() { LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog(); lacertaApplyTagDialog