mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03: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
|
// Set status bar color
|
||||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
@Override
|
if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) {
|
||||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
||||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
|
||||||
// Collapsed
|
// Collapsed
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||||
} else if (verticalOffset == 0) {
|
} else if (verticalOffset == 0) {
|
||||||
// Expanded
|
// Expanded
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -119,19 +119,13 @@ public class LibraryPageFragment extends Fragment {
|
||||||
|
|
||||||
// Set status bar color
|
// Set status bar color
|
||||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
@Override
|
if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) {
|
||||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
||||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
|
||||||
// Collapsed
|
// Collapsed
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||||
} else if (verticalOffset == 0) {
|
} else if (verticalOffset == 0) {
|
||||||
// Expanded
|
// Expanded
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -90,19 +90,13 @@ public class SettingTopFragment extends Fragment {
|
||||||
|
|
||||||
// Set status bar color
|
// Set status bar color
|
||||||
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
AppBarLayout appBarLayout = view.findViewById(R.id.app_bar_layout);
|
||||||
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
|
appBarLayout.addOnOffsetChangedListener((appBarLayout1, verticalOffset) -> {
|
||||||
@Override
|
if (Math.abs(verticalOffset) == appBarLayout1.getTotalScrollRange()) {
|
||||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
|
||||||
if (Math.abs(verticalOffset) == appBarLayout.getTotalScrollRange()) {
|
|
||||||
// Collapsed
|
// Collapsed
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSecondaryContainer));
|
||||||
} else if (verticalOffset == 0) {
|
} else if (verticalOffset == 0) {
|
||||||
// Expanded
|
// Expanded
|
||||||
getActivity().getWindow().setStatusBarColor(ContextCompat.getColor(getContext(), one.nem.lacerta.shared.ui.R.color.colorSurface));
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user