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());