From 6e4904967be16a1664450eab7ca511839f220e81 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 05:24:11 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/feature/home/HomeTopFragment.java | 20 +++++++------------ .../feature/library/LibraryPageFragment.java | 20 +++++++------------ .../lacerta/setting/SettingTopFragment.java | 20 +++++++------------ 3 files changed, 21 insertions(+), 39 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 64c5434b..e27bcfbd 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 @@ -61,19 +61,13 @@ public class HomeTopFragment extends Fragment { // Set status bar color 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(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); - } else if (verticalOffset == 0) { - // Expanded - getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); - } else { - // Somewhere in between - // Here you can add a color transition if you want - } + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); } }); return view; 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 d3aab1fb..fd9d3e89 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 @@ -119,19 +119,13 @@ public class LibraryPageFragment extends Fragment { // Set status bar color 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(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); - } else if (verticalOffset == 0) { - // Expanded - getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); - } else { - // Somewhere in between - // Here you can add a color transition if you want - } + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); } }); return view; 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 7b0b237d..6c789b17 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 @@ -90,19 +90,13 @@ public class SettingTopFragment extends Fragment { // Set status bar color 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(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); - } else if (verticalOffset == 0) { - // Expanded - getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); - } else { - // Somewhere in between - // Here you can add a color transition if you want - } + appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> { + if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) { + // Collapsed + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer)); + } else if (verticalOffset == 0) { + // Expanded + getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface)); } }); return view;