From c6fb06ffe2a27c12c96cecfb42286baea876224e Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 22 Jan 2024 01:17:57 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E3=82=B3=E3=83=94=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_main.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index cc3f088c..59d77a93 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -31,6 +31,7 @@ app:labelVisibilityMode="selected" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintStart_toStartOf="parent" + app:menu="@menu/bottom_nav_menu" /> \ No newline at end of file From b5beb7cc159ee474b5b2882a892342521519b18f Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 22 Jan 2024 01:20:55 +0900 Subject: [PATCH 02/11] =?UTF-8?q?Adapter=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/library/ListItemAdapter.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java 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 new file mode 100644 index 00000000..395e765a --- /dev/null +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/ListItemAdapter.java @@ -0,0 +1,73 @@ +package one.nem.lacerta.feature.library; + +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; + +import one.nem.lacerta.model.LibraryItemPage; +import one.nem.lacerta.model.ListItem; + +public class ListItemAdapter extends RecyclerView.Adapter{ + + LibraryItemPage libraryItemPage; + + DocumentSelectListener listener; + + public ListItemAdapter(DocumentSelectListener listener){ + this.libraryItemPage = new LibraryItemPage(); + this.listener = listener; + } + + public void setLibraryItemPage(LibraryItemPage libraryItemPage) { + this.libraryItemPage = libraryItemPage; + } + + @NonNull + @Override + public ListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(one.nem.lacerta.shared.ui.R.layout.common_list_item, parent, false); + return new ListItemViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull ListItemViewHolder holder, int position) { + ListItem listItem = libraryItemPage.getListItems().get(position); + holder.icon.setImageResource(listItem.getItemType().getIconId()); + holder.icon.setColorFilter(one.nem.lacerta.shared.ui.R.color.colorOnSurface); + holder.title.setText(listItem.getTitle()); + holder.description.setText(listItem.getDescription()); + + holder.itemView.setOnClickListener( v -> { +// Intent intent = new Intent(v.getContext(), ViewerMainActivity.class); +// intent.putExtra("documentId", listItem.getItemId()); +// v.getContext().startActivity(intent); + }); + } + + @Override + public int getItemCount() { + return libraryItemPage.getListItems().size(); + } + + public static class ListItemViewHolder extends RecyclerView.ViewHolder{ + + ImageView icon; + TextView title; + TextView description; + public ListItemViewHolder(@NonNull View itemView) { + super(itemView); + + icon = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_icon); + title = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_title); + description = itemView.findViewById(one.nem.lacerta.shared.ui.R.id.item_description); + } + } +} From 1c6878c3fdad8a662a64722fde90703df4940668 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 22 Jan 2024 01:21:00 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/feature/library/DocumentSelectListener.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java 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 new file mode 100644 index 00000000..94ebe0bc --- /dev/null +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentSelectListener.java @@ -0,0 +1,5 @@ +package one.nem.lacerta.feature.library; + +public interface DocumentSelectListener { + void onDocumentSelect(String documentId); +} From 42f6bc17d37d0ce7edbbb05f693a6ae69d292193 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 22 Jan 2024 01:21:10 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E3=82=B3=E3=83=94=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/fragment_library_top.xml | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/feature/library/src/main/res/layout/fragment_library_top.xml b/feature/library/src/main/res/layout/fragment_library_top.xml index b0d824e5..89a2538a 100644 --- a/feature/library/src/main/res/layout/fragment_library_top.xml +++ b/feature/library/src/main/res/layout/fragment_library_top.xml @@ -1,32 +1,50 @@ - - + android:background="@color/colorSurface"> - + android:layout_height="match_parent"> - + - \ No newline at end of file + + + + + + + + + + + + + \ No newline at end of file From 5f9ea732cf037b3838f8a010f8a6eb8999748cd9 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 22 Jan 2024 01:24:55 +0900 Subject: [PATCH 05/11] =?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 --- .../feature/library/LibraryTopFragment.java | 101 ++++++++++-------- 1 file changed, 56 insertions(+), 45 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index cebe2f31..48db1876 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -3,6 +3,9 @@ package one.nem.lacerta.feature.library; import android.os.Bundle; import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -15,6 +18,9 @@ import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.appbar.CollapsingToolbarLayout; + import java.util.ArrayList; import java.util.List; @@ -22,6 +28,7 @@ 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.DocumentMeta; import one.nem.lacerta.model.document.tag.DocumentTag; @@ -35,36 +42,15 @@ import one.nem.lacerta.model.document.tag.DocumentTag; @AndroidEntryPoint public class LibraryTopFragment extends Fragment { -// @Inject -// Document document; - - // 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; + @Inject + LacertaLibrary lacertaLibrary; public LibraryTopFragment() { // 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 LibraryTopFragment. - */ - // TODO: Rename and change types and number of parameters - public static LibraryTopFragment newInstance(String param1, String param2) { + public static LibraryTopFragment newInstance() { LibraryTopFragment fragment = new LibraryTopFragment(); Bundle args = new Bundle(); - args.putString(ARG_PARAM1, param1); - args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @@ -72,10 +58,6 @@ public class LibraryTopFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); - } } @@ -84,23 +66,52 @@ public class LibraryTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_library_top, container, false); - // Use view.findViewById instead of findViewById - RecyclerView documentRecyclerView = view.findViewById(R.id.document_list); - - LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); - documentRecyclerView.setLayoutManager(layoutManager); - - //データを取得 - -// List metas = document.getAllDocumentMetas(100); - -// Toast.makeText(getContext(), "Documents: " + Integer.toString(metas.size()), Toast.LENGTH_LONG).show(); - -// Create and set the adapter -// DocumentAdapter adapter = new DocumentAdapter(metas); -// documentRecyclerView.setAdapter(adapter); - -// Use a LinearLayoutManager to specify the layout return view; } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + RecyclerView recyclerView = view.findViewById(R.id.library_item_recycler_view); + + ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { + Toast.makeText(getContext(), documentId, Toast.LENGTH_SHORT).show(); + }); + recyclerView.setAdapter(listItemAdapter); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + + lacertaLibrary.getLibraryPage(10).thenAccept(libraryItemPage -> { + listItemAdapter.setLibraryItemPage(libraryItemPage); + getActivity().runOnUiThread(() -> { + listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size()); + }); + }); + + CollapsingToolbarLayout collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar); + Toolbar toolbar = view.findViewById(R.id.toolbar); + + // Set the Toolbar + ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); + + // Set the title of the CollapsingToolbarLayout + collapsingToolbarLayout.setTitle("Library"); + + AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout); + appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { + @Override + public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { + if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getActivity(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getActivity(), one.nem.lacerta.shared.ui.R.color.colorSurface)); + } else { + // Somewhere in between + // Here you can add a color transition if you want + } + } + }); + } } From bb7b628d2ff688a10f4f153112044648d9d4599a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 10:00:17 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=E5=A3=8A=E3=82=8C=E3=81=9F=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/LibraryArchiveFragment.java | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java deleted file mode 100644 index 0867fa0e..00000000 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryArchiveFragment.java +++ /dev/null @@ -1,38 +0,0 @@ -package one.nem.lacerta.feature.library; - -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.TextView; - -import androidx.appcompat.app.AppCompatActivity; - -// LibraryArchiveFragment.java - -//画面変移用のコード -//Fragmentへのデータの受け渡し機能 -public class LibraryArchiveFragment extends AppCompatActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_library_top); - - // ここに入力された内容を表示する機能 - TextView textView = findViewById(R.id.document_list); - - textView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - // 文字をタップしたときの処理 - - // 移動先のアクティビティを指定 - Intent intent = new Intent(LibraryArchiveFragment.this, LibraryDocFragment.class); - - // データを付加する - intent.putExtra("key_name", "value_data"); - - startActivity(intent); - } - }); - } -} From 3130be88be02d5815d05e6b5e0eb112e2e3a7bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 10:12:21 +0900 Subject: [PATCH 07/11] =?UTF-8?q?getLibraryPage=E5=AE=9F=E8=A3=85WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/data/impl/LacertaLibraryImpl.java | 42 ++++++++++++++++++- .../source/database/dao/DocumentDao.java | 1 + .../source/database/dao/FolderDao.java | 6 +++ 3 files changed, 48 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 e9ecee78..e080f7d0 100644 --- a/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java +++ b/data/src/main/java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java @@ -1,6 +1,7 @@ package one.nem.lacerta.data.impl; import java.text.DateFormat; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -16,6 +17,7 @@ import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.source.database.LacertaDatabase; 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.utils.LacertaLogger; public class LacertaLibraryImpl implements LacertaLibrary { @@ -60,10 +62,48 @@ public class LacertaLibraryImpl implements LacertaLibrary { return null; // TODO-rca: Implement } + // Internal + private CompletableFuture> getFolderEntitiesByPublicPath(String publicPath) { + return CompletableFuture.supplyAsync(() -> { + return database.folderDao().findByPublicPathWithLimit(publicPath, 10); // TODO-rca: ハードコーディングやめる + }); + } + + private CompletableFuture> getDocumentEntitiesByPublicPath(String publicPath) { + return CompletableFuture.supplyAsync(() -> { + return database.documentDao().findByPublicPathWithLimit(publicPath, 10); // TODO-rca: ハードコーディングやめる + }); + } + @Override public CompletableFuture getLibraryPage(int limit) { return CompletableFuture.supplyAsync(() -> { - return null; + LibraryItemPage libraryItemPage = new LibraryItemPage(); + + List folderEntities = getFolderEntitiesByPublicPath("/").join(); + List documentEntities = getDocumentEntitiesByPublicPath("/").join(); + + ArrayList listItems = new ArrayList<>(); + for (FolderEntity folderEntity : folderEntities) { + ListItem listItem = new ListItem(); + listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); + listItem.setTitle(folderEntity.name); + listItem.setDescription("フォルダ"); // TODO-rca: ハードコーディングやめる + listItem.setItemId(folderEntity.id); + listItems.add(listItem); + } + for (DocumentEntity documentEntity : documentEntities) { + ListItem listItem = new ListItem(); + listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); + listItem.setTitle(documentEntity.title); + listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant())); + listItem.setItemId(documentEntity.id); + listItems.add(listItem); + } + + libraryItemPage.setListItems(listItems); + + return libraryItemPage; }); } 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 802afb7f..f5f1eb61 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 @@ -6,6 +6,7 @@ import androidx.room.Insert; import androidx.room.Query; import androidx.room.Update; +import java.util.ArrayList; import java.util.List; import one.nem.lacerta.source.database.entity.DocumentEntity; diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java index 1d429245..451854e5 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java @@ -4,6 +4,9 @@ import androidx.room.Dao; import androidx.room.Insert; import androidx.room.Query; +import java.util.ArrayList; +import java.util.List; + import one.nem.lacerta.source.database.entity.FolderEntity; @Dao @@ -15,6 +18,9 @@ public interface FolderDao { @Query("SELECT * FROM Folder WHERE public_path = :publicPath") FolderEntity findByPublicPath(String publicPath); + @Query("SELECT * FROM Folder WHERE public_path = :publicPath LIMIT :limit") + List findByPublicPathWithLimit(String publicPath, int limit); + @Insert void insert(FolderEntity folderEntity); From 93b833f7a9f002598f3a34750ff85b099c0da655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 10:20:38 +0900 Subject: [PATCH 08/11] =?UTF-8?q?null=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AF0?= =?UTF-8?q?=E3=82=92=E8=BF=94=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 --- .../one/nem/lacerta/feature/library/ListItemAdapter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 395e765a..e47c465f 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 @@ -21,8 +21,8 @@ public class ListItemAdapter extends RecyclerView.Adapter Date: Mon, 22 Jan 2024 10:23:08 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=E4=BE=9D=E5=AD=98=E9=96=A2=E4=BF=82?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/library/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feature/library/build.gradle b/feature/library/build.gradle index c455886d..fa18f9bc 100644 --- a/feature/library/build.gradle +++ b/feature/library/build.gradle @@ -51,5 +51,7 @@ dependencies { implementation project(':data') + implementation project(':utils') + } \ No newline at end of file From 2f3a3315275d7d56e5f3147ab89a6e58d1a812d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 10:31:09 +0900 Subject: [PATCH 10/11] =?UTF-8?q?FeatureSwitch=E5=88=87=E3=82=8A=E6=9B=BF?= =?UTF-8?q?=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java index 1c198478..f2b6f742 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java +++ b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java @@ -3,12 +3,12 @@ package one.nem.lacerta.utils; public class FeatureSwitch { public static class Meta { - public static boolean canOverrideSwitch = true; + public static boolean canOverrideSwitch = false; } public static class FeatureMaster { public static boolean enableSearch = true; - public static boolean enableDebugMenu = false; + public static boolean enableDebugMenu = true; } public static class Setting { From 01f28ecd4dfb7f6f48cb6dc67f87d23a2dedfd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 22 Jan 2024 10:31:26 +0900 Subject: [PATCH 11/11] =?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=82=92=E6=AD=A3=E5=B8=B8=E3=81=AB=E5=8F=96?= =?UTF-8?q?=E5=BE=97=E3=81=A7=E3=81=8D=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 --- .../one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 10 +++++++++- .../lacerta/feature/library/LibraryTopFragment.java | 7 ++++++- 2 files changed, 15 insertions(+), 2 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 e080f7d0..809c6f75 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 @@ -81,10 +81,13 @@ public class LacertaLibraryImpl implements LacertaLibrary { LibraryItemPage libraryItemPage = new LibraryItemPage(); List folderEntities = getFolderEntitiesByPublicPath("/").join(); + logger.debug("LacertaLibraryImpl", "folderEntities.size(): " + folderEntities.size()); List documentEntities = getDocumentEntitiesByPublicPath("/").join(); + logger.debug("LacertaLibraryImpl", "documentEntities.size(): " + documentEntities.size()); ArrayList listItems = new ArrayList<>(); for (FolderEntity folderEntity : folderEntities) { + logger.debug("LacertaLibraryImpl", "folderEntity.name: " + folderEntity.name); ListItem listItem = new ListItem(); listItem.setItemType(ListItemType.ITEM_TYPE_FOLDER); listItem.setTitle(folderEntity.name); @@ -93,16 +96,21 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItems.add(listItem); } for (DocumentEntity documentEntity : documentEntities) { + logger.debug("LacertaLibraryImpl", "documentEntity.title: " + documentEntity.title); ListItem listItem = new ListItem(); listItem.setItemType(ListItemType.ITEM_TYPE_DOCUMENT); listItem.setTitle(documentEntity.title); - listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant())); +// listItem.setDescription(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm").format(documentEntity.updatedAt.toInstant())); listItem.setItemId(documentEntity.id); listItems.add(listItem); } + libraryItemPage.setPageTitle("/"); + libraryItemPage.setPageId("root"); libraryItemPage.setListItems(listItems); + logger.debug("LacertaLibraryImpl", "libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); + return libraryItemPage; }); } diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 48db1876..bb36392e 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -31,6 +31,7 @@ import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.model.document.tag.DocumentTag; +import one.nem.lacerta.utils.LacertaLogger; @@ -45,6 +46,9 @@ public class LibraryTopFragment extends Fragment { @Inject LacertaLibrary lacertaLibrary; + @Inject + LacertaLogger logger; + public LibraryTopFragment() { // Required empty public constructor } @@ -82,9 +86,10 @@ public class LibraryTopFragment extends Fragment { recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); lacertaLibrary.getLibraryPage(10).thenAccept(libraryItemPage -> { + logger.debug("LibraryTopFragment", "Item selected! libraryItemPage.getListItems().size(): " + libraryItemPage.getListItems().size()); listItemAdapter.setLibraryItemPage(libraryItemPage); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size()); + listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1); }); });