From 6d0b24eb70a59b84430333b37eb1f9be7a1e67a6 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:54:51 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E7=A7=BB=E6=A4=8D=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_main.xml | 77 ++++++++++++++--------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 59d77a93..f904a958 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,37 +1,54 @@ - - + android:background="@color/colorSurface"> - + - + - \ No newline at end of file + + + + + + + + + + + + \ No newline at end of file From 0eadc3c3d55a1b3e91588d453dae5788147718b6 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:56:19 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=E3=83=AC=E3=82=A4=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E7=A7=BB=E6=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_main.xml | 31 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f904a958..0b4db6d9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,4 +1,4 @@ - + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/bottom_nav" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> + - \ No newline at end of file + + + \ No newline at end of file From a2ed78dfb8bb07049693b1e36eabd5580da5256d 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:58:52 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=91=E3=83=86?= =?UTF-8?q?=E3=82=A3=E8=BF=BD=E5=8A=A0?= 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 0b4db6d9..262b305b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -52,7 +52,8 @@ android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/main_nav" - tools:layout="@layout/fragment_home_top" /> + tools:layout="@layout/fragment_home_top" + app:layout_behavior="@string/appbar_scrolling_view_behavior"/> From 5752e3285bb3835bee632c32207de3e988cc3c72 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 11:01:57 +0900 Subject: [PATCH 04/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/layout/fragment_home_top.xml | 47 ++----------------- 1 file changed, 4 insertions(+), 43 deletions(-) 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..73850323 100644 --- a/feature/home/src/main/res/layout/fragment_home_top.xml +++ b/feature/home/src/main/res/layout/fragment_home_top.xml @@ -1,50 +1,11 @@ + android:layout_height="match_parent"> - - - - - - - - - - - - - - - + android:layout_height="match_parent" /> \ No newline at end of file From e1129bc0093e96edbbe1ede7c5a94cb9413b74de 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 11:02:01 +0900 Subject: [PATCH 05/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../one/nem/lacerta/feature/library/LibraryTopFragment.java | 2 ++ 1 file changed, 2 insertions(+) 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 bb36392e..27ebea25 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 @@ -11,6 +11,8 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; From fafb99645348f1a81087ff52b7cfb8753019b8c0 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 11:02:08 +0900 Subject: [PATCH 06/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/feature/home/HomeTopFragment.java | 26 ------------------- 1 file changed, 26 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 eab1bf05..6070f726 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 @@ -95,32 +95,6 @@ public class HomeTopFragment extends Fragment { listItemAdapter.notifyItemRangeInserted(0, listItems.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("Lacerta"); - - 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 50dfb9be8b51136024e3be1d224484061d08b9e0 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 11:03:14 +0900 Subject: [PATCH 07/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/fragment_library_top.xml | 47 ++----------------- 1 file changed, 4 insertions(+), 43 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 89a2538a..06e32e35 100644 --- a/feature/library/src/main/res/layout/fragment_library_top.xml +++ b/feature/library/src/main/res/layout/fragment_library_top.xml @@ -1,50 +1,11 @@ + android:layout_height="match_parent"> - - - - - - - - - - - - - - - + android:layout_height="match_parent" /> \ No newline at end of file From ad3a600e8cc8a9ae8d72ebf710dc7de4a93d3341 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 11:03:44 +0900 Subject: [PATCH 08/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/library/LibraryTopFragment.java | 26 ------------------- 1 file changed, 26 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 27ebea25..5ac527f8 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 @@ -94,31 +94,5 @@ public class LibraryTopFragment extends Fragment { listItemAdapter.notifyItemRangeInserted(0, libraryItemPage.getListItems().size() - 1); }); }); - - 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 0b33c60a5a05e9c20f77c9b211cfa7ade1587f59 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 11:04:21 +0900 Subject: [PATCH 09/12] =?UTF-8?q?ToolBar=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/fragment_setting_top.xml | 47 ++----------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/feature/setting/src/main/res/layout/fragment_setting_top.xml b/feature/setting/src/main/res/layout/fragment_setting_top.xml index ee8463ca..032d6463 100644 --- a/feature/setting/src/main/res/layout/fragment_setting_top.xml +++ b/feature/setting/src/main/res/layout/fragment_setting_top.xml @@ -1,50 +1,11 @@ + android:layout_height="match_parent"> - - - - - - - - - - - - - - - + android:layout_height="match_parent" /> \ No newline at end of file From d6f4885b4a5f8ebc8a1d2bcb25aa9f3a0bd87408 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 11:08:48 +0900 Subject: [PATCH 10/12] iroiro --- .../one/nem/lacerta/data/impl/LacertaLibraryImpl.java | 8 ++++++++ 1 file changed, 8 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 809c6f75..7fcf9cb5 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 @@ -78,6 +78,14 @@ public class LacertaLibraryImpl implements LacertaLibrary { @Override public CompletableFuture getLibraryPage(int limit) { return CompletableFuture.supplyAsync(() -> { + + // 5秒フリーズさせる + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + LibraryItemPage libraryItemPage = new LibraryItemPage(); List folderEntities = getFolderEntitiesByPublicPath("/").join(); From 05997eafe17d177c3c443a99c54a88843a3e2abf 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 11:26:11 +0900 Subject: [PATCH 11/12] =?UTF-8?q?=E3=83=95=E3=83=A9=E3=82=B0=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=81=8B=E3=82=89ToolBar=E3=81=AE=E3=82=A2?= =?UTF-8?q?=E3=82=A4=E3=83=86=E3=83=A0=E3=82=92=E5=88=B6=E5=BE=A1=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/MainActivity.java | 36 +++++++++++++++++++ .../lacerta/feature/home/HomeTopFragment.java | 8 +++++ 2 files changed, 44 insertions(+) diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index 84d15b35..66985ad0 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -1,6 +1,7 @@ package one.nem.lacerta; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentManager; import androidx.navigation.NavController; @@ -17,6 +18,7 @@ import android.widget.Toast; 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; @@ -68,6 +70,40 @@ public class MainActivity extends AppCompatActivity { // Set status bar color getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface)); + + // Set app bar color + AppBarLayout appBarLayout = 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 + getWindow().setStatusBarColor(ContextCompat.getColor(getApplicationContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getWindow().setStatusBarColor(ContextCompat.getColor(getApplicationContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); + } else { + // Somewhere in between + // Here you can add a color transition if you want + } + } + }); + + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + } + + // Public + public void setActionBarTitle(String title) { + getSupportActionBar().setTitle(title); + } + + public void setActionBarBackButton(boolean isEnabled) { + getSupportActionBar().setDisplayHomeAsUpEnabled(isEnabled); + } + + public void setActionBarMenuItem(int itemId, boolean isEnabled) { + } private void initializeApp() { 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 6070f726..a5d26c13 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 @@ -10,6 +10,7 @@ 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; @@ -70,6 +71,7 @@ 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; } @@ -96,6 +98,12 @@ 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); + } } From 153242ef663919494ee515ae311a2381a093f0da 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 11:27:56 +0900 Subject: [PATCH 12/12] WIP --- .../lacerta/feature/library/LibraryTopFragment.java | 8 ++++++++ feature/library/src/main/res/menu/dir_menu.xml | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 feature/library/src/main/res/menu/dir_menu.xml 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 5ac527f8..8dd366d8 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 @@ -72,6 +72,8 @@ public class LibraryTopFragment extends Fragment { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_library_top, container, false); + setHasOptionsMenu(true); + return view; } @@ -95,4 +97,10 @@ public class LibraryTopFragment extends Fragment { }); }); } + + @Override + public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { + inflater.inflate(R.menu.dir_menu, menu); + super.onCreateOptionsMenu(menu, inflater); + } } diff --git a/feature/library/src/main/res/menu/dir_menu.xml b/feature/library/src/main/res/menu/dir_menu.xml new file mode 100644 index 00000000..451c94a4 --- /dev/null +++ b/feature/library/src/main/res/menu/dir_menu.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file