Search in sources :

Example 6 with AdvancedToolbar

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));
}
Also used : ThemesAdapter(com.github.anrimian.musicplayer.ui.settings.themes.view.ThemesAdapter) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) AdvancedToolbar(com.github.anrimian.musicplayer.ui.common.toolbar.AdvancedToolbar)

Example 7 with AdvancedToolbar

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();
}
Also used : AdvancedToolbar(com.github.anrimian.musicplayer.ui.common.toolbar.AdvancedToolbar)

Aggregations

AdvancedToolbar (com.github.anrimian.musicplayer.ui.common.toolbar.AdvancedToolbar)7 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 DisplaySettingsFragment (com.github.anrimian.musicplayer.ui.settings.display.DisplaySettingsFragment)1 ExcludedFolderAdapter (com.github.anrimian.musicplayer.ui.settings.folders.view.ExcludedFolderAdapter)1 HeadsetSettingsFragment (com.github.anrimian.musicplayer.ui.settings.headset.HeadsetSettingsFragment)1 LibrarySettingsFragment (com.github.anrimian.musicplayer.ui.settings.library.LibrarySettingsFragment)1 PlayerSettingsFragment (com.github.anrimian.musicplayer.ui.settings.player.PlayerSettingsFragment)1 ThemeSettingsFragment (com.github.anrimian.musicplayer.ui.settings.themes.ThemeSettingsFragment)1 ThemesAdapter (com.github.anrimian.musicplayer.ui.settings.themes.view.ThemesAdapter)1 FragmentNavigation (com.github.anrimian.musicplayer.ui.utils.fragments.navigation.FragmentNavigation)1 RxPermissions (com.tbruyelle.rxpermissions3.RxPermissions)1