mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
リファクタリング
This commit is contained in:
parent
fda8adae80
commit
6e4904967b
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user