いろいろ

This commit is contained in:
r-ca 2024-01-29 07:10:51 +09:00
parent 282c09bbd1
commit 26b76fa3e0
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9
2 changed files with 25 additions and 5 deletions

View File

@ -237,7 +237,7 @@ public class ScannerManagerActivity extends AppCompatActivity {
Bitmap[] bitmaps = new Bitmap[croppedImages.size()]; Bitmap[] bitmaps = new Bitmap[croppedImages.size()];
croppedImages.toArray(bitmaps); croppedImages.toArray(bitmaps);
logger.debug(TAG, "bitmaps.length: " + bitmaps.length); logger.debug(TAG, "bitmaps.length: " + bitmaps.length);
addPagesToDocumentDetail(documentDetail, bitmaps, null).join(); addPagesToDocumentDetail(documentDetail, bitmaps, "Initial Commit").join();
document.updateDocument(documentDetail).join(); document.updateDocument(documentDetail).join();
dialog.dismiss(); dialog.dismiss();
finish(); finish();
@ -249,7 +249,7 @@ public class ScannerManagerActivity extends AppCompatActivity {
return CompletableFuture.runAsync(() -> { return CompletableFuture.runAsync(() -> {
try { try {
document.updateDocument(documentProcessorFactory.create(documentDetail).addNewPagesToLast(bitmaps).getDocumentDetail()).join(); 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) { } catch (Exception e) {
logger.error(TAG, "Error: " + e.getMessage()); logger.error(TAG, "Error: " + e.getMessage());
logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a"); logger.e_code("9dff2a28-20e8-4ccd-9d04-f0c7646faa6a");
@ -278,9 +278,8 @@ public class ScannerManagerActivity extends AppCompatActivity {
return; return;
} }
documentProcessor.updatePageAtIndex(croppedImages.get(0), index); documentProcessor.updatePageAtIndex(croppedImages.get(0), index);
logger.debug(TAG, "documentProcessor.getPageCount(): " + documentProcessor.getPageCount()
+ ", documentDetail.getPages().size(): " + documentDetail.getPages().size());
document.updateDocument(documentProcessor.getDocumentDetail()).join(); document.updateDocument(documentProcessor.getDocumentDetail()).join();
lacertaVcsFactory.create(documentDetail.getMeta().getId()).generateRevisionAtCurrent(index + "ページ目を更新"); // TODO-rca: メッセージを動的にする, 指定できるようにする
dialog.dismiss(); dialog.dismiss();
}); });
} }

View File

@ -27,6 +27,8 @@ import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint; import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.component.common.LacertaApplyTagDialog; 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.component.common.picker.LacertaFilePickerDialog;
import one.nem.lacerta.data.Document; import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.LacertaLibrary;
@ -236,7 +238,7 @@ public class ViewerContainerFragment extends Fragment {
toolbar.inflateMenu(R.menu.viewer_menu); toolbar.inflateMenu(R.menu.viewer_menu);
toolbar.setOnMenuItemClickListener(item -> { toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.action_open_vcs_rev_list) { if (item.getItemId() == R.id.action_open_vcs_rev_list) {
Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); showRevList();
return true; return true;
} else if (item.getItemId() == R.id.action_rename) { } else if (item.getItemId() == R.id.action_rename) {
renameDocument(); 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() { private void applyTag() {
LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog(); LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog();
lacertaApplyTagDialog lacertaApplyTagDialog