mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2026-11-08 03:47:36 +00:00
更新機能 WIP
This commit is contained in:
2 files changed
+35
-7
No files matched your search
+27
-6
@@ -35,6 +35,8 @@ import one.nem.lacerta.data.Document;
|
||||
import one.nem.lacerta.data.LacertaLibrary;
|
||||
import one.nem.lacerta.model.document.DocumentDetail;
|
||||
import one.nem.lacerta.model.document.DocumentMeta;
|
||||
import one.nem.lacerta.model.document.page.Page;
|
||||
import one.nem.lacerta.processor.DocumentProcessor;
|
||||
import one.nem.lacerta.processor.factory.DocumentProcessorFactory;
|
||||
import one.nem.lacerta.utils.LacertaLogger;
|
||||
import one.nem.lacerta.vcs.factory.LacertaVcsFactory;
|
||||
@@ -73,7 +75,9 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||
// Variables
|
||||
private ArrayList<Bitmap> croppedImages = new ArrayList<>();
|
||||
|
||||
private boolean single = false;
|
||||
private boolean update = false;
|
||||
private String documentId;
|
||||
private int index = 0;
|
||||
|
||||
View view;
|
||||
|
||||
@@ -104,7 +108,7 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||
null
|
||||
);
|
||||
|
||||
DocumentScanner documentScannerSingle = new DocumentScanner( // TODO-rca: ひどすぎるのでなんとかする
|
||||
DocumentScanner documentScannerUpdate = new DocumentScanner( // TODO-rca: ひどすぎるのでなんとかする
|
||||
this,
|
||||
(croppedImageResults) -> {
|
||||
logger.debug(TAG, "croppedImage size: " + croppedImageResults.size());
|
||||
@@ -160,11 +164,12 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||
Intent intent = getIntent();
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle != null) {
|
||||
this.single = bundle.getBoolean("single", false);
|
||||
update = bundle.getBoolean("update", false);
|
||||
documentId = bundle.getString("documentId");
|
||||
index = bundle.getInt("index", 0);
|
||||
}
|
||||
|
||||
if (this.single) {
|
||||
documentScanner = documentScannerSingle;
|
||||
if (this.update) {
|
||||
documentScanner = documentScannerUpdate;
|
||||
}
|
||||
documentScanner.startScan();
|
||||
// Init
|
||||
@@ -251,6 +256,22 @@ public class ScannerManagerActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePage() {
|
||||
logger.debug(TAG, "updatePage");
|
||||
// Deprecatedだが、中断機能が存在しないので操作をブロックする目的で(意図的に)使用
|
||||
ProgressDialog dialog = new ProgressDialog(this);
|
||||
dialog.setMessage("保存中..."); // TODO-rca: テキストをリソースに移動
|
||||
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
dialog.setCancelable(false);
|
||||
dialog.show();
|
||||
document.getDocument(documentId).thenAccept((documentDetail) -> {
|
||||
DocumentProcessor documentProcessor = documentProcessorFactory.create(documentDetail);
|
||||
documentProcessor.updatePageAtIndex(croppedImages.get(0), index);
|
||||
document.updateDocument(documentProcessor.getDocumentDetail()).join();
|
||||
dialog.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
private void insertToExistDocument() {
|
||||
logger.debug(TAG, "insertToExistDocument");
|
||||
LacertaFilePickerDialog dialog = new LacertaFilePickerDialog();
|
||||
|
||||
Reference in new issue
Block a user