From 9de39309bcda7efe1fb07b19f9f3f6bf6f65c88e Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:08:42 +0900 Subject: [PATCH 01/31] =?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 --- app/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index ae313899..039dc6c2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,4 +82,6 @@ dependencies { implementation project(':model') implementation project(':utils') + + implementation project(':component:scan') } \ No newline at end of file From a61de24931a1669ec0bb42d24aebfeb4a3316053 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:09:07 +0900 Subject: [PATCH 02/31] fix --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 039dc6c2..289d4f4f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -83,5 +83,5 @@ dependencies { implementation project(':utils') - implementation project(':component:scan') + implementation project(':component:scanner') } \ No newline at end of file From b9d81ab9974ee7343e9e57e8dde60fdf4fd06545 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:10:17 +0900 Subject: [PATCH 03/31] =?UTF-8?q?fab=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/one/nem/lacerta/MainActivity.java | 10 ++++++++++ app/src/main/res/layout/activity_main.xml | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index 725c1063..f74b20a7 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -10,6 +10,7 @@ import androidx.navigation.NavController; import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.ui.NavigationUI; +import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.util.Log; @@ -17,12 +18,14 @@ import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import one.nem.lacerta.component.scanner.ScannerManagerActivity; import one.nem.lacerta.model.FragmentNavigation; import one.nem.lacerta.model.pref.FeatureSwitchOverride; import one.nem.lacerta.utils.FeatureSwitch; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.bottomnavigation.BottomNavigationView; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.io.NotActiveException; @@ -74,6 +77,13 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio // Set status bar color getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface)); + // Fab + findViewById(R.id.scanFab).setOnClickListener(v -> { + Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(this.getApplicationContext(), ScannerManagerActivity.class); + startActivity(intent); + }); + } private void initializeApp() { Log.d("Init", "Initializing app"); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 59d77a93..a9df4099 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -34,4 +34,17 @@ app:layout_constraintStart_toStartOf="parent" app:menu="@menu/bottom_nav_menu" /> + + + + \ No newline at end of file From cd0c5e81c54d0bad5039f7043c067e0ffbb40e9a Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:10:30 +0900 Subject: [PATCH 04/31] =?UTF-8?q?margin=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_main.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a9df4099..ee667530 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -38,8 +38,8 @@ android:id="@+id/scanFab" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="24dp" - android:layout_marginBottom="24dp" + android:layout_marginEnd="32dp" + android:layout_marginBottom="32dp" android:clickable="true" app:layout_constraintBottom_toTopOf="@+id/bottom_nav" app:layout_constraintEnd_toEndOf="parent" From b11b78fa7f013961032dd29bdb74bfb0c2f18d87 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:11:38 +0900 Subject: [PATCH 05/31] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E7=94=A8=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 7 ------- 1 file changed, 7 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 2d5d1f93..1e2c56f7 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 @@ -38,13 +38,6 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture> getRecentDocument(int limit) { return CompletableFuture.supplyAsync(() -> { - // 5秒フリーズさせる - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - List documentEntities = database.documentDao().getRecentDocument(limit); ArrayList listItems = new ArrayList<>(); From 87099ae6939ceb647053ff0ea83b357b9cde7e8a Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:22:01 +0900 Subject: [PATCH 06/31] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88,=20ToolBar=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/feature/home/HomeTopFragment.java | 29 +++++++++++++++---- .../src/main/res/layout/fragment_home_top.xml | 2 +- 2 files changed, 25 insertions(+), 6 deletions(-) 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 a5d26c13..396c1dba 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 @@ -17,6 +17,7 @@ import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; +import androidx.navigation.Navigation; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -71,7 +72,6 @@ public class HomeTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home_top, container, false); - setHasOptionsMenu(true); return view; } @@ -81,6 +81,8 @@ public class HomeTopFragment extends Fragment { RecyclerView recyclerView = view.findViewById(R.id.home_item_recycler_view); + Toolbar toolbar = view.findViewById(R.id.home_toolbar); + toolbarSetup(toolbar, false, "ホーム"); ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { Log.d("HomeTopFragment", "onViewCreated: " + documentId); @@ -99,10 +101,27 @@ public class HomeTopFragment extends Fragment { }); } - @Override - public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { - inflater.inflate(R.menu.drawer_menu, menu); - super.onCreateOptionsMenu(menu, inflater); + /** + * ToolbarをInitする + * + * @param toolbar Toolbar + * @param showBackButton 戻るボタンを表示するか + * @param title タイトル + */ + private void toolbarSetup(Toolbar toolbar, boolean showBackButton, String title) { + getActivity().runOnUiThread(() -> { + if (showBackButton) { + toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); + toolbar.setNavigationOnClickListener(v -> { + //this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join(); + // Back + Navigation.findNavController(requireView()).popBackStack(); + }); + } else { + toolbar.setNavigationIcon(null); + } + toolbar.setTitle(title); + }); } } diff --git a/feature/home/src/main/res/layout/fragment_home_top.xml b/feature/home/src/main/res/layout/fragment_home_top.xml index 3fc0b723..e3b70845 100644 --- a/feature/home/src/main/res/layout/fragment_home_top.xml +++ b/feature/home/src/main/res/layout/fragment_home_top.xml @@ -29,7 +29,7 @@ app:layout_scrollFlags="scroll|exitUntilCollapsed"> Date: Tue, 23 Jan 2024 03:24:34 +0900 Subject: [PATCH 07/31] =?UTF-8?q?IndexOutOfBoundsException=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/feature/home/HomeTopFragment.java | 5 ++++- .../java/one/nem/lacerta/feature/home/ListItemAdapter.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 396c1dba..8d3dcc84 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 @@ -94,9 +94,12 @@ public class HomeTopFragment extends Fragment { recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> { + if (listItems == null) { + return; + } listItemAdapter.setListItems(listItems); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, listItems.size()); + listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); }); }); } 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 cf94a9e9..604ecf4b 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 @@ -54,7 +54,7 @@ public class ListItemAdapter extends RecyclerView.Adapter Date: Tue, 23 Jan 2024 03:38:58 +0900 Subject: [PATCH 08/31] =?UTF-8?q?=E6=8F=90=E5=87=BA=E7=94=A8:=20=E4=BB=A3?= =?UTF-8?q?=E6=9B=BF=E5=87=A6=E7=90=86=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/data/impl/LacertaLibraryImpl.java | 5 ++++- .../nem/lacerta/feature/home/HomeTopFragment.java | 11 +++++++++-- .../nem/lacerta/feature/home/ListItemAdapter.java | 6 +++++- .../feature/library/LibraryPageFragment.java | 15 +++++++++++---- .../java/one/nem/lacerta/utils/FeatureSwitch.java | 4 ++++ 5 files changed, 33 insertions(+), 8 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 1e2c56f7..5067f701 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.text.SimpleDateFormat; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; @@ -99,12 +100,14 @@ public class LacertaLibraryImpl implements LacertaLibrary { listItems.add(listItem); } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:"); + 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(simpleDateFormat.format(documentEntity.updatedAt)); listItem.setItemId(documentEntity.id); listItems.add(listItem); } 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 8d3dcc84..1bd83d56 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 @@ -36,7 +36,8 @@ import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.ListItem; import one.nem.lacerta.model.document.DocumentMeta; - +import one.nem.lacerta.utils.FeatureSwitch; +import one.nem.lacerta.utils.Store; /** @@ -99,7 +100,13 @@ public class HomeTopFragment extends Fragment { } listItemAdapter.setListItems(listItems); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); + Log.d("HomeTopFragment", "onViewCreated: " + listItems.size()); + if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + listItemAdapter.notifyDataSetChanged(); + } else { + // IndexOutOfBoundsExceptionを吐くことがあったので + listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); + } }); }); } 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 604ecf4b..73624b32 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 @@ -54,7 +54,11 @@ public class ListItemAdapter extends RecyclerView.Adapter { // TODO-rca: 実行条件を考える? - listItemAdapter.notifyItemRangeRemoved(0, this.libraryItemPage.getListItems().size() - 1); - }); + if (!FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + getActivity().runOnUiThread(() -> { // TODO-rca: 実行条件を考える? + listItemAdapter.notifyItemRangeRemoved(0, this.libraryItemPage.getListItems().size() - 1); + }); + } listItemAdapter.setLibraryItemPage(this.libraryItemPage); getActivity().runOnUiThread(() -> { - listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size() - 1); + if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { + listItemAdapter.notifyDataSetChanged(); + } else { + listItemAdapter.notifyItemRangeInserted(0, this.libraryItemPage.getListItems().size() - 1); + } }); }); } 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 91aab3eb..11cebefc 100644 --- a/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java +++ b/utils/src/main/java/one/nem/lacerta/utils/FeatureSwitch.java @@ -6,6 +6,10 @@ public class FeatureSwitch { public static boolean canOverrideSwitch = false; } + public static class RecyclerView { + public static boolean useSimpleNotifyMethod = true; + } + public static class FeatureMaster { public static boolean enableSearch = false; public static boolean enableDebugMenu = true; From 1a247d9b8b633de1f0e3c179ec68b1ea1d5d7297 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:43:45 +0900 Subject: [PATCH 09/31] =?UTF-8?q?Work=20In=20Progress=20=E3=83=AC=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=82=A6=E3=83=88=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/layout/fragment_setting_scan_page.xml | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml b/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml index 916f5abe..dd2eacee 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_scan_page.xml @@ -39,11 +39,40 @@ - + app:layout_behavior="@string/appbar_scrolling_view_behavior" > + + + + + + + + + + + From 0ef686399291b97356cc3cbc2401851119ee5705 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:44:18 +0900 Subject: [PATCH 10/31] =?UTF-8?q?=E6=9C=AA=E5=AE=9F=E8=A3=85=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=82=92Work=20In=20Progre?= =?UTF-8?q?ss=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/fragment_setting_about_page.xml | 79 +++++++++++++++++-- .../res/layout/fragment_setting_data_page.xml | 79 +++++++++++++++++-- .../layout/fragment_setting_display_page.xml | 79 +++++++++++++++++-- 3 files changed, 216 insertions(+), 21 deletions(-) diff --git a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml index a087b6ad..dd2eacee 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml index 0e55ea63..dd2eacee 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml index 0e6fd5bb..dd2eacee 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml @@ -1,14 +1,79 @@ - + android:background="@color/colorSurface"> - - + android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c731749233ae1de0ab1ea375495e52fc0906a0e4 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:46:30 +0900 Subject: [PATCH 11/31] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84?= =?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 --- .../setting/SettingScanPageFragment.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java index cad410b9..986fdb2e 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingScanPageFragment.java @@ -17,16 +17,16 @@ import android.view.ViewGroup; * Use the {@link SettingScanPageFragment#newInstance} factory method to * create an instance of this fragment. */ -public class SettingScanPageFragment extends PreferenceFragmentCompat { +public class SettingScanPageFragment extends Fragment { public SettingScanPageFragment() { // Required empty public constructor } - - @Override - public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { - addPreferencesFromResource(R.xml.scan_preferences); - } +// +// @Override +// public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { +//// addPreferencesFromResource(R.xml.scan_preferences); +// } public static SettingScanPageFragment newInstance() { SettingScanPageFragment fragment = new SettingScanPageFragment(); @@ -35,4 +35,15 @@ public class SettingScanPageFragment extends PreferenceFragmentCompat { return fragment; } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_setting_scan_page, container, false); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + } + } \ No newline at end of file From 1c71ac65459a7128f2cd569f6e724efad2f25747 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:47:40 +0900 Subject: [PATCH 12/31] =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/src/main/res/layout/fragment_setting_about_page.xml | 2 +- .../setting/src/main/res/layout/fragment_setting_data_page.xml | 2 +- .../src/main/res/layout/fragment_setting_display_page.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml index dd2eacee..2f6fc77d 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_about_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_about_page.xml @@ -33,7 +33,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" - app:title="@string/setting_top_scan_title" /> + app:title="@string/setting_top_about_title" /> diff --git a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml index dd2eacee..aeacef68 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_data_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_data_page.xml @@ -33,7 +33,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" - app:title="@string/setting_top_scan_title" /> + app:title="@string/setting_top_data_title" /> diff --git a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml index dd2eacee..dd09f3e6 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_display_page.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_display_page.xml @@ -33,7 +33,7 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_collapseMode="pin" - app:title="@string/setting_top_scan_title" /> + app:title="@string/setting_top_display_title" /> From b3d095fa405ba0afacac610d44cf2e4e2f34cf63 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:49:44 +0900 Subject: [PATCH 13/31] =?UTF-8?q?Drawable=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/drawable/create_new_folder_24px.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 shared/ui/src/main/res/drawable/create_new_folder_24px.xml diff --git a/shared/ui/src/main/res/drawable/create_new_folder_24px.xml b/shared/ui/src/main/res/drawable/create_new_folder_24px.xml new file mode 100644 index 00000000..cd2520f4 --- /dev/null +++ b/shared/ui/src/main/res/drawable/create_new_folder_24px.xml @@ -0,0 +1,10 @@ + + + From 8e2af0c9637f715e3345f47f7103a5cb6f135809 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:53:43 +0900 Subject: [PATCH 14/31] =?UTF-8?q?ToolBar,=20=E3=83=86=E3=82=AD=E3=82=B9?= =?UTF-8?q?=E3=83=88=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/feature/home/HomeTopFragment.java | 2 +- .../nem/lacerta/feature/library/LibraryPageFragment.java | 1 + feature/library/src/main/res/menu/dir_menu.xml | 6 +++--- feature/library/src/main/res/values/strings.xml | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) 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 1bd83d56..39a356ba 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 @@ -104,7 +104,7 @@ public class HomeTopFragment extends Fragment { if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { listItemAdapter.notifyDataSetChanged(); } else { - // IndexOutOfBoundsExceptionを吐くことがあったので + // IndexOutOfBoundsExceptionを吐くことがあったので いったん listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); } }); 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 c002164f..363121d5 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 @@ -276,6 +276,7 @@ public class LibraryPageFragment extends Fragment { toolbar.setNavigationIcon(null); } toolbar.setTitle(title); + toolbar.getMenu().clear(); toolbar.inflateMenu(R.menu.dir_menu); toolbar.setOnMenuItemClickListener(item -> { if (item.getItemId() == R.id.menu_item_create_new_folder) { diff --git a/feature/library/src/main/res/menu/dir_menu.xml b/feature/library/src/main/res/menu/dir_menu.xml index 451c94a4..e5cea78a 100644 --- a/feature/library/src/main/res/menu/dir_menu.xml +++ b/feature/library/src/main/res/menu/dir_menu.xml @@ -4,8 +4,8 @@ + android:icon="@drawable/create_new_folder_24px" + android:title="@string/create_new_folder" + app:showAsAction="never"/> \ No newline at end of file diff --git a/feature/library/src/main/res/values/strings.xml b/feature/library/src/main/res/values/strings.xml index 1049ca2d..d0ca5af4 100644 --- a/feature/library/src/main/res/values/strings.xml +++ b/feature/library/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ Library + 新しいフォルダを作成 \ No newline at end of file From 872bbd0f4ea9f7a805cf2f334d22b6460bb81039 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:07:05 +0900 Subject: [PATCH 15/31] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E5=90=8D=E3=82=92=E8=A1=A8=E7=A4=BA=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 --- .../viewer/ComponentViewerTopFragment.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index e3f71bb7..3a78dfad 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -23,6 +23,7 @@ import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.page.Page; +import one.nem.lacerta.utils.FeatureSwitch; import one.nem.lacerta.utils.LacertaLogger; /** @@ -42,15 +43,17 @@ public class ComponentViewerTopFragment extends Fragment { private static final String TAG = "ComponentViewerTopFragment"; private String documentId; + private String documentName; public ComponentViewerTopFragment() { // Required empty public constructor } - public static ComponentViewerTopFragment newInstance(String documentId) { + public static ComponentViewerTopFragment newInstance(String documentId, String documentName) { ComponentViewerTopFragment fragment = new ComponentViewerTopFragment(); Bundle args = new Bundle(); args.putString("documentId", documentId); + args.putString("documentName", documentName); fragment.setArguments(args); return fragment; } @@ -60,6 +63,7 @@ public class ComponentViewerTopFragment extends Fragment { super.onCreate(savedInstanceState); if (getArguments() != null) { documentId = getArguments().getString("documentId"); + String documentName = getArguments().getString("documentName"); } } @@ -71,7 +75,7 @@ public class ComponentViewerTopFragment extends Fragment { // Toolbar Toolbar toolbar = view.findViewById(R.id.toolbar); - toolbarSetup(toolbar, true, "Revision List"); + toolbarSetup(toolbar, true, this.documentName == null ? "Document" : this.documentName); RecyclerView recyclerView = view.findViewById(R.id.body_recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); @@ -80,12 +84,14 @@ public class ComponentViewerTopFragment extends Fragment { }); recyclerView.setAdapter(viewerBodyAdapter); + if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE); document.getDocument(documentId).thenAccept(documentDetail -> { ArrayList pages = documentDetail.getPages(); logger.debug(TAG, "pages.size(): " + pages.size()); viewerBodyAdapter.setPages(pages); getActivity().runOnUiThread(() -> { viewerBodyAdapter.notifyItemRangeChanged(0, pages.size()); + if (FeatureSwitch.Viewer.showProgressBarWhenLoading) view.findViewById(R.id.loading_progress_bar).setVisibility(View.GONE); }); }); @@ -104,9 +110,8 @@ public class ComponentViewerTopFragment extends Fragment { if (showBackButton) { toolbar.setNavigationIcon(one.nem.lacerta.shared.ui.R.drawable.arrow_back_24px); toolbar.setNavigationOnClickListener(v -> { - //this.libraryItemPage = lacertaLibrary.getLibraryPage(this.libraryItemPage.getParentId(), 10).join(); - // Back - Navigation.findNavController(requireView()).popBackStack(); + // Stop Activity + getActivity().finish(); }); } else { toolbar.setNavigationIcon(null); From 5df0c7ee5228d1ac4c37671478a7cd9fab7a6309 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:07:14 +0900 Subject: [PATCH 16/31] iroiro --- .../main/res/layout/fragment_component_viewer_top.xml | 10 ++++++++++ .../main/java/one/nem/lacerta/utils/FeatureSwitch.java | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml b/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml index 678d0418..6c8791de 100644 --- a/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml +++ b/component/viewer/src/main/res/layout/fragment_component_viewer_top.xml @@ -37,6 +37,16 @@ + + + Date: Tue, 23 Jan 2024 04:07:45 +0900 Subject: [PATCH 17/31] =?UTF-8?q?Bundle=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/component/viewer/ViewerMainActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 6ef85637..435e472c 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 @@ -35,6 +35,7 @@ public class ViewerMainActivity extends AppCompatActivity { // Variables private static final String TAG = "ViewerMainActivity"; String documentId; + String documentName; @Override protected void onCreate(Bundle savedInstanceState) { @@ -50,6 +51,7 @@ public class ViewerMainActivity extends AppCompatActivity { Intent intent = getIntent(); try { documentId = intent.getStringExtra("documentId"); + documentName = intent.getStringExtra("documentName"); } catch (Exception e) { logger.error(TAG, "Failed to get documentId from intent"); @@ -60,7 +62,7 @@ public class ViewerMainActivity extends AppCompatActivity { // Navigation getSupportFragmentManager().beginTransaction() - .replace(R.id.nav_host_fragment, ComponentViewerTopFragment.newInstance(documentId)) + .replace(R.id.nav_host_fragment, ComponentViewerTopFragment.newInstance(documentId, documentName)) .commit(); } } \ No newline at end of file From 9f50696b39008f094a1cedda8fcf33cb54ff1c38 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:13:02 +0900 Subject: [PATCH 18/31] =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E3=81=AB=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=88=E3=83=AB=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95?= =?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 --- .../viewer/ComponentViewerTopFragment.java | 2 +- .../feature/home/DocumentSelectListener.java | 2 +- .../nem/lacerta/feature/home/HomeTopFragment.java | 14 +++++++++----- .../nem/lacerta/feature/home/ListItemAdapter.java | 4 +--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index 3a78dfad..6e7951cb 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -63,7 +63,7 @@ public class ComponentViewerTopFragment extends Fragment { super.onCreate(savedInstanceState); if (getArguments() != null) { documentId = getArguments().getString("documentId"); - String documentName = getArguments().getString("documentName"); + documentName = getArguments().getString("documentName"); } } 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 852f8e98..3d33367f 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); + void onDocumentSelect(String documentId, String documentName); } 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 39a356ba..5fea2c36 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,15 @@ public class HomeTopFragment extends Fragment { Toolbar toolbar = view.findViewById(R.id.home_toolbar); toolbarSetup(toolbar, false, "ホーム"); - ListItemAdapter listItemAdapter = new ListItemAdapter(documentId -> { - Log.d("HomeTopFragment", "onViewCreated: " + documentId); - Intent intent = new Intent(getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", documentId); - startActivity(intent); + ListItemAdapter listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { + @Override + public void onDocumentSelect(String documentId, String documentName) { + Intent intent = new Intent(getContext(), ViewerMainActivity.class); + Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName); + intent.putExtra("documentId", documentId); + intent.putExtra("documentName", documentName); + startActivity(intent); + } }); recyclerView.setAdapter(listItemAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); 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 73624b32..80656ecb 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,9 +46,7 @@ public class ListItemAdapter extends RecyclerView.Adapter { - Intent intent = new Intent(v.getContext(), ViewerMainActivity.class); - intent.putExtra("documentId", listItem.getItemId()); - v.getContext().startActivity(intent); + listener.onDocumentSelect(listItem.getItemId(), listItem.getTitle()); }); } From da26641e2fe51440555c0a284adc453111469fa6 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:14:48 +0900 Subject: [PATCH 19/31] fix --- vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java index 63da3858..93d701d2 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java @@ -1,5 +1,6 @@ package one.nem.lacerta.vcs.impl; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -136,6 +137,7 @@ public class LacertaVcsImpl implements LacertaVcs { vcsRevModel.setId(vcsRevEntity.id); vcsRevModel.setDocumentId(vcsRevEntity.documentId); vcsRevModel.setBranchName(vcsRevEntity.branchName); + vcsRevModel.setCreatedAt(vcsRevEntity.createdAt); vcsRevModel.setCommitMessage(vcsRevEntity.commitMessage); vcsRevModel.setLogIds(vcsRevEntity.logIds); vcsRevModels.add(vcsRevModel); From cef688187a040c939dcb3df6fc65c19ddb4c78b7 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:17:03 +0900 Subject: [PATCH 20/31] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=83=86=E3=83=A0=E8=BF=BD=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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/component/viewer/src/main/res/menu/viewer_menu.xml b/component/viewer/src/main/res/menu/viewer_menu.xml index cc8a206d..5d301a09 100644 --- a/component/viewer/src/main/res/menu/viewer_menu.xml +++ b/component/viewer/src/main/res/menu/viewer_menu.xml @@ -4,4 +4,16 @@ android:id="@+id/action_open_vcs_rev_list" android:title="Open VCS Rev List" /> + + + + + + \ No newline at end of file From 29f745bb5c20362b7f59cfdd4657a6b07bfb96fd Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:20:34 +0900 Subject: [PATCH 21/31] =?UTF-8?q?=E3=83=AA=E3=83=8D=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/data/Document.java | 2 ++ .../one/nem/lacerta/data/impl/DocumentImpl.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/data/src/main/java/one/nem/lacerta/data/Document.java b/data/src/main/java/one/nem/lacerta/data/Document.java index cd38acfc..70610913 100644 --- a/data/src/main/java/one/nem/lacerta/data/Document.java +++ b/data/src/main/java/one/nem/lacerta/data/Document.java @@ -18,6 +18,8 @@ public interface Document { CompletableFuture createDocument(); + CompletableFuture renameDocument(String documentId, String name); + CompletableFuture deleteDocument(String documentId); CompletableFuture updateDocument(DocumentDetail detail); 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 888a47f6..7ee8511f 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 @@ -1,5 +1,7 @@ package one.nem.lacerta.data.impl; +import androidx.room.Update; + import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -124,6 +126,19 @@ public class DocumentImpl implements Document { }); } + @Override + public CompletableFuture renameDocument(String documentId, String name) { + return CompletableFuture.supplyAsync(() -> { + DocumentEntity documentEntity = database.documentDao().findById(documentId); + if (documentEntity == null) { + throw new IllegalArgumentException("documentId is not found"); + } + documentEntity.title = name; + database.documentDao().update(documentEntity); + return null; + }); + } + @Override public CompletableFuture getDocument(String documentId) { return CompletableFuture.supplyAsync(() -> { From 09c6d47a47aa107883e5705b79112d585085c2db Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:20:59 +0900 Subject: [PATCH 22/31] =?UTF-8?q?Delete=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/data/impl/DocumentImpl.java | 5 +++++ 1 file changed, 5 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 7ee8511f..7a303ec5 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 @@ -114,6 +114,11 @@ public class DocumentImpl implements Document { @Override public CompletableFuture deleteDocument(String documentId) { return CompletableFuture.supplyAsync(() -> { + DocumentEntity documentEntity = database.documentDao().findById(documentId); + if (documentEntity == null) { + throw new IllegalArgumentException("documentId is not found"); + } + database.documentDao().delete(documentEntity); return null; }); } From 06771d2e74f9cb1e8722b77a209452ec9ec5e6b8 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:27:20 +0900 Subject: [PATCH 23/31] =?UTF-8?q?Resume=E6=99=82=E3=81=AB=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=81=95=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 --- .../lacerta/feature/home/HomeTopFragment.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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 5fea2c36..943d2b31 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 @@ -51,6 +51,8 @@ public class HomeTopFragment extends Fragment { @Inject LacertaLibrary lacertaLibrary; + private ListItemAdapter listItemAdapter; + public HomeTopFragment() { // Required empty public constructor } @@ -85,7 +87,7 @@ public class HomeTopFragment extends Fragment { Toolbar toolbar = view.findViewById(R.id.home_toolbar); toolbarSetup(toolbar, false, "ホーム"); - ListItemAdapter listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { + this.listItemAdapter = new ListItemAdapter(new DocumentSelectListener() { @Override public void onDocumentSelect(String documentId, String documentName) { Intent intent = new Intent(getContext(), ViewerMainActivity.class); @@ -98,18 +100,29 @@ public class HomeTopFragment extends Fragment { recyclerView.setAdapter(listItemAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + updateList(); + } + + @Override + public void onResume() { + super.onResume(); + + updateList(); + } + + private void updateList() { lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> { if (listItems == null) { return; } - listItemAdapter.setListItems(listItems); + this.listItemAdapter.setListItems(listItems); getActivity().runOnUiThread(() -> { Log.d("HomeTopFragment", "onViewCreated: " + listItems.size()); if (FeatureSwitch.RecyclerView.useSimpleNotifyMethod) { - listItemAdapter.notifyDataSetChanged(); + this.listItemAdapter.notifyDataSetChanged(); } else { // IndexOutOfBoundsExceptionを吐くことがあったので いったん - listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); + this.listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1); } }); }); From 73c22717820746b6aabae93cb8ef3f217c218b03 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:28:18 +0900 Subject: [PATCH 24/31] =?UTF-8?q?rename=E3=81=A8=E3=81=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ComponentViewerTopFragment.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java index 6e7951cb..6e456d16 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ComponentViewerTopFragment.java @@ -1,5 +1,6 @@ package one.nem.lacerta.component.viewer; +import android.app.AlertDialog; import android.graphics.Bitmap; import android.os.Bundle; @@ -125,6 +126,49 @@ public class ComponentViewerTopFragment extends Fragment { .replace(R.id.nav_host_fragment, ViewerVcsRevListFragment.newInstance(documentId)) .commit(); return true; + } else if (item.getItemId() == R.id.action_rename) { + // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle("ファイル名の変更"); + builder.setMessage("ファイル名を入力してください"); + final android.widget.EditText input = new android.widget.EditText(getContext()); + input.setText(documentName); + builder.setView(input); + builder.setPositiveButton("作成", (dialog, which) -> { + document.renameDocument(documentId, input.getText().toString()).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + toolbar.setTitle(input.getText().toString()); + documentName = input.getText().toString(); + }); + }); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + builder.show(); + + return true; + } else if (item.getItemId() == R.id.action_delete) { + // TODO-rca: デザインをMaterial Design 3に合わせたカスタムダイアログにする + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); + builder.setTitle("ファイルの削除"); + builder.setMessage("ファイルを削除しますか?"); + builder.setPositiveButton("削除", (dialog, which) -> { + document.deleteDocument(documentId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + // Stop Activity + getActivity().finish(); + }); + }); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + builder.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; } From c5a0079812064869a053764f5fd4732db7a8cb0e Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:31:14 +0900 Subject: [PATCH 25/31] =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nem/lacerta/component/scanner/ScannerManagerActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java index bac0bd3c..2c11dfd7 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java @@ -121,7 +121,7 @@ public class ScannerManagerActivity extends AppCompatActivity { return true; } else if (item.getItemId() == R.id.action_insert_exist) { // 既存ドキュメントに挿入 - Toast.makeText(this, "挿入処理", Toast.LENGTH_SHORT).show(); + Toast.makeText(this, "Work in progress", Toast.LENGTH_SHORT).show(); insertToExistDocument(); return true; } else if (item.getItemId() == android.R.id.home) { @@ -139,7 +139,6 @@ public class ScannerManagerActivity extends AppCompatActivity { if (this.croppedImages.isEmpty()) { logger.debug(TAG, "this.resultImages is empty"); logger.e_code("7cb0584e-74ef-48ec-848a-c4d14e75e15a"); - // TODO-rca: なんかする } else { logger.debug(TAG, "this.resultImages is not empty"); updateResultView(this.croppedImages); From 18abe660313fa0429c6faa93bab76e9132855dac Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:31:41 +0900 Subject: [PATCH 26/31] Import Optimize --- .../lacerta/component/scanner/ScannerManagerActivity.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java index 2c11dfd7..dcfc89fa 100644 --- a/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java +++ b/component/scanner/src/main/java/one/nem/lacerta/component/scanner/ScannerManagerActivity.java @@ -3,16 +3,13 @@ package one.nem.lacerta.component.scanner; import android.app.ProgressDialog; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; -import android.util.Log; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import androidx.activity.EdgeToEdge; -import androidx.annotation.AnimatorRes; import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; @@ -28,11 +25,11 @@ import java.util.concurrent.CompletableFuture; import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.DocumentDetail; import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.processor.factory.DocumentProcessorFactory; import one.nem.lacerta.utils.LacertaLogger; -import one.nem.lacerta.data.Document; import one.nem.lacerta.vcs.factory.LacertaVcsFactory; @AndroidEntryPoint From ad05e3db44a4614a5ad32befb7d5cdf41ef06392 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:32:53 +0900 Subject: [PATCH 27/31] Import Optimize --- .../lacerta/feature/home/HomeTopFragment.java | 19 ------------------- 1 file changed, 19 deletions(-) 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 943d2b31..3d64657c 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 @@ -4,40 +4,21 @@ import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBarDrawerToggle; -import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; -import androidx.core.content.ContextCompat; -import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.navigation.Navigation; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CompletableFuture; - import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.viewer.ViewerMainActivity; -import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; -import one.nem.lacerta.model.ListItem; -import one.nem.lacerta.model.document.DocumentMeta; import one.nem.lacerta.utils.FeatureSwitch; -import one.nem.lacerta.utils.Store; /** From fc5ef3ed8f43ac088cc9cad9df07f719d54e12ea Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:33:33 +0900 Subject: [PATCH 28/31] Import Optimize --- .../one/nem/lacerta/feature/library/LibraryDocFragment.java | 4 ++++ .../java/one/nem/lacerta/feature/library/ListItemAdapter.java | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java index 1fc09f28..2f9b9771 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java @@ -1,5 +1,9 @@ package one.nem.lacerta.feature.library; +/* +Unused + */ + import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; 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 9d538716..c28e61ec 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 @@ -1,6 +1,5 @@ package one.nem.lacerta.feature.library; -import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -10,8 +9,6 @@ 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; import one.nem.lacerta.model.ListItemType; From 2821ad8552a8779a82c78c913bb7b7bf60b65552 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:33:57 +0900 Subject: [PATCH 29/31] Import Optimize --- .../java/one/nem/lacerta/setting/SettingTopFragment.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java index 9941f8aa..14b1bd06 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTopFragment.java @@ -1,16 +1,15 @@ package one.nem.lacerta.setting; import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; import androidx.core.content.ContextCompat; 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 java.util.ArrayList; import one.nem.lacerta.setting.model.SettingListItem; From f65732c42b91758cd8c059c71cab2d15bc127ba7 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 04:34:42 +0900 Subject: [PATCH 30/31] Import Optimize --- .../java/one/nem/lacerta/source/file/impl/FileManagerImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index 6077bf4e..753d137f 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -20,7 +20,6 @@ import javax.xml.transform.stream.StreamResult; import dagger.assisted.Assisted; import dagger.assisted.AssistedInject; import one.nem.lacerta.source.file.FileManager; - import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.Store; From 53c811470855fe9bc56e6e060fc95a6b755fe06f Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 05:11:57 +0900 Subject: [PATCH 31/31] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/library/LibraryDocFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java index 2f9b9771..1dd895ee 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryDocFragment.java @@ -1,7 +1,7 @@ package one.nem.lacerta.feature.library; /* -Unused +Currently, this file is not used in the app. */ import android.os.Bundle;