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.setCancelable(false);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
|
DocumentMeta documentMeta = new DocumentMeta("Untitled"); // TODO-rca: デフォルトタイトルを指定できるようにする
|
||||||
document.createDocument(documentMeta).thenAccept((documentDetail1) -> {
|
document.createDocument(documentMeta).thenAccept((documentDetail) -> {
|
||||||
Bitmap[] bitmaps = new Bitmap[this.croppedImages.size()];
|
Bitmap[] bitmaps = new Bitmap[croppedImages.size()];
|
||||||
this.croppedImages.toArray(bitmaps);
|
croppedImages.toArray(bitmaps);
|
||||||
addPagesToDocumentDetail(documentDetail1, bitmaps).join();
|
logger.debug(TAG, "bitmaps.length: " + bitmaps.length);
|
||||||
document.updateDocument(documentDetail1).join();
|
addPagesToDocumentDetail(documentDetail, bitmaps).join();
|
||||||
|
document.updateDocument(documentDetail).join();
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,7 @@ import dagger.hilt.android.AndroidEntryPoint;
|
||||||
import one.nem.lacerta.data.Document;
|
import one.nem.lacerta.data.Document;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
import one.nem.lacerta.model.document.page.Page;
|
import one.nem.lacerta.model.document.page.Page;
|
||||||
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
|
@ -33,6 +34,9 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
@Inject
|
@Inject
|
||||||
Document document;
|
Document document;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LacertaLogger logger;
|
||||||
|
|
||||||
private static final String TAG = "ComponentViewerTopFragment";
|
private static final String TAG = "ComponentViewerTopFragment";
|
||||||
|
|
||||||
private String documentId;
|
private String documentId;
|
||||||
|
@ -71,9 +75,11 @@ public class ComponentViewerTopFragment extends Fragment {
|
||||||
recyclerView.setAdapter(viewerBodyAdapter);
|
recyclerView.setAdapter(viewerBodyAdapter);
|
||||||
|
|
||||||
document.getDocument(documentId).thenAccept(documentDetail -> {
|
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(() -> {
|
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(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
|
FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());
|
||||||
try {
|
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) {
|
} catch (IOException e) {
|
||||||
logger.error(TAG, "DocumentMeta parse error");
|
logger.error(TAG, "DocumentMeta parse error");
|
||||||
logger.trace(TAG, e.getMessage());
|
logger.trace(TAG, e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user