From f0b4cc556e2d37a618bd750d05f00121ef0841d3 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 21 Jan 2024 18:45:51 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E3=81=AB=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=82=92=E5=8F=96=E5=BE=97=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/scanner/ScannerManagerActivity.java | 11 ++++++----- .../component/viewer/ComponentViewerTopFragment.java | 10 ++++++++-- .../java/one/nem/lacerta/data/impl/DocumentImpl.java | 8 +++++++- 3 files changed, 21 insertions(+), 8 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 02f935e2..bac0bd3c 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 @@ -161,11 +161,12 @@ public class ScannerManagerActivity extends AppCompatActivity { dialog.setCancelable(false); dialog.show(); DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする - document.createDocument(documentMeta).thenAccept((documentDetail1) -> { - Bitmap[] bitmaps = new Bitmap[this.croppedImages.size()]; - this.croppedImages.toArray(bitmaps); - addPagesToDocumentDetail(documentDetail1, bitmaps).join(); - document.updateDocument(documentDetail1).join(); + document.createDocument(documentMeta).thenAccept((documentDetail) -> { + Bitmap[] bitmaps = new Bitmap[croppedImages.size()]; + croppedImages.toArray(bitmaps); + logger.debug(TAG, "bitmaps.length: " + bitmaps.length); + addPagesToDocumentDetail(documentDetail, bitmaps).join(); + document.updateDocument(documentDetail).join(); dialog.dismiss(); finish(); }); diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index 509b2a34..89ba6954 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -21,6 +21,7 @@ import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.page.Page; +import one.nem.lacerta.utils.LacertaLogger; /** * A simple {@link Fragment} subclass. @@ -33,6 +34,9 @@ public class ComponentViewerTopFragment extends Fragment { @Inject Document document; + @Inject + LacertaLogger logger; + private static final String TAG = "ComponentViewerTopFragment"; private String documentId; @@ -71,9 +75,11 @@ public class ComponentViewerTopFragment extends Fragment { recyclerView.setAdapter(viewerBodyAdapter); document.getDocument(documentId).thenAccept(documentDetail -> { - viewerBodyAdapter.setPages(documentDetail.getPages()); + ArrayList pages = documentDetail.getPages(); + logger.debug(TAG, "pages.size(): " + pages.size()); + viewerBodyAdapter.setPages(pages); getActivity().runOnUiThread(() -> { - viewerBodyAdapter.notifyItemRangeChanged(0, documentDetail.getPages().size()); + viewerBodyAdapter.notifyItemRangeChanged(0, pages.size()); }); }); diff --git a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java index dca3b0e6..47f8e9a2 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java @@ -157,7 +157,13 @@ public class DocumentImpl implements Document { return CompletableFuture.supplyAsync(() -> { FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory()); try { - return xmlMetaParser.deserialize(fileManager.resolve(documentId).loadXml("meta.xml")).getPages(); + ArrayList xmlMetaPageModels = xmlMetaParser.deserialize(fileManager.resolve(documentId).loadXml("meta.xml")).getPages(); + // Debug + logger.debug(TAG, "xmlMetaPageModels: " + xmlMetaPageModels.size()); + for (XmlMetaPageModel xmlMetaPageModel : xmlMetaPageModels) { + logger.debug(TAG, "\txmlMetaPageModel: " + xmlMetaPageModel.getFilename()); + } + return xmlMetaPageModels; } catch (IOException e) { logger.error(TAG, "DocumentMeta parse error"); logger.trace(TAG, e.getMessage());