From 055f1fdae1d902ca6156f3c989174bfedc88eb3f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 16:54:19 +0900 Subject: [PATCH 01/69] =?UTF-8?q?DocumentEntity=E3=81=ABisCombined?= =?UTF-8?q?=E3=83=95=E3=83=A9=E3=82=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/source/database/entity/DocumentEntity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java index 1e7891e9..edd7a2d1 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java @@ -36,4 +36,7 @@ public class DocumentEntity { @ColumnInfo(name = "parent_id") public String parentId; // 親フォルダID + + @ColumnInfo(name = "is_combined") + public boolean isCombined; // 結合されたドキュメントかどうか } From 74563f75b1eae33bf95645430cecbf4dce2c8868 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:03:25 +0900 Subject: [PATCH 02/69] =?UTF-8?q?CombineDocumentEntity=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/CombineDocumentEntity.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java new file mode 100644 index 00000000..e1b0234d --- /dev/null +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java @@ -0,0 +1,30 @@ +package one.nem.lacerta.source.database.entity; + +import androidx.annotation.NonNull; +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.PrimaryKey; + +@Entity(tableName = "combine_document") +public class CombineDocumentEntity { + + @PrimaryKey + @ColumnInfo(name = "id") + @NonNull + public String id; // ドキュメントID + + @ColumnInfo(name = "title") + public String title; // タイトル + + @ColumnInfo(name = "created_at") + public String createdAt; // 作成日時 + + @ColumnInfo(name = "updated_at") + public String updatedAt; // 更新日時 + + @ColumnInfo(name = "author") + public String author; // 作成者 + + @ColumnInfo(name = "parent_id") + public String parentId; // 親フォルダID +} From a187ef3523025264555adafd0965eb00f2f578ab Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:03:46 +0900 Subject: [PATCH 03/69] =?UTF-8?q?Revert=20"CombineDocumentEntity=E4=BD=9C?= =?UTF-8?q?=E6=88=90"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 74563f75b1eae33bf95645430cecbf4dce2c8868. --- .../entity/CombineDocumentEntity.java | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java deleted file mode 100644 index e1b0234d..00000000 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/CombineDocumentEntity.java +++ /dev/null @@ -1,30 +0,0 @@ -package one.nem.lacerta.source.database.entity; - -import androidx.annotation.NonNull; -import androidx.room.ColumnInfo; -import androidx.room.Entity; -import androidx.room.PrimaryKey; - -@Entity(tableName = "combine_document") -public class CombineDocumentEntity { - - @PrimaryKey - @ColumnInfo(name = "id") - @NonNull - public String id; // ドキュメントID - - @ColumnInfo(name = "title") - public String title; // タイトル - - @ColumnInfo(name = "created_at") - public String createdAt; // 作成日時 - - @ColumnInfo(name = "updated_at") - public String updatedAt; // 更新日時 - - @ColumnInfo(name = "author") - public String author; // 作成者 - - @ColumnInfo(name = "parent_id") - public String parentId; // 親フォルダID -} From 217b152c475f186db6b02046ea73541e7d76a415 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:04:50 +0900 Subject: [PATCH 04/69] =?UTF-8?q?=E5=AD=90/=E8=A6=AA=E3=82=92DocumentEntit?= =?UTF-8?q?y=E5=8D=98=E4=BD=93=E3=81=A7=E7=AE=A1=E7=90=86=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/source/database/entity/DocumentEntity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java index edd7a2d1..88c77281 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/DocumentEntity.java @@ -37,6 +37,9 @@ public class DocumentEntity { @ColumnInfo(name = "parent_id") public String parentId; // 親フォルダID - @ColumnInfo(name = "is_combined") - public boolean isCombined; // 結合されたドキュメントかどうか + @ColumnInfo(name = "is_combine_child") + public boolean isCombineChild; // 結合されたドキュメントの子かどうか + + @ColumnInfo(name = "is_combine_parent") + public boolean isCombineParent; // 結合されたドキュメントの親かどうか } From e1f2a43d0bf2934cbfe35f83c62854d9cf32ca38 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:06:24 +0900 Subject: [PATCH 05/69] =?UTF-8?q?Toxi=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/entity/ToxiDocumentEntity.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java new file mode 100644 index 00000000..08c24b31 --- /dev/null +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java @@ -0,0 +1,20 @@ +package one.nem.lacerta.source.database.entity; + +import androidx.room.ColumnInfo; +import androidx.room.Entity; + +@Entity(tableName = "toxi_document") +public class ToxiDocumentEntity { + + @ColumnInfo(name = "parent_document_id") + public String parentDocumentId; + + @ColumnInfo(name = "child_document_id") + public String childDocumentId; + + @ColumnInfo(name = "order") + public int order; + + @ColumnInfo(name = "is_active") + public boolean isActive; +} From c43b5163201a87ea120f371d19f42594bcc6e087 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:07:05 +0900 Subject: [PATCH 06/69] =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=82=92LacertaDB=E3=81=AB=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/source/database/LacertaDatabase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java index bb9a5dd9..ba48a888 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java +++ b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java @@ -10,6 +10,7 @@ import one.nem.lacerta.source.database.entity.FolderEntity; import one.nem.lacerta.source.database.entity.TagEntity; import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.LibraryEntity; +import one.nem.lacerta.source.database.entity.ToxiDocumentEntity; import one.nem.lacerta.source.database.entity.ToxiDocumentTagEntity; import one.nem.lacerta.source.database.entity.VcsRevEntity; import one.nem.lacerta.source.database.entity.VcsLogEntity; @@ -21,7 +22,7 @@ import one.nem.lacerta.source.database.dao.LibraryDao; import one.nem.lacerta.source.database.dao.VcsRevDao; import one.nem.lacerta.source.database.dao.VcsLogDao; -@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class, FolderEntity.class, ToxiDocumentTagEntity.class}, version = 6) +@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class, FolderEntity.class, ToxiDocumentTagEntity.class, ToxiDocumentEntity.class}, version = 7) public abstract class LacertaDatabase extends RoomDatabase { public abstract TagDao tagDao(); public abstract DocumentDao documentDao(); From e43c3beda0c3b9e388b52e9ee94f210529f883e4 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:08:04 +0900 Subject: [PATCH 07/69] =?UTF-8?q?Toxi=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E3=81=AEDao=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/source/database/LacertaDatabase.java | 2 ++ .../nem/lacerta/source/database/dao/ToxiDocumentDao.java | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java diff --git a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java index ba48a888..ad89a8f0 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java +++ b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java @@ -5,6 +5,7 @@ import androidx.room.RoomDatabase; // Entities import one.nem.lacerta.source.database.dao.FolderDao; +import one.nem.lacerta.source.database.dao.ToxiDocumentDao; import one.nem.lacerta.source.database.dao.ToxiDocumentTagDao; import one.nem.lacerta.source.database.entity.FolderEntity; import one.nem.lacerta.source.database.entity.TagEntity; @@ -27,6 +28,7 @@ public abstract class LacertaDatabase extends RoomDatabase { public abstract TagDao tagDao(); public abstract DocumentDao documentDao(); public abstract ToxiDocumentTagDao toxiDocumentTagDao(); + public abstract ToxiDocumentDao toxiDocumentDao(); public abstract LibraryDao libraryDao(); public abstract VcsRevDao vcsRevDao(); public abstract VcsLogDao vcsLogDao(); diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java new file mode 100644 index 00000000..ace23c69 --- /dev/null +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java @@ -0,0 +1,7 @@ +package one.nem.lacerta.source.database.dao; + +import androidx.room.Dao; + +@Dao +public interface ToxiDocumentDao { +} From 4ffcd970b42876ecc5c048830b08bcd50971759b Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:09:52 +0900 Subject: [PATCH 08/69] =?UTF-8?q?Toxi=E3=83=86=E3=83=BC=E3=83=96=E3=83=ABD?= =?UTF-8?q?ao=E5=AE=9F=E8=A3=85WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/database/dao/ToxiDocumentDao.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java index ace23c69..201a5d37 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/ToxiDocumentDao.java @@ -1,7 +1,35 @@ package one.nem.lacerta.source.database.dao; import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; + +import java.util.List; + +import one.nem.lacerta.source.database.entity.ToxiDocumentEntity; @Dao public interface ToxiDocumentDao { + + @Query("SELECT * FROM toxi_document WHERE parent_document_id = :parentId AND is_active = 1 ORDER BY `order` ASC") + List findByParentId(String parentId); + + @Insert + void insert(ToxiDocumentEntity toxiDocument); + + @Insert + void insertAll(ToxiDocumentEntity... toxiDocuments); + + @Update + void update(ToxiDocumentEntity toxiDocument); + + @Update + void updateAll(ToxiDocumentEntity... toxiDocuments); + + @Query("DELETE FROM toxi_document WHERE parent_document_id = :parentId") + void deleteByParentId(String parentId); + + @Query("DELETE FROM toxi_document WHERE parent_document_id = :parentId AND child_document_id = :childId") + void deleteByParentIdAndChildId(String parentId, String childId); } From 98b141f96f381fbfb4f5b0382b71c27c0282c12f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:13:51 +0900 Subject: [PATCH 09/69] =?UTF-8?q?DocumentDao=E3=81=AESelect=E3=82=AF?= =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=82=92=E4=BF=AE=E6=AD=A3(Combine=E3=81=AEC?= =?UTF-8?q?hild=E3=82=92=E5=90=AB=E3=82=81=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/source/database/dao/DocumentDao.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java index 21e1cc2e..7b410ba4 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java @@ -29,13 +29,13 @@ public interface DocumentDao { @Query("SELECT * FROM Document WHERE id IN (:ids)") List findByIds(List ids); - @Query("SELECT * FROM Document WHERE parent_id = :parentId") + @Query("SELECT * FROM Document WHERE parent_id = :parentId AND is_combine_child = 0 ORDER BY created_at DESC") List findByParentId(String parentId); - @Query("SELECT * FROM Document WHERE parent_id IS NULL") + @Query("SELECT * FROM Document WHERE parent_id IS NULL AND is_combine_child = 0 ORDER BY created_at DESC") List findRootDocuments(); - @Query("SELECT * FROM Document ORDER BY created_at DESC LIMIT :limit") + @Query("SELECT * FROM Document WHERE is_combine_child = 0 ORDER BY created_at DESC LIMIT :limit") List getRecentDocument(int limit); // Insert From 45e6b9ab0561dd38c1114f9de2ccc4d6d21af135 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:20:02 +0900 Subject: [PATCH 10/69] =?UTF-8?q?DocumentMeta=E3=81=AB=E3=83=95=E3=83=A9?= =?UTF-8?q?=E3=82=B0=E3=82=92=E8=BF=BD=E5=8A=A0,=20=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=A9=E3=82=AF=E3=82=BF,=20Getter/Setter?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/model/document/DocumentMeta.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java b/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java index ed686d0c..fb396801 100644 --- a/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java +++ b/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java @@ -36,6 +36,10 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 String author; + boolean isCombineChild; + + boolean isCombineParent; + // Constructor public DocumentMeta() { @@ -48,6 +52,8 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.parentId = null; this.updatedAt = new Date(); this.createdAt = new Date(); + this.isCombineChild = false; + this.isCombineParent = false; } public DocumentMeta(String title, String author) { @@ -73,6 +79,17 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.author = author; } + public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, String parentId, String author, boolean isCombineChild, boolean isCombineParent) { + this.id = id; + this.title = title; + this.updatedAt = updatedAt; + this.createdAt = createdAt; + this.parentId = parentId; + this.author = author; + this.isCombineChild = isCombineChild; + this.isCombineParent = isCombineParent; + } + // Getter /** @@ -117,6 +134,20 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 return author; } + /** + * ドキュメントの結合子フラグ(boolean)を取得する + */ + public boolean getIsCombineChild() { + return isCombineChild; + } + + /** + * ドキュメントの結合親フラグ(boolean)を取得する + */ + public boolean getIsCombineParent() { + return isCombineParent; + } + // Setter /** @@ -167,6 +198,22 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.author = author; } + /** + * ドキュメントの結合子フラグ(boolean)を設定する + * @param isCombineChild ドキュメントの結合子フラグ + */ + public void setIsCombineChild(boolean isCombineChild) { + this.isCombineChild = isCombineChild; + } + + /** + * ドキュメントの結合親フラグ(boolean)を設定する + * @param isCombineParent ドキュメントの結合親フラグ + */ + public void setIsCombineParent(boolean isCombineParent) { + this.isCombineParent = isCombineParent; + } + /** * updatedAtを現在時刻に設定する */ From 4bdb1a489c7cbc14ab84ee9085c94d3cd2effc87 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:20:50 +0900 Subject: [PATCH 11/69] =?UTF-8?q?=E3=81=99=E3=81=B9=E3=81=A6=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=81=A7=E6=97=A2=E5=AE=9A=E5=80=A4(false)=E3=82=92=E5=85=A5?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/model/document/DocumentMeta.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java b/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java index fb396801..ffe54b35 100644 --- a/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java +++ b/model/src/main/java/one/nem/lacerta/model/document/DocumentMeta.java @@ -60,6 +60,8 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.id = UUID.randomUUID().toString(); this.title = title; this.author = author; + this.isCombineChild = false; + this.isCombineParent = false; } public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, String author) { @@ -68,6 +70,8 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.updatedAt = updatedAt; this.createdAt = createdAt; this.author = author; + this.isCombineChild = false; + this.isCombineParent = false; } public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, String parentId, String author) { @@ -77,6 +81,8 @@ public class DocumentMeta { // TODO-rca: JavaDoc対応 this.createdAt = createdAt; this.parentId = parentId; this.author = author; + this.isCombineChild = false; + this.isCombineParent = false; } public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, String parentId, String author, boolean isCombineChild, boolean isCombineParent) { From 3ac7c4072de755a504e5eb3861b0db5356377fd5 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:21:39 +0900 Subject: [PATCH 12/69] =?UTF-8?q?Document=E3=82=92=E4=BD=9C=E6=88=90?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8=E3=81=8D=E3=81=AB=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=8F=E6=97=A2=E5=AE=9A=E5=80=A4=E3=82=92=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/one/nem/lacerta/data/impl/DocumentImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 bcd3318e..40dc234e 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 @@ -81,6 +81,8 @@ public class DocumentImpl implements Document { documentEntity.updatedAt = meta.getUpdatedAt(); documentEntity.createdAt = meta.getCreatedAt(); documentEntity.parentId = meta.getParentId(); + documentEntity.isCombineChild = meta.getIsCombineChild(); + documentEntity.isCombineParent = meta.getIsCombineParent(); database.documentDao().insert(documentEntity); @@ -104,6 +106,8 @@ public class DocumentImpl implements Document { meta.setUpdatedAt(new Date()); meta.setCreatedAt(new Date()); meta.setParentId(null); + meta.setIsCombineChild(false); + meta.setIsCombineParent(false); return createDocument(meta); } From 244fba16162474d1588e6338bef55cbcaed9cd81 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:24:18 +0900 Subject: [PATCH 13/69] =?UTF-8?q?=E5=BF=85=E8=A6=81=E3=81=AA=E3=83=A1?= =?UTF-8?q?=E3=82=BD=E3=83=83=E3=83=89=E3=82=92=E3=83=AA=E3=83=9D=E3=82=B8?= =?UTF-8?q?=E3=83=88=E3=83=AA=E3=81=AB=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/data/LacertaLibrary.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java index 19cd9b34..d9be07fe 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -43,4 +43,16 @@ public interface LacertaLibrary { CompletableFuture addTagToDocument(String documentId, String tagId); CompletableFuture removeTagFromDocument(String documentId, String tagId); + + // Combined Document + + CompletableFuture combineDocument(String parentId, String childId); + + CompletableFuture uncombineDocument(String parentId, String childId); + +// CompletableFuture combineDocument(String parentId, ArrayList childIdList); +// +// CompletableFuture uncombineDocument(String parentId, ArrayList childIdList); + + CompletableFuture> getCombinedDocumentList(String parentId); } From 68635e2f121c56f152cfda24afc21f0a62c72dc5 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sat, 27 Jan 2024 17:24:38 +0900 Subject: [PATCH 14/69] =?UTF-8?q?Impl=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/data/impl/LacertaLibraryImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 816bf706..df756211 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 @@ -294,6 +294,21 @@ public class LacertaLibraryImpl implements LacertaLibrary { }); } + @Override + public CompletableFuture combineDocument(String parentId, String childId) { + return null; + } + + @Override + public CompletableFuture uncombineDocument(String parentId, String childId) { + return null; + } + + @Override + public CompletableFuture> getCombinedDocumentList(String parentId) { + return null; + } + /** * 再帰的にパスを解決する * From cd784cad157b2616ea53588cdca0e6277ddbc33d Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 09:06:13 +0900 Subject: [PATCH 15/69] =?UTF-8?q?combineDocument=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/data/impl/LacertaLibraryImpl.java | 22 ++++++++++++++++++- 1 file changed, 21 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 df756211..4d92e314 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 @@ -27,6 +27,7 @@ import one.nem.lacerta.source.database.common.DateTypeConverter; import one.nem.lacerta.source.database.entity.DocumentEntity; import one.nem.lacerta.source.database.entity.FolderEntity; import one.nem.lacerta.source.database.entity.TagEntity; +import one.nem.lacerta.source.database.entity.ToxiDocumentEntity; import one.nem.lacerta.source.database.entity.ToxiDocumentTagEntity; import one.nem.lacerta.utils.FeatureSwitch; import one.nem.lacerta.utils.LacertaLogger; @@ -296,7 +297,26 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture combineDocument(String parentId, String childId) { - return null; + return CompletableFuture.supplyAsync(() -> { + DocumentEntity parentDocumentEntity = database.documentDao().findById(parentId); + DocumentEntity childDocumentEntity = database.documentDao().findById(childId); + if (parentDocumentEntity == null || childDocumentEntity == null) { + logger.warn("LacertaLibraryImpl", "DocumentEntity is not found."); + return null; + } + parentDocumentEntity.isCombineParent = true; + childDocumentEntity.isCombineChild = true; + database.documentDao().update(parentDocumentEntity); + database.documentDao().update(childDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Updated DocumentEntity"); + + ToxiDocumentEntity toxiDocumentEntity = new ToxiDocumentEntity(); + toxiDocumentEntity.parentDocumentId = parentId; + toxiDocumentEntity.childDocumentId = childId; + database.toxiDocumentDao().insert(toxiDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity"); + return null; + }); } @Override From 0a98cfd8a5089ef29c7a0a75a42771aa9171348f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 09:06:56 +0900 Subject: [PATCH 16/69] =?UTF-8?q?uncombineDocument=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/data/impl/LacertaLibraryImpl.java | 18 +++++++++++++++++- 1 file changed, 17 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 4d92e314..39a4221d 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 @@ -321,7 +321,23 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture uncombineDocument(String parentId, String childId) { - return null; + return CompletableFuture.supplyAsync(() -> { + DocumentEntity parentDocumentEntity = database.documentDao().findById(parentId); + DocumentEntity childDocumentEntity = database.documentDao().findById(childId); + if (parentDocumentEntity == null || childDocumentEntity == null) { + logger.warn("LacertaLibraryImpl", "DocumentEntity is not found."); + return null; + } + parentDocumentEntity.isCombineParent = false; + childDocumentEntity.isCombineChild = false; + database.documentDao().update(parentDocumentEntity); + database.documentDao().update(childDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Updated DocumentEntity"); + + database.toxiDocumentDao().deleteByParentIdAndChildId(parentId, childId); + logger.debug("LacertaLibraryImpl", "Database Query: Deleted ToxiDocumentEntity"); + return null; + }); } @Override From 575df321575ea0794c58fa389b53e7e5ea026556 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 09:08:17 +0900 Subject: [PATCH 17/69] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E3=83=95=E3=82=A7=E3=83=BC=E3=82=B9=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java | 2 +- .../java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java index d9be07fe..22279cdd 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -54,5 +54,5 @@ public interface LacertaLibrary { // // CompletableFuture uncombineDocument(String parentId, ArrayList childIdList); - CompletableFuture> getCombinedDocumentList(String parentId); + CompletableFuture> getCombinedDocumentIdList(String parentId); } 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 39a4221d..5b54fd93 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 @@ -341,8 +341,8 @@ public class LacertaLibraryImpl implements LacertaLibrary { } @Override - public CompletableFuture> getCombinedDocumentList(String parentId) { - return null; + public CompletableFuture> getCombinedDocumentIdList(String parentId) { + } /** From d7bfcd89707273096533eb132ab37cf4794592b7 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 09:08:56 +0900 Subject: [PATCH 18/69] =?UTF-8?q?getCombinedDocumentIdList=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 9 ++++++++- 1 file changed, 8 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 5b54fd93..f072594d 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 @@ -342,7 +342,14 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture> getCombinedDocumentIdList(String parentId) { - + return CompletableFuture.supplyAsync(() -> { + List toxiDocumentEntities = database.toxiDocumentDao().findByParentId(parentId); + ArrayList documentIdList = new ArrayList<>(); + for (ToxiDocumentEntity toxiDocumentEntity : toxiDocumentEntities) { + documentIdList.add(toxiDocumentEntity.childDocumentId); + } + return documentIdList; + }); } /** From ff210f50a97a231e2ea84cc0e404a9a183a3b510 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 11:34:58 +0900 Subject: [PATCH 19/69] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0=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 --- component/viewer/src/main/res/menu/viewer_menu.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/component/viewer/src/main/res/menu/viewer_menu.xml b/component/viewer/src/main/res/menu/viewer_menu.xml index 5d301a09..231419b6 100644 --- a/component/viewer/src/main/res/menu/viewer_menu.xml +++ b/component/viewer/src/main/res/menu/viewer_menu.xml @@ -16,4 +16,8 @@ android:id="@+id/action_move" android:title="移動" /> + + \ No newline at end of file From 8e1127586d2b72e9aa0b4390bbb9712b526e89b0 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 11:39:23 +0900 Subject: [PATCH 20/69] =?UTF-8?q?=E4=B8=BB=E3=82=AD=E3=83=BC=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E6=BC=8F=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/source/database/entity/ToxiDocumentEntity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java index 08c24b31..1b23f33b 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java @@ -1,15 +1,18 @@ package one.nem.lacerta.source.database.entity; +import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; -@Entity(tableName = "toxi_document") +@Entity(primaryKeys = {"parent_document_id", "child_document_id"}, tableName = "toxi_document") public class ToxiDocumentEntity { @ColumnInfo(name = "parent_document_id") + @NonNull public String parentDocumentId; @ColumnInfo(name = "child_document_id") + @NonNull public String childDocumentId; @ColumnInfo(name = "order") From 79beb8f87f5b09e0cecef8f8dbbf69a65ec37599 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 11:44:05 +0900 Subject: [PATCH 21/69] =?UTF-8?q?=E7=B5=90=E5=90=88=E3=82=A2=E3=82=AF?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerListFragment.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java index 65518a10..c4ba8a1c 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java @@ -24,6 +24,8 @@ import one.nem.lacerta.component.common.LacertaSelectDirDialogListener; import one.nem.lacerta.component.common.LacertaSelectRevDialog; import one.nem.lacerta.component.common.LacertaSelectRevDialogListener; import one.nem.lacerta.component.common.picker.LacertaDirPickerDialog; +import one.nem.lacerta.component.common.picker.LacertaFilePickerAdapter; +import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.ListItemType; @@ -256,6 +258,21 @@ public class ViewerListFragment extends Fragment { .setNegativeButtonText("キャンセル"); lacertaDirPickerDialog.show(getParentFragmentManager(), "select_dir_dialog"); return true; + } else if(item.getItemId() == R.id.action_combine) { + LacertaFilePickerDialog lacertaFilePickerDialog = new LacertaFilePickerDialog(); + lacertaFilePickerDialog.setListener((name, fileId) -> { + lacertaLibrary.combineDocument(documentId, fileId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + // Stop Activity + getActivity().finish(); // TODO-rca: 終了せずにUIを更新したい + }); + }); + }); + lacertaFilePickerDialog.setTitle("ファイルの結合") + .setMessage("結合するファイルを選択してください。") + .setNegativeButtonText("キャンセル"); + lacertaFilePickerDialog.show(getParentFragmentManager(), "select_file_dialog"); + return true; } else { return false; } From f9938867aea0a1a392d59e4bf050c257d8246f32 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:23:31 +0900 Subject: [PATCH 22/69] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A?= =?UTF-8?q?=E3=83=95=E3=83=A9=E3=82=B0=E3=83=A1=E3=83=B3=E3=83=88=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 64 +++++++++++++++++++ .../res/layout/fragment_viewer_container.xml | 14 ++++ 2 files changed, 78 insertions(+) create mode 100644 component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java create mode 100644 component/viewer/src/main/res/layout/fragment_viewer_container.xml diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java new file mode 100644 index 00000000..ac6c658c --- /dev/null +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -0,0 +1,64 @@ +package one.nem.lacerta.component.viewer; + +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 ViewerContainerFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class ViewerContainerFragment 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 ViewerContainerFragment() { + // 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 ViewerContainerFragment. + */ + // TODO: Rename and change types and number of parameters + public static ViewerContainerFragment newInstance(String param1, String param2) { + ViewerContainerFragment fragment = new ViewerContainerFragment(); + 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_viewer_container, container, false); + } +} \ No newline at end of file diff --git a/component/viewer/src/main/res/layout/fragment_viewer_container.xml b/component/viewer/src/main/res/layout/fragment_viewer_container.xml new file mode 100644 index 00000000..ce8c8f97 --- /dev/null +++ b/component/viewer/src/main/res/layout/fragment_viewer_container.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file From a349bc73175e269602f410fb7cbcd183b219a954 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:23:59 +0900 Subject: [PATCH 23/69] =?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 --- .../viewer/ViewerContainerFragment.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index ac6c658c..fa914cf9 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -15,33 +15,13 @@ import android.view.ViewGroup; */ public class ViewerContainerFragment 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 ViewerContainerFragment() { // 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 ViewerContainerFragment. - */ - // TODO: Rename and change types and number of parameters - public static ViewerContainerFragment newInstance(String param1, String param2) { + public static ViewerContainerFragment newInstance() { ViewerContainerFragment fragment = new ViewerContainerFragment(); 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 ViewerContainerFragment 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 f693c5e88b90e9d23a303e116f230151607462c7 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:24:45 +0900 Subject: [PATCH 24/69] =?UTF-8?q?Body=E3=83=95=E3=83=A9=E3=82=B0=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerBodyFragment.java | 64 +++++++++++++++++++ .../main/res/layout/fragment_viewer_body.xml | 14 ++++ 2 files changed, 78 insertions(+) create mode 100644 component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java create mode 100644 component/viewer/src/main/res/layout/fragment_viewer_body.xml diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java new file mode 100644 index 00000000..33319e19 --- /dev/null +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -0,0 +1,64 @@ +package one.nem.lacerta.component.viewer; + +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 ViewerBodyFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class ViewerBodyFragment 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 ViewerBodyFragment() { + // 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 ViewerBodyFragment. + */ + // TODO: Rename and change types and number of parameters + public static ViewerBodyFragment newInstance(String param1, String param2) { + ViewerBodyFragment fragment = new ViewerBodyFragment(); + 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_viewer_body, container, false); + } +} \ No newline at end of file diff --git a/component/viewer/src/main/res/layout/fragment_viewer_body.xml b/component/viewer/src/main/res/layout/fragment_viewer_body.xml new file mode 100644 index 00000000..41efbb22 --- /dev/null +++ b/component/viewer/src/main/res/layout/fragment_viewer_body.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file From a0dc49ab95e762447c5bc1981b1bcdbc9e616e86 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:25:02 +0900 Subject: [PATCH 25/69] =?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 --- .../component/viewer/ViewerBodyFragment.java | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java index 33319e19..cdde3395 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -15,33 +15,14 @@ import android.view.ViewGroup; */ public class ViewerBodyFragment 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 ViewerBodyFragment() { // 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 ViewerBodyFragment. - */ - // TODO: Rename and change types and number of parameters - public static ViewerBodyFragment newInstance(String param1, String param2) { + public static ViewerBodyFragment newInstance() { ViewerBodyFragment fragment = new ViewerBodyFragment(); Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @@ -49,10 +30,6 @@ public class ViewerBodyFragment 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 adb60b7fb2e01b008b36e630f564ab9afc8474f2 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:31:11 +0900 Subject: [PATCH 26/69] =?UTF-8?q?=E4=BE=9D=E5=AD=98=E9=96=A2=E4=BF=82?= =?UTF-8?q?=E3=81=ABViewPager2=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/viewer/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/component/viewer/build.gradle b/component/viewer/build.gradle index 2dd27941..e1d552bb 100644 --- a/component/viewer/build.gradle +++ b/component/viewer/build.gradle @@ -61,4 +61,6 @@ dependencies { // TODO-rca: バージョンカタログに切り出す implementation "com.hendraanggrian.material:collapsingtoolbarlayout-subtitle:1.5.0" + // ViewPager2 + implementation "androidx.viewpager2:viewpager2:1.0.0" } \ No newline at end of file From bd1ea74c4c72b0f8aa077d365b4e1d8201e48a59 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:35:16 +0900 Subject: [PATCH 27/69] =?UTF-8?q?PagerAdapter=E5=AE=9F=E8=A3=85WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerViewPagerAdapter.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java new file mode 100644 index 00000000..5de859c6 --- /dev/null +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java @@ -0,0 +1,26 @@ +package one.nem.lacerta.component.viewer; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager2.adapter.FragmentStateAdapter; + +public class ViewerViewPagerAdapter extends FragmentStateAdapter { + + public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) { + super(fragmentActivity); + } + + @NonNull + @Override + public Fragment createFragment(int position) { + return null; + } + + @Override + public int getItemCount() { + return 0; + } +} From e6cdba337e944a1ab523e5a77293ac683bb16795 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:37:48 +0900 Subject: [PATCH 28/69] =?UTF-8?q?Hilt=E3=81=AEInject=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 --- .../component/viewer/ViewerBodyFragment.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java index cdde3395..4809416a 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -8,13 +8,33 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.Document; +import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.utils.LacertaLogger; +import one.nem.lacerta.vcs.factory.LacertaVcsFactory; + /** * A simple {@link Fragment} subclass. * Use the {@link ViewerBodyFragment#newInstance} factory method to * create an instance of this fragment. */ +@AndroidEntryPoint public class ViewerBodyFragment extends Fragment { + @Inject + Document document; + + @Inject + LacertaLibrary lacertaLibrary; + + @Inject + LacertaLogger logger; + + @Inject + LacertaVcsFactory lacertaVcsFactory; public ViewerBodyFragment() { // Required empty public constructor From 2812b02ba2bdb4b9ec7e9e79f6710b44d0e76e23 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:39:10 +0900 Subject: [PATCH 29/69] =?UTF-8?q?Factory=E3=83=A1=E3=82=BD=E3=83=83?= =?UTF-8?q?=E3=83=89=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerBodyFragment.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java index 4809416a..5549adb0 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -36,13 +36,30 @@ public class ViewerBodyFragment extends Fragment { @Inject LacertaVcsFactory lacertaVcsFactory; + // Variables + private String documentId; + private String documentName; + private String revisionId; + public ViewerBodyFragment() { // Required empty public constructor } - public static ViewerBodyFragment newInstance() { + public static ViewerBodyFragment newInstance(String documentId, String documentName) { ViewerBodyFragment fragment = new ViewerBodyFragment(); Bundle args = new Bundle(); + args.putString("documentId", documentId); + args.putString("documentName", documentName); + fragment.setArguments(args); + return fragment; + } + + public static ViewerBodyFragment newInstance(String documentId, String documentName, String revisionId) { + ViewerBodyFragment fragment = new ViewerBodyFragment(); + Bundle args = new Bundle(); + args.putString("documentId", documentId); + args.putString("documentName", documentName); + args.putString("revisionId", revisionId); fragment.setArguments(args); return fragment; } From b7822945fd2d703ec0be4eaf396927fa3f3a538b Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:49:06 +0900 Subject: [PATCH 30/69] =?UTF-8?q?=E5=BC=95=E6=95=B0=E5=87=A6=E7=90=86,=20L?= =?UTF-8?q?oadDocument=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerBodyFragment.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java index 5549adb0..4e702a7d 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -3,10 +3,13 @@ package one.nem.lacerta.component.viewer; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; import javax.inject.Inject; @@ -14,6 +17,7 @@ import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.utils.LacertaLogger; +import one.nem.lacerta.vcs.LacertaVcs; import one.nem.lacerta.vcs.factory.LacertaVcsFactory; /** @@ -67,6 +71,11 @@ public class ViewerBodyFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (getArguments() != null) { + documentId = getArguments().getString("documentId"); + documentName = getArguments().getString("documentName"); + revisionId = getArguments().getString("revisionId"); + } } @Override @@ -75,4 +84,38 @@ public class ViewerBodyFragment extends Fragment { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_viewer_body, container, false); } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + logger.debug("ViewerBodyFragment", "ViewerBodyFragment.onViewCreated"); + + RecyclerView recyclerView = view.findViewById(R.id.recycler_view); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + + ViewerBodyAdapter viewerBodyAdapter = new ViewerBodyAdapter(fileName -> { + Toast.makeText(getContext(), fileName, Toast.LENGTH_SHORT).show(); + // TODO-rca: なにか処理をもたせる + }); + recyclerView.setAdapter(viewerBodyAdapter); + } + + private void loadDocument(ViewerBodyAdapter adapter, String documentId, String revisionId) { + if (revisionId == null) { // load latest revision + document.getDocument(documentId).thenAccept(document -> { + getActivity().runOnUiThread(() -> { + adapter.setPages(document.getPages()); + adapter.notifyDataSetChanged(); + }); + }); + } else { // load specified revision + LacertaVcs vcs = lacertaVcsFactory.create(documentId); + document.getDocumentPageListByFileNameList(documentId, vcs.getDocumentPagePathListRev(revisionId).join()).thenAccept(documentPageList -> { + getActivity().runOnUiThread(() -> { + adapter.setPages(documentPageList); + adapter.notifyDataSetChanged(); + }); + }); + } + } } \ No newline at end of file From adcf9f16b90a18070e2ffdf8dac7f18466f7d2a5 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:49:58 +0900 Subject: [PATCH 31/69] =?UTF-8?q?ViewerBodyFragment=E5=87=A6=E7=90=86?= =?UTF-8?q?=E5=AE=9F=E8=A3=85WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/component/viewer/ViewerBodyFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java index 4e702a7d..3fe30549 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerBodyFragment.java @@ -98,6 +98,8 @@ public class ViewerBodyFragment extends Fragment { // TODO-rca: なにか処理をもたせる }); recyclerView.setAdapter(viewerBodyAdapter); + + loadDocument(viewerBodyAdapter, documentId, revisionId); } private void loadDocument(ViewerBodyAdapter adapter, String documentId, String revisionId) { From 6ec0710bac0b2c1d15e5276aee995147fd119bb6 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:51:38 +0900 Subject: [PATCH 32/69] =?UTF-8?q?=E5=BC=95=E6=95=B0=E5=87=A6=E7=90=86?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerContainerFragment.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index fa914cf9..2f4ae1f3 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -15,20 +15,30 @@ import android.view.ViewGroup; */ public class ViewerContainerFragment extends Fragment { + // Variables + private String documentId; + private String documentName; + public ViewerContainerFragment() { // Required empty public constructor } - public static ViewerContainerFragment newInstance() { + public static ViewerContainerFragment newInstance(String documentId, String documentName) { ViewerContainerFragment fragment = new ViewerContainerFragment(); Bundle args = new Bundle(); fragment.setArguments(args); + args.putString("documentId", documentId); + args.putString("documentName", documentName); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + if (getArguments() != null){ + documentId = getArguments().getString("documentId"); + documentName = getArguments().getString("documentName"); + } } @Override From 874946a38d354af642108b290b92034fc29b669a Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:52:41 +0900 Subject: [PATCH 33/69] =?UTF-8?q?ViewPager2=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/fragment_viewer_container.xml | 64 +++++++++++++++++-- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/component/viewer/src/main/res/layout/fragment_viewer_container.xml b/component/viewer/src/main/res/layout/fragment_viewer_container.xml index ce8c8f97..2be3e503 100644 --- a/component/viewer/src/main/res/layout/fragment_viewer_container.xml +++ b/component/viewer/src/main/res/layout/fragment_viewer_container.xml @@ -1,14 +1,64 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + \ No newline at end of file From 5f0e88d804ddd19a181156430292d4c9e9991e27 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 12:54:41 +0900 Subject: [PATCH 34/69] =?UTF-8?q?Adapter=E5=AE=9F=E8=A3=85=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerViewPagerAdapter.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java index 5de859c6..cdf742b0 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java @@ -7,8 +7,20 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager2.adapter.FragmentStateAdapter; +import java.util.ArrayList; + public class ViewerViewPagerAdapter extends FragmentStateAdapter { + // Variables + private ArrayList fragmentArrayList = new ArrayList<>(); + private ArrayList fragmentTitleList = new ArrayList<>(); + + // Setter + public void addFragment(Fragment fragment, String title){ + fragmentArrayList.add(fragment); + fragmentTitleList.add(title); + } + public ViewerViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) { super(fragmentActivity); } @@ -16,11 +28,11 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter { @NonNull @Override public Fragment createFragment(int position) { - return null; + return fragmentArrayList.get(position); } @Override public int getItemCount() { - return 0; + return fragmentArrayList == null ? 0 : fragmentArrayList.size(); } } From a2a3d2ab5448b0e02f216d60d2aa7ff77e750d06 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:00:14 +0900 Subject: [PATCH 35/69] =?UTF-8?q?Toxi=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E3=81=AEEntity=E3=81=AB=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=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 --- .../nem/lacerta/source/database/entity/ToxiDocumentEntity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java index 1b23f33b..3261f91d 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java +++ b/source/src/main/java/one/nem/lacerta/source/database/entity/ToxiDocumentEntity.java @@ -20,4 +20,7 @@ public class ToxiDocumentEntity { @ColumnInfo(name = "is_active") public boolean isActive; + + @ColumnInfo(name = "title_cache") + public String titleCache; } From 9110352f68b3eede1304550a9b09b1f1445ed3cc Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:00:42 +0900 Subject: [PATCH 36/69] =?UTF-8?q?DB=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E3=82=A4=E3=83=B3=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/source/database/LacertaDatabase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java index ad89a8f0..df677293 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java +++ b/source/src/main/java/one/nem/lacerta/source/database/LacertaDatabase.java @@ -23,7 +23,7 @@ import one.nem.lacerta.source.database.dao.LibraryDao; import one.nem.lacerta.source.database.dao.VcsRevDao; import one.nem.lacerta.source.database.dao.VcsLogDao; -@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class, FolderEntity.class, ToxiDocumentTagEntity.class, ToxiDocumentEntity.class}, version = 7) +@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class, VcsRevEntity.class, VcsLogEntity.class, FolderEntity.class, ToxiDocumentTagEntity.class, ToxiDocumentEntity.class}, version = 8) public abstract class LacertaDatabase extends RoomDatabase { public abstract TagDao tagDao(); public abstract DocumentDao documentDao(); From ff5ef8611ad4658ccf33b9a1656df459d2f4c1e6 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:03:57 +0900 Subject: [PATCH 37/69] =?UTF-8?q?ToxiDocumentModel=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/model/pref/ToxiDocumentModel.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 model/src/main/java/one/nem/lacerta/model/pref/ToxiDocumentModel.java diff --git a/model/src/main/java/one/nem/lacerta/model/pref/ToxiDocumentModel.java b/model/src/main/java/one/nem/lacerta/model/pref/ToxiDocumentModel.java new file mode 100644 index 00000000..0afcce79 --- /dev/null +++ b/model/src/main/java/one/nem/lacerta/model/pref/ToxiDocumentModel.java @@ -0,0 +1,68 @@ +package one.nem.lacerta.model.pref; + +public class ToxiDocumentModel { + + // Field + public String parentDocumentId; + + public String childDocumentId; + + public int order; + + public boolean isActive; + + public String titleCache; + + // Constructor + public ToxiDocumentModel() { + } + + public ToxiDocumentModel(String parentDocumentId, String childDocumentId, int order, boolean isActive, String titleCache) { + this.parentDocumentId = parentDocumentId; + this.childDocumentId = childDocumentId; + this.order = order; + this.isActive = isActive; + this.titleCache = titleCache; + } + + // Getter / Setter + public String getParentDocumentId() { + return parentDocumentId; + } + + public void setParentDocumentId(String parentDocumentId) { + this.parentDocumentId = parentDocumentId; + } + + public String getChildDocumentId() { + return childDocumentId; + } + + public void setChildDocumentId(String childDocumentId) { + this.childDocumentId = childDocumentId; + } + + public int getOrder() { + return order; + } + + public void setOrder(int order) { + this.order = order; + } + + public boolean isActive() { + return isActive; + } + + public void setActive(boolean active) { + isActive = active; + } + + public String getTitleCache() { + return titleCache; + } + + public void setTitleCache(String titleCache) { + this.titleCache = titleCache; + } +} From 0a96a9443d16b501edda83191fe993e820f0481b Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:07:32 +0900 Subject: [PATCH 38/69] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E3=83=95=E3=82=A7=E3=83=BC=E3=82=B9=E5=A4=89=E6=9B=B4,=20Impl?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/LacertaLibrary.java | 3 ++- .../nem/lacerta/data/impl/LacertaLibraryImpl.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java index 22279cdd..7e8ba899 100644 --- a/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java +++ b/data/src/main/java/one/nem/lacerta/data/LacertaLibrary.java @@ -10,6 +10,7 @@ import one.nem.lacerta.model.LibraryItemPage; import one.nem.lacerta.model.PublicPath; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.tag.DocumentTag; +import one.nem.lacerta.model.pref.ToxiDocumentModel; public interface LacertaLibrary { @@ -54,5 +55,5 @@ public interface LacertaLibrary { // // CompletableFuture uncombineDocument(String parentId, ArrayList childIdList); - CompletableFuture> getCombinedDocumentIdList(String parentId); + CompletableFuture> getCombinedDocumentToxiList(String parentId); } 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 f072594d..c5b43060 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 @@ -22,6 +22,7 @@ import one.nem.lacerta.model.ListItemType; import one.nem.lacerta.model.PublicPath; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.tag.DocumentTag; +import one.nem.lacerta.model.pref.ToxiDocumentModel; import one.nem.lacerta.source.database.LacertaDatabase; import one.nem.lacerta.source.database.common.DateTypeConverter; import one.nem.lacerta.source.database.entity.DocumentEntity; @@ -341,14 +342,20 @@ public class LacertaLibraryImpl implements LacertaLibrary { } @Override - public CompletableFuture> getCombinedDocumentIdList(String parentId) { + public CompletableFuture> getCombinedDocumentToxiList(String parentId) { return CompletableFuture.supplyAsync(() -> { List toxiDocumentEntities = database.toxiDocumentDao().findByParentId(parentId); - ArrayList documentIdList = new ArrayList<>(); + ArrayList toxiDocumentModels = new ArrayList<>(); for (ToxiDocumentEntity toxiDocumentEntity : toxiDocumentEntities) { - documentIdList.add(toxiDocumentEntity.childDocumentId); + ToxiDocumentModel toxiDocumentModel = new ToxiDocumentModel(); + toxiDocumentModel.setParentDocumentId(toxiDocumentEntity.parentDocumentId); + toxiDocumentModel.setChildDocumentId(toxiDocumentEntity.childDocumentId); + toxiDocumentModel.setOrder(toxiDocumentEntity.order); + toxiDocumentModel.setActive(toxiDocumentEntity.isActive); + toxiDocumentModel.setTitleCache(toxiDocumentEntity.titleCache); + toxiDocumentModels.add(toxiDocumentModel); } - return documentIdList; + return toxiDocumentModels; }); } From beceec0abe3007908667d35d0d358ab4c3b12205 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:09:26 +0900 Subject: [PATCH 39/69] =?UTF-8?q?Combine=E3=81=99=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AE=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=82=92?= =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 3 +++ 1 file changed, 3 insertions(+) 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 c5b43060..b3b27070 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 @@ -314,6 +314,9 @@ public class LacertaLibraryImpl implements LacertaLibrary { ToxiDocumentEntity toxiDocumentEntity = new ToxiDocumentEntity(); toxiDocumentEntity.parentDocumentId = parentId; toxiDocumentEntity.childDocumentId = childId; + toxiDocumentEntity.order = 0; // TODO-rca: 並び順の概念をもたせる + toxiDocumentEntity.isActive = true; // TODO-rca: タブから非表示にできるようにする + toxiDocumentEntity.titleCache = childDocumentEntity.title; database.toxiDocumentDao().insert(toxiDocumentEntity); logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity"); return null; From 92167656fcfa0fa1454279489360674fcd464028 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:12:03 +0900 Subject: [PATCH 40/69] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=8A?= =?UTF-8?q?=E3=83=95=E3=83=A9=E3=82=B0=E3=83=A1=E3=83=B3=E3=83=88=E5=87=A6?= =?UTF-8?q?=E7=90=86=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 2f4ae1f3..c97d6e00 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -3,32 +3,61 @@ package one.nem.lacerta.component.viewer; import android.os.Bundle; import androidx.fragment.app.Fragment; +import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.model.pref.ToxiDocumentModel; +import one.nem.lacerta.utils.LacertaLogger; + /** * A simple {@link Fragment} subclass. * Use the {@link ViewerContainerFragment#newInstance} factory method to * create an instance of this fragment. */ +@AndroidEntryPoint public class ViewerContainerFragment extends Fragment { + // Inject + + @Inject + LacertaLogger logger; + + @Inject + LacertaLibrary lacertaLibrary; + // Variables private String documentId; private String documentName; + private boolean hasCombined = false; public ViewerContainerFragment() { // Required empty public constructor } + public static ViewerContainerFragment newInstance(String documentId, String documentName, boolean hasCombined) { + ViewerContainerFragment fragment = new ViewerContainerFragment(); + Bundle args = new Bundle(); + fragment.setArguments(args); + args.putString("documentId", documentId); + args.putString("documentName", documentName); + args.putBoolean("hasCombined", hasCombined); + return fragment; + } + public static ViewerContainerFragment newInstance(String documentId, String documentName) { ViewerContainerFragment fragment = new ViewerContainerFragment(); Bundle args = new Bundle(); fragment.setArguments(args); args.putString("documentId", documentId); args.putString("documentName", documentName); + args.putBoolean("hasCombined", false); return fragment; } @@ -47,4 +76,26 @@ public class ViewerContainerFragment extends Fragment { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_viewer_container, container, false); } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + // Init view pager + ViewPager2 viewPager = view.findViewById(R.id.view_pager); + + // Init view pager adapter + ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity()); + viewPager.setAdapter(viewerViewPagerAdapter); + + if (this.hasCombined) { + lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { + for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { + viewerViewPagerAdapter + .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), + toxiDocumentModel.getTitleCache()); + } + }); + } + } } \ No newline at end of file From 314214f7343f1f9bf1ae4a0d326ff48c6c0ea064 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:13:51 +0900 Subject: [PATCH 41/69] =?UTF-8?q?ViewerMainActivity=E3=81=8B=E3=82=89Conta?= =?UTF-8?q?iner=E3=82=92=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=99=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerMainActivity.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java index 0b9a3e59..0c73af39 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerMainActivity.java @@ -30,6 +30,7 @@ public class ViewerMainActivity extends AppCompatActivity { private static final String TAG = "ViewerMainActivity"; String documentId; String documentName; + boolean hasCombined = false; @Override protected void onCreate(Bundle savedInstanceState) { @@ -49,6 +50,7 @@ public class ViewerMainActivity extends AppCompatActivity { try { documentId = intent.getStringExtra("documentId"); documentName = intent.getStringExtra("documentName"); + hasCombined = intent.getBooleanExtra("hasCombined", false); } catch (Exception e) { logger.error(TAG, "Failed to get documentId from intent"); @@ -58,9 +60,18 @@ public class ViewerMainActivity extends AppCompatActivity { } // Navigation - getSupportFragmentManager().beginTransaction() - .replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName)) - .commit(); +// getSupportFragmentManager().beginTransaction() +// .replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName)) +// .commit(); + if (hasCombined) { + getSupportFragmentManager().beginTransaction() + .replace(R.id.nav_host_fragment, ViewerContainerFragment.newInstance(documentId, documentName, hasCombined)) + .commit(); + } else { + getSupportFragmentManager().beginTransaction() + .replace(R.id.nav_host_fragment, ViewerContainerFragment.newInstance(documentId, documentName)) + .commit(); + } } } \ No newline at end of file From a239fd2f9cd9c3f75c6c9b0345a00dad6d4b82fb Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:14:34 +0900 Subject: [PATCH 42/69] =?UTF-8?q?Combine=E3=81=95=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=AA=E3=81=84=E3=81=A8=E3=81=8D=E3=81=AE=E5=87=A6?= =?UTF-8?q?=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index c97d6e00..a5beea08 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -96,6 +96,8 @@ public class ViewerContainerFragment extends Fragment { toxiDocumentModel.getTitleCache()); } }); + } else { + viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); } } } \ No newline at end of file From 3afe8ce4cb06ae2190574b495d2bc7be42227910 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:17:29 +0900 Subject: [PATCH 43/69] =?UTF-8?q?Body=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/src/main/res/layout/fragment_viewer_body.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/component/viewer/src/main/res/layout/fragment_viewer_body.xml b/component/viewer/src/main/res/layout/fragment_viewer_body.xml index 41efbb22..0309ef0a 100644 --- a/component/viewer/src/main/res/layout/fragment_viewer_body.xml +++ b/component/viewer/src/main/res/layout/fragment_viewer_body.xml @@ -3,12 +3,13 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".ViewerBodyFragment"> - - + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> \ No newline at end of file From 8038b7e1989386000e0c6762d42e4baa64958678 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:23:16 +0900 Subject: [PATCH 44/69] =?UTF-8?q?Toolbar=E3=82=92=E5=87=A6=E7=90=86?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index a5beea08..d51a015e 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -2,17 +2,20 @@ package one.nem.lacerta.component.viewer; import android.os.Bundle; +import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.Toast; import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.data.LacertaLibrary; +import one.nem.lacerta.model.document.page.Page; import one.nem.lacerta.model.pref.ToxiDocumentModel; import one.nem.lacerta.utils.LacertaLogger; @@ -100,4 +103,48 @@ public class ViewerContainerFragment extends Fragment { viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); } } + + /** + * Toolbarをinitする + * + * @param toolbar Toolbar + * @param showCloseButton Closeボタンを表示するかどうか + * @param title タイトル + */ + private void initToolbar(Toolbar toolbar, boolean showCloseButton, String title) { + getActivity().runOnUiThread(() -> { + // Close button + if (showCloseButton) { + toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.close_24px); + toolbar.setNavigationOnClickListener(v -> { + getActivity().finish(); + }); + } else { + toolbar.setNavigationIcon(null); + } + + // Title + toolbar.setTitle(title); + + // Menu + toolbar.inflateMenu(R.menu.viewer_menu); + toolbar.setOnMenuItemClickListener(item -> { + if (item.getItemId() == R.id.action_open_vcs_rev_list) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; + } else if (item.getItemId() == R.id.action_rename) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; + } else if (item.getItemId() == R.id.action_delete) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; + } else if (item.getItemId() == R.id.action_move) { + Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + return true; + } else { + return false; + } + }); + }); + } } \ No newline at end of file From eeeef90ec23ad57cfc9bedbf06817f7847c96532 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:28:13 +0900 Subject: [PATCH 45/69] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AE=E3=83=AA=E3=83=8D=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E3=81=A0=E3=81=91=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index d51a015e..7944b743 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -11,9 +11,14 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Toast; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; + import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.document.page.Page; import one.nem.lacerta.model.pref.ToxiDocumentModel; @@ -35,6 +40,9 @@ public class ViewerContainerFragment extends Fragment { @Inject LacertaLibrary lacertaLibrary; + @Inject + Document document; + // Variables private String documentId; private String documentName; @@ -133,7 +141,7 @@ public class ViewerContainerFragment extends Fragment { Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); return true; } else if (item.getItemId() == R.id.action_rename) { - Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + renameDocument(); return true; } else if (item.getItemId() == R.id.action_delete) { Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); @@ -147,4 +155,31 @@ public class ViewerContainerFragment extends Fragment { }); }); } + + private void renameDocument() { + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); + builder.setTitle("ファイル名の変更"); + builder.setMessage("ファイル名を入力してください"); + + View view = LayoutInflater.from(getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.lacerta_dialog_edit_text_layout, null); + TextInputEditText textInputEditText = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_edit_text); + TextInputLayout textInputLayout = view.findViewById(one.nem.lacerta.shared.ui.R.id.custom_text_input_layout); + textInputEditText.setText(documentName); + textInputLayout.setHint("ファイル名"); + builder.setView(view); + + builder.setPositiveButton("変更", (dialog, which) -> { + document.renameDocument(documentId, textInputEditText.getText().toString()).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + this.documentName = textInputEditText.getText().toString(); + // TODO-rca: Toolbarのタイトルも変更する + }); + }); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + + builder.show(); + } } \ No newline at end of file From e1bc6466e76cdc055c20f62faabb383c688888cd Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:29:04 +0900 Subject: [PATCH 46/69] =?UTF-8?q?Toolbar=E3=81=AEinit=E3=82=92=E8=B5=B7?= =?UTF-8?q?=E5=8B=95=E6=99=82=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=99=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 7944b743..7f0b8f2c 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -99,6 +99,10 @@ public class ViewerContainerFragment extends Fragment { ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity()); viewPager.setAdapter(viewerViewPagerAdapter); + // Init toolbar + Toolbar toolbar = view.findViewById(R.id.toolbar); + initToolbar(toolbar, true, documentName); + if (this.hasCombined) { lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { From 4649399ef96aca01665c3a3873f017eeeef12c6f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:30:33 +0900 Subject: [PATCH 47/69] =?UTF-8?q?Combine=E3=81=95=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=AA=E3=81=84=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AFTabLayout?= =?UTF-8?q?=E3=82=92=E9=9A=A0=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 7f0b8f2c..020f08ef 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -12,6 +12,7 @@ import android.view.ViewGroup; import android.widget.Toast; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.tabs.TabLayout; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; @@ -112,6 +113,8 @@ public class ViewerContainerFragment extends Fragment { } }); } else { + TabLayout tabLayout = view.findViewById(R.id.tab_layout); + tabLayout.setVisibility(View.GONE); viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); } } From f9df1379f44e37061e1f2a27975aa8b740136d91 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:40:23 +0900 Subject: [PATCH 48/69] =?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 --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 020f08ef..e365c66c 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -163,6 +163,9 @@ public class ViewerContainerFragment extends Fragment { }); } + /** + * ドキュメント名を変更する + */ private void renameDocument() { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle("ファイル名の変更"); From b9c1c521cfeec657b36d7cbf063fca6f90a67025 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:43:56 +0900 Subject: [PATCH 49/69] =?UTF-8?q?combine=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index e365c66c..542fced8 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -19,6 +19,7 @@ import com.google.android.material.textfield.TextInputLayout; import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.document.page.Page; @@ -156,6 +157,9 @@ public class ViewerContainerFragment extends Fragment { } else if (item.getItemId() == R.id.action_move) { Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); return true; + } else if (item.getItemId() == R.id.action_combine) { + combineDocument(); + return true; } else { return false; } @@ -163,6 +167,23 @@ public class ViewerContainerFragment extends Fragment { }); } + private void combineDocument() { + LacertaFilePickerDialog lacertaFilePickerDialog = new LacertaFilePickerDialog(); + lacertaFilePickerDialog.setListener((fileName, selectedId) -> { + lacertaLibrary.combineDocument(documentId, selectedId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "結合しました", Toast.LENGTH_SHORT).show(); + getActivity().finish(); // TODO-rca: 終了させずにUIを更新したい + }); + }); + }); + lacertaFilePickerDialog + .setTitle("ファイルの結合") + .setMessage("結合するファイルを選択してください") + .setNegativeButtonText("キャンセル") + .show(getChildFragmentManager(), "LacertaFilePickerDialog"); + } + /** * ドキュメント名を変更する */ From b86843bd570ecee3f69bcc30fbf5de3119f3210b Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:46:03 +0900 Subject: [PATCH 50/69] =?UTF-8?q?ListItem=E3=81=ABisCombined=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/ListItem.java | 17 +++++++++++++++++ 1 file changed, 17 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 323b6bdd..d1d67afa 100644 --- a/model/src/main/java/one/nem/lacerta/model/ListItem.java +++ b/model/src/main/java/one/nem/lacerta/model/ListItem.java @@ -10,6 +10,7 @@ public class ListItem { String description; ListItemType itemType; String itemId; + boolean isCombined; // Constructor @@ -20,6 +21,14 @@ public class ListItem { this.itemId = itemId; } + public ListItem(String title, String description, ListItemType itemType, String itemId, boolean isCombined) { + this.title = title; + this.description = description; + this.itemType = itemType; + this.itemId = itemId; + this.isCombined = isCombined; + } + public ListItem() { // Empty constructor } @@ -42,6 +51,10 @@ public class ListItem { return itemId; } + public boolean getIsCombined() { + return isCombined; + } + // Setter public void setTitle(String title) { @@ -60,4 +73,8 @@ public class ListItem { this.itemId = itemId; } + public void setIsCombined(boolean isCombined) { + this.isCombined = isCombined; + } + } From 435fe7b3ceceab9d082955f2d2425a659b8d547f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:47:08 +0900 Subject: [PATCH 51/69] =?UTF-8?q?hasCombined=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/model/ListItem.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 d1d67afa..b987b616 100644 --- a/model/src/main/java/one/nem/lacerta/model/ListItem.java +++ b/model/src/main/java/one/nem/lacerta/model/ListItem.java @@ -10,7 +10,7 @@ public class ListItem { String description; ListItemType itemType; String itemId; - boolean isCombined; + boolean hasCombined; // Constructor @@ -21,12 +21,12 @@ public class ListItem { this.itemId = itemId; } - public ListItem(String title, String description, ListItemType itemType, String itemId, boolean isCombined) { + public ListItem(String title, String description, ListItemType itemType, String itemId, boolean hasCombined) { this.title = title; this.description = description; this.itemType = itemType; this.itemId = itemId; - this.isCombined = isCombined; + this.hasCombined = hasCombined; } public ListItem() { @@ -51,8 +51,8 @@ public class ListItem { return itemId; } - public boolean getIsCombined() { - return isCombined; + public boolean getHasCombined() { + return hasCombined; } // Setter @@ -73,8 +73,8 @@ public class ListItem { this.itemId = itemId; } - public void setIsCombined(boolean isCombined) { - this.isCombined = isCombined; + public void setHasCombined(boolean hasCombined) { + this.hasCombined = hasCombined; } } From b7414cf8aa8adb679fce0a5cb7d72a0b49fe4668 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:47:21 +0900 Subject: [PATCH 52/69] =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/home/DocumentSelectListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java index 3d33367f..61c4f9d1 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/DocumentSelectListener.java @@ -1,5 +1,5 @@ package one.nem.lacerta.feature.home; public interface DocumentSelectListener { - void onDocumentSelect(String documentId, String documentName); + void onDocumentSelect(String documentId, String documentName, boolean hasCombined); } From 8052b9b32906c7ffcde129d6d538609eabc14d09 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:47:34 +0900 Subject: [PATCH 53/69] =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/feature/home/ListItemAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java index 80656ecb..9d45e261 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java @@ -46,7 +46,7 @@ public class ListItemAdapter extends RecyclerView.Adapter { - listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle()); + listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle(), listItem.getHasCombined()); }); } From aa2ee9462faae3df8afa2d599324d95ac34c9a67 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:47:48 +0900 Subject: [PATCH 54/69] =?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/feature/home/HomeTopFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java index 4ac6a93d..622e2dfe 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java @@ -85,11 +85,12 @@ public class HomeTopFragment extends Fragment { this.listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { @Override - public void onDocumentSelect(String documentId, String documentName) { + public void onDocumentSelect(String documentId, String documentName, boolean hasCombined) { Intent intent = new Intent(getContext(), ViewerMainActivity.class); Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName); intent.putExtra("documentId", documentId); intent.putExtra("documentName", documentName); + intent.putExtra("hasCombined", hasCombined); startActivity(intent, ActivityOptions.makeCustomAnimation(getContext(), one.nem.lacerta.shared.ui.R.anim.nav_up_enter_anim, one.nem.lacerta.shared.ui.R.anim.nav_up_exit_anim).toBundle()); } }); From 8270156373e77ca1f3e3f2b97980fe09e8e213f9 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:49:22 +0900 Subject: [PATCH 55/69] =?UTF-8?q?hasCombined=E3=82=92=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=8C=96=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 b3b27070..92a0610f 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 @@ -56,6 +56,7 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItem.setTitle(documentEntity.title); listItem.setDescription(DateFormat.getDateInstance().format(documentEntity.updatedAt)); listItem.setItemId(documentEntity.id); + listItem.setHasCombined(documentEntity.isCombineParent); listItems.add(listItem); } @@ -105,6 +106,7 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItem.setTitle(childFolderEntity.name); listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる listItem.setItemId(childFolderEntity.id); + listItem.setHasCombined(false); listItems.add(listItem); } @@ -117,6 +119,7 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItem.setTitle(documentEntity.title); listItem.setDescription(simpleDateFormat.format(documentEntity.updatedAt)); listItem.setItemId(documentEntity.id); + listItem.setHasCombined(documentEntity.isCombineParent); listItems.add(listItem); } @@ -166,6 +169,7 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItem.setTitle(childFolderEntity.name); listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる listItem.setItemId(childFolderEntity.id); + listItem.setHasCombined(false); listItems.add(listItem); } From c88ab85cf2c9f4d7dca5c278f7aa0f6b7da8955f Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:51:04 +0900 Subject: [PATCH 56/69] WIP --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 542fced8..b07f0167 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -80,6 +80,7 @@ public class ViewerContainerFragment extends Fragment { if (getArguments() != null){ documentId = getArguments().getString("documentId"); documentName = getArguments().getString("documentName"); + hasCombined = getArguments().getBoolean("hasCombined"); } } @@ -106,6 +107,7 @@ public class ViewerContainerFragment extends Fragment { initToolbar(toolbar, true, documentName); if (this.hasCombined) { + logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { viewerViewPagerAdapter @@ -114,6 +116,7 @@ public class ViewerContainerFragment extends Fragment { } }); } else { + logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); TabLayout tabLayout = view.findViewById(R.id.tab_layout); tabLayout.setVisibility(View.GONE); viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); From b3c1f3a949fea81e69d70f1ae42137044060b9ff Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:51:33 +0900 Subject: [PATCH 57/69] =?UTF-8?q?=E3=83=AD=E3=82=B0=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index b07f0167..9681b7dd 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -109,6 +109,7 @@ public class ViewerContainerFragment extends Fragment { if (this.hasCombined) { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { + logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), From 3a13b8e4b7df80332275a077aa837763f7f76a40 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:54:09 +0900 Subject: [PATCH 58/69] =?UTF-8?q?=E8=A6=AA=E8=A6=81=E7=B4=A0=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 9681b7dd..c868d27f 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -110,7 +110,8 @@ public class ViewerContainerFragment extends Fragment { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); - for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { + viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); // 親を追加 + for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { // 子を追加 viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), toxiDocumentModel.getTitleCache()); From 0210bcaeb6b8a8a24aacbcac4e4c9f67255fcbad Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:07:23 +0900 Subject: [PATCH 59/69] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/component/viewer/ViewerContainerFragment.java | 6 +++++- .../lacerta/component/viewer/ViewerViewPagerAdapter.java | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index c868d27f..220e23fe 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -13,6 +13,7 @@ import android.widget.Toast; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.tabs.TabLayout; +import com.google.android.material.tabs.TabLayoutMediator; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; @@ -102,6 +103,10 @@ public class ViewerContainerFragment extends Fragment { ViewerViewPagerAdapter viewerViewPagerAdapter = new ViewerViewPagerAdapter(requireActivity()); viewPager.setAdapter(viewerViewPagerAdapter); + // Init tab layout + TabLayout tabLayout = view.findViewById(R.id.tab_layout); + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); + // Init toolbar Toolbar toolbar = view.findViewById(R.id.toolbar); initToolbar(toolbar, true, documentName); @@ -119,7 +124,6 @@ public class ViewerContainerFragment extends Fragment { }); } else { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); - TabLayout tabLayout = view.findViewById(R.id.tab_layout); tabLayout.setVisibility(View.GONE); viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); } diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java index cdf742b0..e3f998fe 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerViewPagerAdapter.java @@ -1,6 +1,7 @@ package one.nem.lacerta.component.viewer; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; @@ -35,4 +36,9 @@ public class ViewerViewPagerAdapter extends FragmentStateAdapter { public int getItemCount() { return fragmentArrayList == null ? 0 : fragmentArrayList.size(); } + + @Nullable + public CharSequence getTabTitle(int position) { + return fragmentTitleList.get(position); + } } From 671718ba83a4ae38b08f6793cfb049268a581dcd Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:13:17 +0900 Subject: [PATCH 60/69] =?UTF-8?q?Combine=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/data/impl/LacertaLibraryImpl.java | 51 +++++++++++++------ 1 file changed, 35 insertions(+), 16 deletions(-) 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 92a0610f..e6c19bd9 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 @@ -8,6 +8,7 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.Objects; import java.util.UUID; @@ -301,32 +302,50 @@ public class LacertaLibraryImpl implements LacertaLibrary { } @Override - public CompletableFuture combineDocument(String parentId, String childId) { + public CompletableFuture combineDocument(String targetId1, String tagetId2) { return CompletableFuture.supplyAsync(() -> { - DocumentEntity parentDocumentEntity = database.documentDao().findById(parentId); - DocumentEntity childDocumentEntity = database.documentDao().findById(childId); - if (parentDocumentEntity == null || childDocumentEntity == null) { + DocumentEntity target1DocumentEntity = database.documentDao().findById(targetId1); + DocumentEntity target2DocumentEntity = database.documentDao().findById(tagetId2); + if (target1DocumentEntity == null || target2DocumentEntity == null) { logger.warn("LacertaLibraryImpl", "DocumentEntity is not found."); return null; } - parentDocumentEntity.isCombineParent = true; - childDocumentEntity.isCombineChild = true; - database.documentDao().update(parentDocumentEntity); - database.documentDao().update(childDocumentEntity); + target1DocumentEntity.isCombineChild = true; + target2DocumentEntity.isCombineChild = true; + database.documentDao().update(target1DocumentEntity); + database.documentDao().update(target2DocumentEntity); logger.debug("LacertaLibraryImpl", "Database Query: Updated DocumentEntity"); - ToxiDocumentEntity toxiDocumentEntity = new ToxiDocumentEntity(); - toxiDocumentEntity.parentDocumentId = parentId; - toxiDocumentEntity.childDocumentId = childId; - toxiDocumentEntity.order = 0; // TODO-rca: 並び順の概念をもたせる - toxiDocumentEntity.isActive = true; // TODO-rca: タブから非表示にできるようにする - toxiDocumentEntity.titleCache = childDocumentEntity.title; - database.toxiDocumentDao().insert(toxiDocumentEntity); - logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity"); + DocumentEntity parentDocumentEntity = new DocumentEntity(); + parentDocumentEntity.id = UUID.randomUUID().toString(); + parentDocumentEntity.title = target1DocumentEntity.title + "(Combined)"; + parentDocumentEntity.parentId = target1DocumentEntity.parentId; + parentDocumentEntity.author = target1DocumentEntity.author; // TODO-rca: Target1とTarget2の作者が異なる場合の処理 + // CombinedなDocumentはいま作成された と考える + parentDocumentEntity.createdAt = new Date(); + parentDocumentEntity.updatedAt = new Date(); + parentDocumentEntity.isCombineParent = true; + parentDocumentEntity.isCombineChild = false; + database.documentDao().insert(parentDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Inserted DocumentEntity"); + + insertCombineDocumentToxi(parentDocumentEntity.id, target1DocumentEntity.id, target1DocumentEntity.title); + insertCombineDocumentToxi(parentDocumentEntity.id, target2DocumentEntity.id, target2DocumentEntity.title); return null; }); } + private void insertCombineDocumentToxi(String parentId, String childId, String titleCache) { + ToxiDocumentEntity toxiDocumentEntity = new ToxiDocumentEntity(); + toxiDocumentEntity.parentDocumentId = parentId; + toxiDocumentEntity.childDocumentId = childId; + toxiDocumentEntity.order = 0; // TODO-rca: 並び順の概念をもたせる + toxiDocumentEntity.isActive = true; // TODO-rca: タブから非表示にできるようにする + toxiDocumentEntity.titleCache = titleCache; + database.toxiDocumentDao().insert(toxiDocumentEntity); + logger.debug("LacertaLibraryImpl", "Database Query: Inserted ToxiDocumentEntity"); + } + @Override public CompletableFuture uncombineDocument(String parentId, String childId) { return CompletableFuture.supplyAsync(() -> { From 47c647822784d6f1f7b5247b9e2329c2bd45aaba Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:13:47 +0900 Subject: [PATCH 61/69] =?UTF-8?q?Combine=E5=87=A6=E7=90=86=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=AB=E8=BF=BD=E5=BE=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 1 - 1 file changed, 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 220e23fe..555d8de7 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -115,7 +115,6 @@ public class ViewerContainerFragment extends Fragment { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); - viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); // 親を追加 for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { // 子を追加 viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), From 0dafecc75d2bbf65b82f8b602cd9394ee76b63be Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:13:53 +0900 Subject: [PATCH 62/69] =?UTF-8?q?Combine=E5=87=A6=E7=90=86=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=AB=E8=BF=BD=E5=BE=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/viewer/ViewerContainerFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 555d8de7..9d0740c5 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -115,7 +115,7 @@ public class ViewerContainerFragment extends Fragment { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); - for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { // 子を追加 + for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), toxiDocumentModel.getTitleCache()); From fa985b86bd7ed89f3cda9c72766098b9ddc15983 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:40:58 +0900 Subject: [PATCH 63/69] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/component/viewer/ViewerContainerFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 9d0740c5..19ab6bd1 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -105,7 +105,6 @@ public class ViewerContainerFragment extends Fragment { // Init tab layout TabLayout tabLayout = view.findViewById(R.id.tab_layout); - new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); // Init toolbar Toolbar toolbar = view.findViewById(R.id.toolbar); @@ -116,16 +115,22 @@ public class ViewerContainerFragment extends Fragment { lacertaLibrary.getCombinedDocumentToxiList(documentId).thenAccept(combinedDocumentToxiList -> { logger.debug("ViewerContainerFragment", "combinedDocumentToxiList: " + combinedDocumentToxiList.size()); for (ToxiDocumentModel toxiDocumentModel : combinedDocumentToxiList) { + logger.debug("ViewerContainerFragment", "titleCache: " + toxiDocumentModel.getTitleCache()); viewerViewPagerAdapter .addFragment(ViewerBodyFragment.newInstance(toxiDocumentModel.getChildDocumentId(), toxiDocumentModel.getTitleCache()), toxiDocumentModel.getTitleCache()); } + viewerViewPagerAdapter.notifyItemRangeChanged(0, combinedDocumentToxiList.size()); }); } else { logger.debug("ViewerContainerFragment", "hasCombined: " + hasCombined); tabLayout.setVisibility(View.GONE); viewerViewPagerAdapter.addFragment(ViewerBodyFragment.newInstance(documentId, documentName), documentName); + viewerViewPagerAdapter.notifyItemRangeChanged(0, 1); } + + // Attach tab layout to view pager + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); } /** From 457eabcdf4272bd8dbecdda02d42519b364243ca Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 14:57:41 +0900 Subject: [PATCH 64/69] =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=A0?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88?= =?UTF-8?q?=E4=BD=9C=E6=88=90=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/layout/viewer_custom_tab.xml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 component/viewer/src/main/res/layout/viewer_custom_tab.xml diff --git a/component/viewer/src/main/res/layout/viewer_custom_tab.xml b/component/viewer/src/main/res/layout/viewer_custom_tab.xml new file mode 100644 index 00000000..0dcc0c99 --- /dev/null +++ b/component/viewer/src/main/res/layout/viewer_custom_tab.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file From 6f9384039a155a0dc9f035c0d01a036b0ffb2def Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 15:01:51 +0900 Subject: [PATCH 65/69] =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=A0?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6=E3=83=88?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerContainerFragment.java | 10 +++++++++- .../src/main/res/layout/fragment_viewer_container.xml | 4 +++- .../viewer/src/main/res/layout/viewer_custom_tab.xml | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index 19ab6bd1..f85fca95 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -9,6 +9,7 @@ import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import android.widget.Toast; import com.google.android.material.dialog.MaterialAlertDialogBuilder; @@ -130,7 +131,14 @@ public class ViewerContainerFragment extends Fragment { } // Attach tab layout to view pager - new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> tab.setText(viewerViewPagerAdapter.getTabTitle(position))).attach(); + new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> { + View customView = LayoutInflater.from(getContext()).inflate(R.layout.viewer_custom_tab, null); + + TextView textView = customView.findViewById(R.id.tab_title); + textView.setText(viewerViewPagerAdapter.getTabTitle(position)); + + tab.setCustomView(customView); + }).attach(); } /** diff --git a/component/viewer/src/main/res/layout/fragment_viewer_container.xml b/component/viewer/src/main/res/layout/fragment_viewer_container.xml index 2be3e503..12ed3204 100644 --- a/component/viewer/src/main/res/layout/fragment_viewer_container.xml +++ b/component/viewer/src/main/res/layout/fragment_viewer_container.xml @@ -40,7 +40,9 @@ + android:layout_height="wrap_content" + app:tabMode="scrollable" + /> Date: Sun, 28 Jan 2024 15:03:27 +0900 Subject: [PATCH 66/69] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=AA=E3=82=BD=E3=83=BC=E3=82=B9=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/ui/src/main/res/drawable/more_vert_24px.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 shared/ui/src/main/res/drawable/more_vert_24px.xml diff --git a/shared/ui/src/main/res/drawable/more_vert_24px.xml b/shared/ui/src/main/res/drawable/more_vert_24px.xml new file mode 100644 index 00000000..fe1efeba --- /dev/null +++ b/shared/ui/src/main/res/drawable/more_vert_24px.xml @@ -0,0 +1,10 @@ + + + From fa9b86e90953eb47814c7930c8e8cbb07408181e Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 15:09:18 +0900 Subject: [PATCH 67/69] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/src/main/res/layout/viewer_custom_tab.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/component/viewer/src/main/res/layout/viewer_custom_tab.xml b/component/viewer/src/main/res/layout/viewer_custom_tab.xml index 08eaacbe..afa650cc 100644 --- a/component/viewer/src/main/res/layout/viewer_custom_tab.xml +++ b/component/viewer/src/main/res/layout/viewer_custom_tab.xml @@ -3,20 +3,23 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_gravity="center_vertical" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:layout_marginHorizontal="16dp"> + android:src="@drawable/more_vert_24px" + android:layout_gravity="center_vertical" /> \ No newline at end of file From 289f70c6cbc026d197c466b042c63a790e54e3da Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 15:13:20 +0900 Subject: [PATCH 68/69] =?UTF-8?q?=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=AB?= =?UTF-8?q?=E4=BB=AE=E3=81=AE=E3=83=AA=E3=82=B9=E3=83=8A=E3=83=BC=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 --- .../lacerta/component/viewer/ViewerContainerFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index f85fca95..7636eb97 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -9,6 +9,7 @@ import androidx.viewpager2.widget.ViewPager2; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; @@ -137,6 +138,11 @@ public class ViewerContainerFragment extends Fragment { TextView textView = customView.findViewById(R.id.tab_title); textView.setText(viewerViewPagerAdapter.getTabTitle(position)); + ImageButton imageButton = customView.findViewById(R.id.tab_modify); + imageButton.setOnClickListener(v -> { + Toast.makeText(getContext(), "Working!, Index:" + position, Toast.LENGTH_SHORT).show(); + }); + tab.setCustomView(customView); }).attach(); } From 8f0bdbb89a6956eb29a52e0935dad95b47c2a7fc Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 15:15:33 +0900 Subject: [PATCH 69/69] =?UTF-8?q?hasCombined=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/feature/library/DocumentSelectListener.java | 2 +- .../one/nem/lacerta/feature/library/LibraryPageFragment.java | 3 ++- .../java/one/nem/lacerta/feature/library/ListItemAdapter.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java index 5aa5294a..67dbc46f 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java @@ -2,5 +2,5 @@ package one.nem.lacerta.feature.library; public interface DocumentSelectListener { void onFolderSelected(String folderId, String folderName); - void onDocumentSelected(String documentId, String documentName); + void onDocumentSelected(String documentId, String documentName, boolean hasCombined); } diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java index e23d2089..7a37e9f1 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java @@ -164,11 +164,12 @@ public class LibraryPageFragment extends Fragment { } @Override - public void onDocumentSelected(String documentId, String documentName) { + public void onDocumentSelected(String documentId, String documentName, boolean hasCombined) { Intent intent = new Intent(getContext(), ViewerMainActivity.class); logger.debug("LibraryTopFragment", "Document selected! documentId: " + documentId + ", documentName: " + documentName); intent.putExtra("documentId", documentId); intent.putExtra("documentName", documentName); + intent.putExtra("hasCombined", hasCombined); startActivity(intent); } }); diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java index c28e61ec..57edf131 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java @@ -45,7 +45,7 @@ public class ListItemAdapter extends RecyclerView.Adapter { if (listItem.getItemType() == ListItemType.ITEM_TYPE_DOCUMENT) { - listener.onDocumentSelected(listItem.getItemId(), listItem.getTitle()); + listener.onDocumentSelected(listItem.getItemId(), listItem.getTitle(), listItem.getHasCombined()); } else if (listItem.getItemType() == ListItemType.ITEM_TYPE_FOLDER) { listener.onFolderSelected(listItem.getItemId(), listItem.getTitle());