use of com.github.anrimian.musicplayer.ui.common.toolbar.AdvancedToolbar in project music-player by Anrimian.
the class ThemeSettingsFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
themeController = Components.getAppComponent().themeController();
AdvancedToolbar toolbar = requireActivity().findViewById(R.id.toolbar);
toolbar.setTitle(R.string.settings);
toolbar.setSubtitle(R.string.theme);
toolbar.setTitleClickListener(null);
slidrInterface = SlidrPanel.simpleSwipeBack(viewBinding.nsvContainer, this, toolbar::onStackFragmentSlided);
viewBinding.rvThemes.setLayoutManager(new GridLayoutManager(requireContext(), 2, RecyclerView.HORIZONTAL, false));
viewBinding.rvThemes.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
onAlbumsScrolled(viewBinding.rvThemes.computeHorizontalScrollOffset() == 0);
}
});
adapter = new ThemesAdapter(AppTheme.values(), themeController.getCurrentTheme(), this::onThemeClicked);
viewBinding.rvThemes.setAdapter(adapter);
setChecked(viewBinding.cbAutoNightMode, themeController.isAutoDarkThemeEnabled());
viewBinding.cbAutoNightMode.setOnCheckedChangeListener((v, isChecked) -> themeController.setAutoDarkModeEnabled(requireActivity(), isChecked));
}
use of com.github.anrimian.musicplayer.ui.common.toolbar.AdvancedToolbar in project music-player by Anrimian.
the class SettingsFragment method onFragmentMovedOnTop.
@Override
public void onFragmentMovedOnTop() {
AdvancedToolbar toolbar = requireActivity().findViewById(R.id.toolbar);
toolbar.setTitle(R.string.settings);
toolbar.setSubtitle(null);
toolbar.setTitleClickListener(null);
toolbar.clearOptionsMenu();
}
Aggregations