From b1886438e1368d49bba7055b1c22184f37e5af8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:26:32 +0900 Subject: [PATCH 01/29] =?UTF-8?q?=E7=B6=99=E6=89=BF,=20impl=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/data/impl/LacertaLibraryImpl.java | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java index b3e9c855..49f7303a 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java @@ -1,4 +1,42 @@ package one.nem.lacerta.data.impl; -public class LacertaLibraryImpl { +import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.document.DocumentDetail; + +public class LacertaLibraryImpl implements LacertaLibrary { + @Override + public LibraryItemPage getRecentDocument(int limit) { + return null; + } + + @Override + public LibraryItemPage getRecentDocument(int limit, int offset) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(int limit) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(int limit, int offset) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(String pageId, int limit) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) { + return null; + } + + @Override + public DocumentDetail getDocumentDetailById(String id) { + return null; + } } From 1036cbe5d95f7373938a86fa80dd0db5f7e833b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:27:04 +0900 Subject: [PATCH 02/29] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=96=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=82=B9=E4=BD=9C=E6=88=90,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java new file mode 100644 index 00000000..ca7c4d84 --- /dev/null +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -0,0 +1,4 @@ +package one.nem.lacerta.data.impl; + +public class LacertaLibraryStubImpl { +} From 01f0d74ab645b21cf8a0ecab978c05b86bad361c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:27:36 +0900 Subject: [PATCH 03/29] =?UTF-8?q?=E7=B6=99=E6=89=BF,=20Impl=E7=94=9F?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/impl/LacertaLibraryStubImpl.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index ca7c4d84..89fcf972 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -1,4 +1,41 @@ package one.nem.lacerta.data.impl; +import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.document.DocumentDetail; -public class LacertaLibraryStubImpl { +public class LacertaLibraryStubImpl implements LacertaLibrary { + @Override + public LibraryItemPage getRecentDocument(int limit) { + return null; + } + + @Override + public LibraryItemPage getRecentDocument(int limit, int offset) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(int limit) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(int limit, int offset) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(String pageId, int limit) { + return null; + } + + @Override + public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) { + return null; + } + + @Override + public DocumentDetail getDocumentDetailById(String id) { + return null; + } } From e8876cec733f92ba0ad7a70f9ffa4b961922e805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:32:33 +0900 Subject: [PATCH 04/29] =?UTF-8?q?JavaFaker=E3=82=92=E4=BE=9D=E5=AD=98?= =?UTF-8?q?=E9=96=A2=E4=BF=82=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/build.gradle b/data/build.gradle index 10a00015..4615289e 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -41,6 +41,9 @@ dependencies { // JGit implementation 'org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r' + // Java Faker + implementation 'com.github.javafaker:javafaker:1.0.2' + // Room implementation libs.androidx.room.runtime annotationProcessor libs.androidx.room.compiler From f9f07972ac56c338e2129572d24de7f4fc49a171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:40:32 +0900 Subject: [PATCH 05/29] =?UTF-8?q?ListItem=E3=81=ABSetter=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/model/ListItem.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/ListItem.java b/model/src/main/java/one/nem/lacerta/model/ListItem.java index 231438c8..00f5966a 100644 --- a/model/src/main/java/one/nem/lacerta/model/ListItem.java +++ b/model/src/main/java/one/nem/lacerta/model/ListItem.java @@ -38,4 +38,22 @@ public class ListItem { return itemId; } + // Setter + + public void setTitle(String title) { + this.title = title; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setItemType(ListItemType itemType) { + this.itemType = itemType; + } + + public void setItemId(String itemId) { + this.itemId = itemId; + } + } From a6ee0c12f474b1ef0cf3abda1adf4b6c6212958c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:41:13 +0900 Subject: [PATCH 06/29] =?UTF-8?q?ListItem=E3=81=AB=E7=A9=BA=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=82=B9=E3=83=88=E3=83=A9=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/src/main/java/one/nem/lacerta/model/ListItem.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/ListItem.java b/model/src/main/java/one/nem/lacerta/model/ListItem.java index 00f5966a..323b6bdd 100644 --- a/model/src/main/java/one/nem/lacerta/model/ListItem.java +++ b/model/src/main/java/one/nem/lacerta/model/ListItem.java @@ -20,6 +20,10 @@ public class ListItem { this.itemId = itemId; } + public ListItem() { + // Empty constructor + } + // Getter public String getTitle() { From db4da7812b5d81117062f07cdd3044fc85fa47d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:49:44 +0900 Subject: [PATCH 07/29] =?UTF-8?q?LibraryItemPage=E3=81=ABSetter=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/model/LibraryItemPage.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java b/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java index aed41a09..04962ce0 100644 --- a/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java +++ b/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java @@ -25,4 +25,17 @@ public class LibraryItemPage { public ArrayList getListItems() { return listItems; } + + public void setPageTitle(String pageTitle) { + this.pageTitle = pageTitle; + } + + public void setPageId(String pageId) { + this.pageId = pageId; + } + + public void setListItems(ArrayList listItems) { + this.listItems = listItems; + } + } From 7107b03de94ed4dcf25139a4597baef3025c3464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:50:19 +0900 Subject: [PATCH 08/29] =?UTF-8?q?=E7=A9=BA=E3=81=AE=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=A9=E3=82=AF=E3=82=BF=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0,=20=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/model/LibraryItemPage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java b/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java index 04962ce0..825c2396 100644 --- a/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java +++ b/model/src/main/java/one/nem/lacerta/model/LibraryItemPage.java @@ -8,12 +8,20 @@ public class LibraryItemPage { String pageId; ArrayList listItems; + // Constructor + public LibraryItemPage(String pageTitle, String pageId, ArrayList listItems) { this.pageTitle = pageTitle; this.pageId = pageId; this.listItems = listItems; } + public LibraryItemPage() { + // Empty constructor + } + + // Getter + public String getPageTitle() { return pageTitle; } @@ -26,6 +34,8 @@ public class LibraryItemPage { return listItems; } + // Setter + public void setPageTitle(String pageTitle) { this.pageTitle = pageTitle; } From bb36458c4dcee2d3b402ce8952805a7b1d069201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:54:28 +0900 Subject: [PATCH 09/29] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=96=E3=83=A1?= =?UTF-8?q?=E3=82=BD=E3=83=83=E3=83=89=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/impl/LacertaLibraryStubImpl.java | 98 ++++++++++++++++++- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 89fcf972..5adf85ad 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -1,9 +1,99 @@ package one.nem.lacerta.data.impl; + import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.ListItem; +import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.utils.LacertaLogger; + +import com.github.javafaker.Faker; + +import java.util.ArrayList; +import java.util.Objects; +import java.util.UUID; + +import javax.inject.Inject; + public class LacertaLibraryStubImpl implements LacertaLibrary { + + @Inject + LacertaLogger logger; + + Faker faker; + + public LacertaLibraryStubImpl() { + faker = new Faker(); // Init Faker + logger.debug("LibraryStub", "Initialized"); + } + + // Internal Methods + + // Generate Stub Data + private LibraryItemPage generateStubLibraryItemPage(int limit, String pageId) { + logger.debug("LibraryStub", "generateStubLibraryItemPage"); + ArrayList listItems = new ArrayList<>(); + int itemTotal = faker.number().numberBetween(1, limit); // 実際に返却するアイテム数を決定 + int folderTotal; + // フォルダ数の抽選 + if (itemTotal > 4) { + folderTotal = faker.number().numberBetween(1, itemTotal - 2); + } + else { + if (itemTotal > 2) { + folderTotal = 1; + } + else { // ドキュメント数がゼロにならないように + folderTotal = 0; + } + } + int documentTotal = itemTotal - folderTotal; // ドキュメント数を決定 + logger.debug("LibraryStub", "itemTotal: " + itemTotal); + logger.debug("LibraryStub", "folderTotal: " + folderTotal); + logger.debug("LibraryStub", "documentTotal: " + documentTotal); + + // フォルダを生成 + for (int i = 0; i < folderTotal; i++) { + listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_FOLDER)); + } + // ドキュメントを生成 + for (int i = 0; i < documentTotal; i++) { + listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT)); + } + + LibraryItemPage libraryItemPage = new LibraryItemPage(); + libraryItemPage.setListItems(listItems); + if (pageId == null) { + libraryItemPage.setPageId(UUID.randomUUID().toString()); + } else { + libraryItemPage.setPageId(pageId); + } + libraryItemPage.setPageTitle("FakePage" + faker.number().digits(3)); + + return libraryItemPage; + } + + private ListItem generateStubListItem(ListItemType itemType) { + if (itemType == ListItemType.ITEM_TYPE_FOLDER) { + ListItem listItem = new ListItem(); + listItem.setTitle("FakeFolder" + faker.number().digits(3)); + listItem.setDescription("Updated at " + faker.date().toString()); + listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); + listItem.setItemId(UUID.randomUUID().toString()); + return listItem; + } else if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) { + ListItem listItem = new ListItem(); + listItem.setTitle("FakeDocument" + faker.book().title()); + listItem.setDescription("Updated at " + faker.date().toString()); + listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); + listItem.setItemId(UUID.randomUUID().toString()); + return listItem; + } else { + return null; + } + } + @Override public LibraryItemPage getRecentDocument(int limit) { return null; @@ -16,22 +106,22 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { @Override public LibraryItemPage getLibraryPage(int limit) { - return null; + return generateStubLibraryItemPage(limit, null); } @Override public LibraryItemPage getLibraryPage(int limit, int offset) { - return null; + return generateStubLibraryItemPage(limit, null); } @Override public LibraryItemPage getLibraryPage(String pageId, int limit) { - return null; + return generateStubLibraryItemPage(limit, pageId); } @Override public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) { - return null; + return generateStubLibraryItemPage(limit, pageId); } @Override From c663d78e11dc8fdec07d5b2cad88a47b18644fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:59:16 +0900 Subject: [PATCH 10/29] =?UTF-8?q?=E5=B1=A5=E6=AD=B4=E3=82=92=E7=94=9F?= =?UTF-8?q?=E6=88=90=E3=81=99=E3=82=8B=E5=86=85=E9=83=A8=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/impl/LacertaLibraryStubImpl.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 5adf85ad..edda1b14 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -94,6 +94,25 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { } } + private LibraryItemPage getRecentDocumentPage(int limit) { + int itemTotal = faker.number().numberBetween(1, limit); + ArrayList listItems = new ArrayList<>(); + for (int i = 0; i < itemTotal; i++) { + listItems.add(generateStubListItem(ListItemType.ITEM_TYPE_DOCUMENT)); + } + // DescriptionからDateを抽出して新しい順にソート + listItems.sort((a, b) -> { + String aDate = a.getDescription().substring(11); + String bDate = b.getDescription().substring(11); + return bDate.compareTo(aDate); + }); + LibraryItemPage libraryItemPage = new LibraryItemPage(); + libraryItemPage.setListItems(listItems); + libraryItemPage.setPageId(UUID.randomUUID().toString()); + libraryItemPage.setPageTitle("RecentDocument"); + return libraryItemPage; + } + @Override public LibraryItemPage getRecentDocument(int limit) { return null; From 3cd1f50f34d7a35326de620fa2604fb94ebcac36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 10:59:39 +0900 Subject: [PATCH 11/29] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=96=E3=83=A1?= =?UTF-8?q?=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 --- .../one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index edda1b14..e8eff706 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -115,12 +115,12 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { @Override public LibraryItemPage getRecentDocument(int limit) { - return null; + return getRecentDocumentPage(limit); } @Override public LibraryItemPage getRecentDocument(int limit, int offset) { - return null; + return getRecentDocumentPage(limit); } @Override From d2ebed3934b2b830b6514d26f14e53537721cb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 11:02:50 +0900 Subject: [PATCH 12/29] =?UTF-8?q?DocumentDetail=E3=82=92=E7=94=9F=E6=88=90?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=86=85=E9=83=A8=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/impl/LacertaLibraryStubImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index e8eff706..b4f143a3 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -6,6 +6,8 @@ import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.document.DocumentMeta; +import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.utils.LacertaLogger; import com.github.javafaker.Faker; @@ -113,6 +115,21 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { return libraryItemPage; } + private DocumentDetail generateStubDocumentDetail() { + DocumentMeta documentMeta = new DocumentMeta(); + documentMeta.setId(UUID.randomUUID().toString()); + documentMeta.setTitle("FakeDocument" + faker.book().title()); + documentMeta.setCreatedAt(faker.date().birthday()); + documentMeta.setUpdatedAt(faker.date().birthday()); // TODO-rca: 更新日のほうが古くなることがあるのでなんとかする? + ArrayList tagIds = new ArrayList<>(); + + DocumentDetail documentDetail = new DocumentDetail(); + documentDetail.setMeta(documentMeta); + documentDetail.setPath(null); // TODO-rca: なんとかする + documentDetail.setAuthor(faker.name().fullName()); + documentDetail.setRepository(null); // TODO-rca: なんとかする + return documentDetail; + } @Override public LibraryItemPage getRecentDocument(int limit) { return getRecentDocumentPage(limit); From f326771aaf06c9a3392f381854a371213036d5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 11:03:14 +0900 Subject: [PATCH 13/29] =?UTF-8?q?id=E3=82=92=E6=AD=A3=E3=81=97=E3=81=8F?= =?UTF-8?q?=E8=BF=94=E3=81=99=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index b4f143a3..1223387d 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -115,9 +115,9 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { return libraryItemPage; } - private DocumentDetail generateStubDocumentDetail() { + private DocumentDetail generateStubDocumentDetail(String id) { DocumentMeta documentMeta = new DocumentMeta(); - documentMeta.setId(UUID.randomUUID().toString()); + documentMeta.setId(id); documentMeta.setTitle("FakeDocument" + faker.book().title()); documentMeta.setCreatedAt(faker.date().birthday()); documentMeta.setUpdatedAt(faker.date().birthday()); // TODO-rca: 更新日のほうが古くなることがあるのでなんとかする? From 527d3c309fbbbdec260a1a55020e41203c61a8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 11:04:18 +0900 Subject: [PATCH 14/29] =?UTF-8?q?getDocumentDetailById=E3=81=AE=E3=82=B9?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 1223387d..b8f2ed5c 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -115,7 +115,12 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { return libraryItemPage; } - private DocumentDetail generateStubDocumentDetail(String id) { + private DocumentDetail generateStubDocumentDetail(String id) throws IllegalArgumentException { + + if (Objects.isNull(id)) { + throw new IllegalArgumentException("id is null"); + } + DocumentMeta documentMeta = new DocumentMeta(); documentMeta.setId(id); documentMeta.setTitle("FakeDocument" + faker.book().title()); @@ -161,7 +166,7 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { } @Override - public DocumentDetail getDocumentDetailById(String id) { - return null; + public DocumentDetail getDocumentDetailById(String id) throws IllegalArgumentException { + return generateStubDocumentDetail(id); } } From 2f6bd995729b99b18050edc5367584f108fff5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:11:17 +0900 Subject: [PATCH 15/29] =?UTF-8?q?JavaDoc=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/impl/LacertaLibraryStubImpl.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index b8f2ed5c..5fda1a7a 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -18,6 +18,9 @@ import java.util.UUID; import javax.inject.Inject; +/** + * LacertaLibraryのスタブ実装 + */ public class LacertaLibraryStubImpl implements LacertaLibrary { @Inject @@ -135,36 +138,77 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { documentDetail.setRepository(null); // TODO-rca: なんとかする return documentDetail; } + + /** + * 履歴ページを取得する + * @param limit 取得するアイテム数 + * @return ページオブジェクト + */ @Override public LibraryItemPage getRecentDocument(int limit) { return getRecentDocumentPage(limit); } + /** + * 履歴ページを取得する + * @param limit 取得するアイテム数 + * @param offset 取得するアイテムのオフセット + * @return ページオブジェクト + */ @Override public LibraryItemPage getRecentDocument(int limit, int offset) { return getRecentDocumentPage(limit); } + /** + * ライブラリページを取得する + * @param limit 取得するアイテム数 + * @return ページオブジェクト + */ @Override public LibraryItemPage getLibraryPage(int limit) { return generateStubLibraryItemPage(limit, null); } + /** + * ライブラリページを取得する + * @param limit 取得するアイテム数 + * @param offset 取得するアイテムのオフセット + * @return ページオブジェクト + */ @Override public LibraryItemPage getLibraryPage(int limit, int offset) { return generateStubLibraryItemPage(limit, null); } + /** + * ライブラリページを取得する + * @param pageId ページID + * @param limit 取得するアイテム数 + * @return ページオブジェクト + */ @Override public LibraryItemPage getLibraryPage(String pageId, int limit) { return generateStubLibraryItemPage(limit, pageId); } + /** + * ライブラリページを取得する + * @param pageId ページID + * @param limit 取得するアイテム数 + * @param offset 取得するアイテムのオフセット + * @return ページオブジェクト + */ @Override public LibraryItemPage getLibraryPage(String pageId, int limit, int offset) { return generateStubLibraryItemPage(limit, pageId); } + /** + * ドキュメント詳細を取得する + * @param id ドキュメントID + * @return ドキュメント詳細オブジェクト + */ @Override public DocumentDetail getDocumentDetailById(String id) throws IllegalArgumentException { return generateStubDocumentDetail(id); From dc4879c900a10cef074860e5e33af55f0fe4e776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:14:01 +0900 Subject: [PATCH 16/29] =?UTF-8?q?HiltModule=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/module/LacertaLibraryModule.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java index 889a66ef..9c06ee85 100644 --- a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java +++ b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java @@ -1,4 +1,18 @@ package one.nem.lacerta.data.module; -public class LacertaLibraryModule { +import dagger.Binds; +import dagger.Module; +import dagger.hilt.InstallIn; +import dagger.hilt.migration.DisableInstallInCheck; + +import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.data.impl.LacertaLibraryStubImpl; + +@Module +@DisableInstallInCheck +abstract public class LacertaLibraryModule { + + @Binds + public abstract LacertaLibrary bindLacertaLibrary(LacertaLibraryStubImpl impl); + } From 283146a81fe9819e9a4ff8b2a25038da81d49eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:15:11 +0900 Subject: [PATCH 17/29] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E7=94=A8=E3=83=95=E3=83=A9=E3=82=B0=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DebugMenuLibraryItemListPageFragment.java | 64 +++++++++++++++++++ ...ment_debug_menu_library_item_list_page.xml | 14 ++++ 2 files changed, 78 insertions(+) create mode 100644 feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java create mode 100644 feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java new file mode 100644 index 00000000..518e1e84 --- /dev/null +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -0,0 +1,64 @@ +package one.nem.lacerta.feature.debug; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link DebugMenuLibraryItemListPageFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class DebugMenuLibraryItemListPageFragment extends Fragment { + + // TODO: Rename parameter arguments, choose names that match + // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER + private static final String ARG_PARAM1 = "param1"; + private static final String ARG_PARAM2 = "param2"; + + // TODO: Rename and change types of parameters + private String mParam1; + private String mParam2; + + public DebugMenuLibraryItemListPageFragment() { + // Required empty public constructor + } + + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment DebugMenuLibraryItemListPageFragment. + */ + // TODO: Rename and change types and number of parameters + public static DebugMenuLibraryItemListPageFragment newInstance(String param1, String param2) { + DebugMenuLibraryItemListPageFragment fragment = new DebugMenuLibraryItemListPageFragment(); + Bundle args = new Bundle(); + args.putString(ARG_PARAM1, param1); + args.putString(ARG_PARAM2, param2); + fragment.setArguments(args); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (getArguments() != null) { + mParam1 = getArguments().getString(ARG_PARAM1); + mParam2 = getArguments().getString(ARG_PARAM2); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); + } +} \ No newline at end of file diff --git a/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml new file mode 100644 index 00000000..b4b6f6a5 --- /dev/null +++ b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file From d77cedc68fa814b06c27a4e634e606c82c9c98a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:15:45 +0900 Subject: [PATCH 18/29] =?UTF-8?q?=E5=BC=95=E6=95=B0=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DebugMenuLibraryItemListPageFragment.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java index 518e1e84..15980535 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -15,33 +15,13 @@ import android.view.ViewGroup; */ public class DebugMenuLibraryItemListPageFragment extends Fragment { - // TODO: Rename parameter arguments, choose names that match - // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER - private static final String ARG_PARAM1 = "param1"; - private static final String ARG_PARAM2 = "param2"; - - // TODO: Rename and change types of parameters - private String mParam1; - private String mParam2; - public DebugMenuLibraryItemListPageFragment() { // Required empty public constructor } - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param param1 Parameter 1. - * @param param2 Parameter 2. - * @return A new instance of fragment DebugMenuLibraryItemListPageFragment. - */ - // TODO: Rename and change types and number of parameters - public static DebugMenuLibraryItemListPageFragment newInstance(String param1, String param2) { + public static DebugMenuLibraryItemListPageFragment newInstance() { DebugMenuLibraryItemListPageFragment fragment = new DebugMenuLibraryItemListPageFragment(); Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @@ -49,10 +29,6 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } } @Override From 81ceaaf0d6fa6ff6857ae352ed6b69d40c2a1c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:16:11 +0900 Subject: [PATCH 19/29] init --- .../feature/debug/DebugMenuLibraryItemListPageFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java index 15980535..26d07e91 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -35,6 +35,9 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment - return inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); + View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); + + + return view; } } \ No newline at end of file From 993f34e1fe7201735db20c0039c7e03a3ee97b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:18:11 +0900 Subject: [PATCH 20/29] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ment_debug_menu_library_item_list_page.xml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml index b4b6f6a5..ad30054f 100644 --- a/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml +++ b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml @@ -1,14 +1,17 @@ - - - - - \ No newline at end of file + + \ No newline at end of file From 8cd49804ca0688ea5084822791374881b48320d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:19:12 +0900 Subject: [PATCH 21/29] =?UTF-8?q?=E5=91=BD=E5=90=8D=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/fragment_debug_menu_library_item_list_page.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml index ad30054f..0e184902 100644 --- a/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml +++ b/feature/debug/src/main/res/layout/fragment_debug_menu_library_item_list_page.xml @@ -7,7 +7,7 @@ tools:context=".DebugMenuLibraryItemListPageFragment"> Date: Fri, 12 Jan 2024 12:24:30 +0900 Subject: [PATCH 22/29] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DebugMenuLibraryItemListPageFragment.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java index 26d07e91..c58cacf1 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -2,19 +2,38 @@ package one.nem.lacerta.feature.debug; import android.os.Bundle; +import androidx.annotation.AnimatorRes; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; + +import java.util.ArrayList; + +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.LacertaLibrary; + +import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.document.DocumentDetail; +import one.nem.lacerta.model.ListItem; +import one.nem.lacerta.model.ListItemType; /** * A simple {@link Fragment} subclass. * Use the {@link DebugMenuLibraryItemListPageFragment#newInstance} factory method to * create an instance of this fragment. */ +@AndroidEntryPoint public class DebugMenuLibraryItemListPageFragment extends Fragment { + @Inject + LacertaLibrary lacertaLibrary; + public DebugMenuLibraryItemListPageFragment() { // Required empty public constructor } @@ -37,7 +56,61 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); + LibraryItemPage libraryItemPage = lacertaLibrary.getLibraryPage(10); + for (ListItem listItem : libraryItemPage.getListItems()) { + System.out.println(listItem.getTitle()); + } + + RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view); + + ArrayList listItems = libraryItemPage.getListItems(); + + ItemAdapter itemAdapter = new ItemAdapter(listItems); + recyclerView.setAdapter(itemAdapter); return view; } + + private class ItemAdapter extends RecyclerView.Adapter { + private ArrayList listItems; + + public ItemAdapter(ArrayList listItems) { + this.listItems = listItems; + } + + @Override + public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_debug_menu_document, parent, false); + return new ItemViewHolder(view); + } + + @Override + public void onBindViewHolder(ItemViewHolder holder, int position) { + ListItem listItem = listItems.get(position); + holder.document_list_item_title.setText(listItem.getTitle()); + holder.document_list_item_description.setText(listItem.getDescription()); + holder.document_list_item_updated_at.setText(listItem.getItemType().toString()); + } + + @Override + public int getItemCount() { + return listItems.size(); + } + + public class ItemViewHolder extends RecyclerView.ViewHolder { + + TextView document_list_item_title; + TextView document_list_item_description; + TextView document_list_item_updated_at; + + + public ItemViewHolder(View itemView) { + super(itemView); + document_list_item_title = itemView.findViewById(R.id.document_list_item_title); + document_list_item_description = itemView.findViewById(R.id.document_list_item_description); + document_list_item_updated_at = itemView.findViewById(R.id.document_list_item_updated_at); + } + } + } + } \ No newline at end of file From 5bd84e730f7a8a90488a6d238f37b881ce845d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:25:01 +0900 Subject: [PATCH 23/29] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=83=A9=E3=82=AF=E3=82=BF=E3=81=AE=E3=82=A2=E3=83=8E=E3=83=86?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E5=BF=98=E3=82=8C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 5fda1a7a..4759553d 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -28,6 +28,7 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { Faker faker; + @Inject public LacertaLibraryStubImpl() { faker = new Faker(); // Init Faker logger.debug("LibraryStub", "Initialized"); From c346170a9da83a5ca86fe4d826c5d92cafd68bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:27:51 +0900 Subject: [PATCH 24/29] =?UTF-8?q?HiltModule=E3=81=AE=E3=82=A2=E3=83=8E?= =?UTF-8?q?=E3=83=86=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/module/LacertaLibraryModule.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java index 9c06ee85..ca7b7182 100644 --- a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java +++ b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java @@ -3,13 +3,15 @@ package one.nem.lacerta.data.module; import dagger.Binds; import dagger.Module; import dagger.hilt.InstallIn; +import dagger.hilt.android.components.FragmentComponent; import dagger.hilt.migration.DisableInstallInCheck; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.impl.LacertaLibraryStubImpl; @Module -@DisableInstallInCheck +// Fragmentにinstall +@InstallIn(FragmentComponent.class) abstract public class LacertaLibraryModule { @Binds From 8ee554d445ba80f4dc201bb3fdcecb75455d85e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:28:31 +0900 Subject: [PATCH 25/29] =?UTF-8?q?=E3=83=8A=E3=83=93=E3=82=B2=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=B0=E3=83=A9=E3=83=95=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/navigation/feature_debug_internal_navigation.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml b/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml index b2fa3af7..26855e38 100644 --- a/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml +++ b/feature/debug/src/main/res/navigation/feature_debug_internal_navigation.xml @@ -16,6 +16,9 @@ + + \ No newline at end of file From a754198d75eef220f84bed80ba4e52019cca3272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:38:56 +0900 Subject: [PATCH 26/29] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 4 ++-- .../one/nem/lacerta/data/module/LacertaLibraryModule.java | 1 + .../one/nem/lacerta/feature/debug/DebugMenuTopFragment.java | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 4759553d..4fb47e3e 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -23,14 +23,14 @@ import javax.inject.Inject; */ public class LacertaLibraryStubImpl implements LacertaLibrary { - @Inject LacertaLogger logger; Faker faker; @Inject - public LacertaLibraryStubImpl() { + public LacertaLibraryStubImpl(LacertaLogger logger) { faker = new Faker(); // Init Faker + this.logger = logger; logger.debug("LibraryStub", "Initialized"); } diff --git a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java index ca7b7182..6c98e653 100644 --- a/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java +++ b/data/src/main/java/one/nem/lacerta/data/module/LacertaLibraryModule.java @@ -8,6 +8,7 @@ import dagger.hilt.migration.DisableInstallInCheck; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.data.impl.LacertaLibraryStubImpl; +import one.nem.lacerta.utils.LacertaLogger; @Module // Fragmentにinstall diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java index 1d00694e..331ce00c 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuTopFragment.java @@ -50,6 +50,7 @@ public class DebugMenuTopFragment extends Fragment { debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true)); debugMenuListItems.add(new DebugMenuListItem("Scanner", "placeholder", R.id.action_debugMenuTopFragment_to_scannerDataManagerStubFragment, true)); + debugMenuListItems.add(new DebugMenuListItem("Document List", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuLibraryItemListPageFragment, true)); DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems); recyclerView.setAdapter(adapter); From 3f58c623f3fff3cf4cd3e686fdc07367a4af15e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:40:46 +0900 Subject: [PATCH 27/29] =?UTF-8?q?LayoutManager=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../debug/DebugMenuLibraryItemListPageFragment.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java index c58cacf1..9a37e795 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -4,6 +4,7 @@ import android.os.Bundle; import androidx.annotation.AnimatorRes; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; @@ -62,11 +63,9 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment { } RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view); + recyclerView.setAdapter(new ItemAdapter(libraryItemPage.getListItems())); - ArrayList listItems = libraryItemPage.getListItems(); - - ItemAdapter itemAdapter = new ItemAdapter(listItems); - recyclerView.setAdapter(itemAdapter); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); return view; } From af4513212d358915ae5b8fa90c32adfd93b3a8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:43:01 +0900 Subject: [PATCH 28/29] =?UTF-8?q?=E9=81=A9=E5=BD=93=E3=81=AA=E6=97=A5?= =?UTF-8?q?=E4=BB=98=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java index 4fb47e3e..55129bba 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryStubImpl.java @@ -10,8 +10,10 @@ import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.path.DocumentPath; import one.nem.lacerta.utils.LacertaLogger; +import com.github.javafaker.DateAndTime; import com.github.javafaker.Faker; +import java.text.DateFormat; import java.util.ArrayList; import java.util.Objects; import java.util.UUID; @@ -84,14 +86,14 @@ public class LacertaLibraryStubImpl implements LacertaLibrary { if (itemType == ListItemType.ITEM_TYPE_FOLDER) { ListItem listItem = new ListItem(); listItem.setTitle("FakeFolder" + faker.number().digits(3)); - listItem.setDescription("Updated at " + faker.date().toString()); + listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday())); listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); listItem.setItemId(UUID.randomUUID().toString()); return listItem; } else if (itemType == ListItemType.ITEM_TYPE_DOCUMENT) { ListItem listItem = new ListItem(); listItem.setTitle("FakeDocument" + faker.book().title()); - listItem.setDescription("Updated at " + faker.date().toString()); + listItem.setDescription("Updated at " + DateFormat.getDateTimeInstance().format(faker.date().birthday())); listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); listItem.setItemId(UUID.randomUUID().toString()); return listItem; From 37af356c920827cb0e98b7a99f1ecdb72d614618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jan 2024 12:47:14 +0900 Subject: [PATCH 29/29] Debug --- .../feature/debug/DebugMenuLibraryItemListPageFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java index 9a37e795..a6be2bb4 100644 --- a/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java +++ b/feature/debug/src/main/java/one/nem/lacerta/feature/debug/DebugMenuLibraryItemListPageFragment.java @@ -57,7 +57,7 @@ public class DebugMenuLibraryItemListPageFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_debug_menu_library_item_list_page, container, false); - LibraryItemPage libraryItemPage = lacertaLibrary.getLibraryPage(10); + LibraryItemPage libraryItemPage = lacertaLibrary.getRecentDocument(10); for (ListItem listItem : libraryItemPage.getListItems()) { System.out.println(listItem.getTitle()); }