From aa2ebce32c1a8fa89775e587a3eb7501545ddf4d Mon Sep 17 00:00:00 2001 From: r-ca Date: Wed, 24 Jan 2024 17:01:33 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D?= =?UTF-8?q?=E3=81=AE=E4=B8=80=E8=A6=A7=E3=81=8B=E3=82=89Page=E3=83=AA?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=82=92=E4=BD=9C=E6=88=90=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/Document.java | 3 ++ .../nem/lacerta/data/impl/DocumentImpl.java | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/Document.java b/data/src/main/java/one/nem/lacerta/data/Document.java index 70610913..3491fc7d 100644 --- a/data/src/main/java/one/nem/lacerta/data/Document.java +++ b/data/src/main/java/one/nem/lacerta/data/Document.java @@ -6,6 +6,7 @@ import java.util.concurrent.CompletableFuture; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.document.page.Page; import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.model.document.tag.DocumentTag; @@ -25,4 +26,6 @@ public interface Document { CompletableFuture updateDocument(DocumentDetail detail); CompletableFuture getDocument(String documentId); + + CompletableFuture> getDocumentPageListByFileNameList(String documentId, ArrayList fileNameList); } 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 7a303ec5..523c7277 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 @@ -173,6 +173,34 @@ public class DocumentImpl implements Document { }); } + @Override + public CompletableFuture> getDocumentPageListByFileNameList(String documentId, ArrayList fileNameList) { + return CompletableFuture.supplyAsync(() -> { + ArrayList pages = new ArrayList<>(); + FileManager fileManager; + try { + fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory()).resolve(documentId).resolve("raw"); + } catch (IOException e) { + logger.error(TAG, "FileManager resolve error"); + logger.trace(TAG, e.getMessage()); + logger.e_code("1210ae5b-dd2f-42ef-bc15-40b9a9bbdb16"); + return null; + } + + fileNameList.forEach(fileName -> { + try { + pages.add(new Page(fileName, fileManager.loadBitmap(fileName))); + } catch (IOException e) { + logger.error(TAG, "Bitmap decode error"); + logger.trace(TAG, e.getMessage()); + logger.e_code("6f9ba0dc-ac63-401c-8f50-a2bd9ff5cb91"); + } + }); + + return pages; + }); + } + private CompletableFuture> getPagesByXmlMeta(String documentId) { return CompletableFuture.supplyAsync(() -> { FileManager fileManager = fileManagerFactory.create(deviceInfoUtils.getExternalStorageDirectory());