mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
正常に画像を取得できるように
This commit is contained in:
parent
8c71dedd85
commit
f0b4cc556e
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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<Page> 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());
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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<XmlMetaPageModel> 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());
|
||||
|
|
Loading…
Reference in New Issue
Block a user