com.kabouzeid.appthemehelper.ThemeStore Java Examples

The following examples show how to use com.kabouzeid.appthemehelper.ThemeStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FoldersFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMultipleItemAction(MenuItem item, ArrayList<File> files) {
    final int itemId = item.getItemId();
    new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> {
        if (!songs.isEmpty()) {
            SongsMenuHelper.handleMenuClick(getActivity(), songs, itemId);
        }
        if (songs.size() != files.size()) {
            Snackbar.make(coordinatorLayout, R.string.some_files_are_not_listed_in_the_media_store, Snackbar.LENGTH_LONG)
                    .setAction(R.string.action_scan, v -> {
                        String[] paths = new String[files.size()];
                        for (int i = 0; i < files.size(); i++) {
                            paths[i] = FileUtil.safeGetCanonicalPath(files.get(i));
                        }
                        scanPaths(paths);
                    })
                    .setActionTextColor(ThemeStore.accentColor(getActivity()))
                    .show();
        }
    }).execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
}
 
Example #2
Source File: PlayerPlaybackControlsFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setDark(int dark) {
    int color = ATHUtil.resolveColor(getActivity(), android.R.attr.colorBackground);
    if (ColorUtil.isColorLight(color)) {
        lastPlaybackControlsColor = MaterialValueHelper
                .getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper
                .getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper
                .getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper
                .getPrimaryDisabledTextColor(getActivity(), false);
    }

    if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
        TintHelper.setTintAuto(playPauseFab, dark, true);
        setProgressBarColor(progressSlider, dark);
        text.setTextColor(dark);
    } else {
        text.setTextColor(ThemeStore.accentColor(getContext()));
    }
    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
}
 
Example #3
Source File: SettingsActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            ThemeStore.editTheme(this).primaryColor(selectedColor).commit();
            break;
        case R.string.accent_color:
            ThemeStore.editTheme(this).accentColor(selectedColor).commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example #4
Source File: LibraryFragment.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
private void setUpViewPager() {
    pagerAdapter = new MusicLibraryPagerAdapter(getActivity(), getChildFragmentManager());
    pager.setAdapter(pagerAdapter);
    pager.setOffscreenPageLimit(pagerAdapter.getCount() - 1);

    tabs.setupWithViewPager(pager);

    int primaryColor = ThemeStore.primaryColor(getActivity());
    int normalColor = ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), primaryColor);
    int selectedColor = ToolbarContentTintHelper.toolbarTitleColor(getActivity(), primaryColor);
    TabLayoutUtil.setTabIconColors(tabs, normalColor, selectedColor);
    tabs.setTabTextColors(normalColor, selectedColor);
    tabs.setSelectedTabIndicatorColor(selectedColor); //ThemeStore.accentColor(getActivity()) ... former value, me no like



    int startPosition = PreferenceUtil.getInstance(getActivity()).getDefaultStartPage();
    startPosition = startPosition == -1 ? PreferenceUtil.getInstance(getActivity()).getLastPage() : startPosition;
    pager.setCurrentItem(startPosition);
    PreferenceUtil.getInstance(getActivity()).setLastPage(startPosition); // just in case
    pager.addOnPageChangeListener(this);
}
 
Example #5
Source File: SettingsActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
    switch (dialog.getTitle()) {
        case R.string.primary_color:
            ThemeStore.editTheme(this)
                    .primaryColor(selectedColor)
                    .commit();
            break;
        case R.string.accent_color:
            ThemeStore.editTheme(this)
                    .accentColor(selectedColor)
                    .commit();
            break;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
        new DynamicShortcutManager(this).updateDynamicShortcuts();
    }
    recreate();
}
 
Example #6
Source File: CardPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
private void setUpPlayPauseFab() {
    final int fabColor = ThemeStore.accentColor(getActivity());
    TintHelper.setTintAuto(playPauseFab, fabColor, true);

    playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());

    playPauseFab.setImageDrawable(playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
    playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
    playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
    playPauseFab.post(() -> {
        if (playPauseFab != null) {
            playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
            playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
        }
    });
}
 
Example #7
Source File: SettingsActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getListView().setPadding(0, 0, 0, 0);
    getListView().addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (recyclerView.canScrollVertically(RecyclerView.NO_POSITION)) {
                ((SettingsActivity) getActivity()).addAppbarLayoutElevation(8f);
            } else {
                ((SettingsActivity) getActivity()).addAppbarLayoutElevation(0f);
            }
        }
    });
    getListView().setBackgroundColor(ThemeStore.primaryColor(getContext()));
    invalidateSettings();
}
 
Example #8
Source File: SongTagEditorActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ButterKnife.bind(this);

    setStatusbarColorAuto();
    setTaskDescriptionColorAuto();

    setNoImageMode();
    setUpViews();

    progressBar.setVisibility(View.GONE);
    lastFMRestClient = new LastFMRestClient(this);

    getSupportActionBar().setTitle(R.string.action_tag_editor);
    TintHelper.setTintAuto(loadTrackDetails, ThemeStore.accentColor(this), false);
}
 
Example #9
Source File: AbsThemeActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    // default theme
    if (!ThemeStore.isConfigured(this, 1)) {
        ThemeStore.editTheme(this)
                .activityTheme(R.style.Theme_RetroMusic_Light)
                .accentColorRes(R.color.md_green_A200)
                .commit();
    }
    getSharedPreferences("[[kabouzeid_app-theme-helper]]", 0)
            .edit()
            .putInt("activity_theme", PreferenceUtil.getInstance(this).getGeneralTheme())
            .apply(); // TEMPORARY FIX

    super.onCreate(savedInstanceState);

    MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this);

    changeBackgroundShape();

    mDecorView = getWindow().getDecorView();

    //ActivityUtils.toggleFullscreen(this, PreferenceUtil.getInstance(this).getFullScreenMode());
}
 
Example #10
Source File: SettingsActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.activity_settings);
    ButterKnife.bind(this);

    setStatusbarColorAuto();
    setNavigationbarColorAuto();
    setTaskDescriptionColorAuto();

    setupToolbar();

    SettingsPagerAdapter settingsPagerAdapter = new SettingsPagerAdapter(getSupportFragmentManager());
    mViewPager.setAdapter(settingsPagerAdapter);
    mTabLayout.setupWithViewPager(mViewPager);

    int primaryColor = ThemeStore.primaryColor(this);
    int normalColor = ToolbarContentTintHelper.toolbarSubtitleColor(this, primaryColor);
    int selectedColor = ToolbarContentTintHelper.toolbarTitleColor(this, primaryColor);
    TabLayoutUtil.setTabIconColors(mTabLayout, normalColor, selectedColor);
    mTabLayout.setTabTextColors(normalColor, selectedColor);
    mTabLayout.setSelectedTabIndicatorColor(ThemeStore.accentColor(this));
}
 
Example #11
Source File: FoldersFragment.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMultipleItemAction(MenuItem item, List<File> files) {
    final int itemId = item.getItemId();
    new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> {
        if (!songs.isEmpty()) {
            SongsMenuHelper.handleMenuClick(getActivity(), songs, itemId);
        }
        if (songs.size() != files.size()) {
            Snackbar.make(coordinatorLayout, R.string.some_files_are_not_listed_in_the_media_store, Snackbar.LENGTH_LONG)
                    .setAction(R.string.action_scan, v -> {
                        String[] paths = new String[files.size()];
                        for (int i = 0; i < files.size(); i++) {
                            paths[i] = FileUtil.safeGetCanonicalPath(files.get(i));
                        }
                        scanPaths(paths);
                    })
                    .setActionTextColor(ThemeStore.accentColor(getActivity()))
                    .show();
        }
    }).execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
}
 
Example #12
Source File: FoldersFragment.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMultipleItemAction(MenuItem item, List<File> files) {
    final int itemId = item.getItemId();
    new ListSongsAsyncTask(getActivity(), null, (songs, extra) -> {
        if (!songs.isEmpty()) {
            SongsMenuHelper.handleMenuClick(getActivity(), songs, itemId);
        }
        if (songs.size() != files.size()) {
            Snackbar.make(coordinatorLayout, R.string.some_files_are_not_listed_in_the_media_store, Snackbar.LENGTH_LONG)
                    .setAction(R.string.action_scan, v -> {
                        String[] paths = new String[files.size()];
                        for (int i = 0; i < files.size(); i++) {
                            paths[i] = FileUtil.safeGetCanonicalPath(files.get(i));
                        }
                        scanPaths(paths);
                    })
                    .setActionTextColor(ThemeStore.accentColor(getActivity()))
                    .show();
        }
    }).execute(new ListSongsAsyncTask.LoadingInfo(files, AUDIO_FILE_FILTER, getFileComparator()));
}
 
Example #13
Source File: MiniPlayerFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
private void setUpPlayPauseButton() {

        //int accentColor = ThemeStore.accentColor(getContext());
        //int darkenColor = ColorUtil.darkenColor(accentColor);
        //boolean isDark = ColorUtil.isColorLight(darkenColor);

        //int iconColor = MaterialValueHelper.getPrimaryTextColor(getContext(), isDark);
        //miniPlayerTitle.setTextColor(iconColor);
        //icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);

        //TintHelper.setTintAuto(miniPlayerPlayPauseButton, iconColor, false);

        miniPlayerPlayPauseDrawable = new PlayPauseDrawable(getActivity());
        miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable);
        miniPlayerPlayPauseButton.setColorFilter(ATHUtil.resolveColor(getActivity(), R.attr.iconColor, ThemeStore.textColorSecondary(getActivity())), PorterDuff.Mode.SRC_IN);
        miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler());
    }
 
Example #14
Source File: BreadCrumbLayout.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void init() {
    contentColorActivated = ThemeStore.textColorPrimary(getContext());
    contentColorDeactivated = ThemeStore.textColorSecondary(getContext());
    setMinimumHeight((int) getResources().getDimension(R.dimen.tab_height));
    setClipToPadding(false);
    setHorizontalScrollBarEnabled(false);
    mCrumbs = new ArrayList<>();
    mHistory = new ArrayList<>();
    mChildFrame = new LinearLayout(getContext());
    addView(mChildFrame, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
 
Example #15
Source File: FoldersFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setUpAppbarColor() {
    int primaryColor = ThemeStore.primaryColor(getActivity());
    appbar.setBackgroundColor(primaryColor);
    toolbar.setBackgroundColor(primaryColor);
    breadCrumbs.setBackgroundColor(primaryColor);
    breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), primaryColor));
    breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), primaryColor));
}
 
Example #16
Source File: AbsBaseActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == PERMISSION_REQUEST) {
        for (int grantResult : grantResults) {
            if (grantResult != PackageManager.PERMISSION_GRANTED) {
                if (ActivityCompat.shouldShowRequestPermissionRationale(AbsBaseActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                    //User has deny from permission dialog
                    Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
                            Snackbar.LENGTH_INDEFINITE)
                            .setAction(R.string.action_grant, view -> requestPermissions())
                            .setActionTextColor(ThemeStore.accentColor(this))
                            .show();
                } else {
                    // User has deny permission and checked never show permission dialog so you can redirect to Application settings page
                    Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
                            Snackbar.LENGTH_INDEFINITE)
                            .setAction(R.string.action_settings, view -> {
                                Intent intent = new Intent();
                                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                                Uri uri = Uri.fromParts("package", AbsBaseActivity.this.getPackageName(), null);
                                intent.setData(uri);
                                startActivity(intent);
                            })
                            .setActionTextColor(ThemeStore.accentColor(this))
                            .show();
                }
                return;
            }
        }
        hadPermissions = true;
        onHasPermissionsChanged(true);
    }
}
 
Example #17
Source File: PlaylistDetailActivity.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public MaterialCab openCab(final int menu, final MaterialCab.Callback callback) {
    if (cab != null && cab.isActive()) cab.finish();
    cab = new MaterialCab(this, R.id.cab_stub)
            .setMenu(menu)
            .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
            .setBackgroundColor(PhonographColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(this)))
            .start(callback);
    return cab;
}
 
Example #18
Source File: GenreDetailActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setUpRecyclerView() {
    ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
    recyclerView.setLayoutManager(new LinearLayoutManager(this));

    adapter = new SongAdapter(this, new ArrayList<>(), R.layout.item_list, false, this);
    recyclerView.setAdapter(adapter);

    adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            checkIsEmpty();
        }
    });
}
 
Example #19
Source File: FoldersFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setUpAppbarColor() {
    int primaryColor = ThemeStore.primaryColor(getActivity());
    appbar.setBackgroundColor(primaryColor);
    toolbar.setBackgroundColor(primaryColor);
    breadCrumbs.setBackgroundColor(primaryColor);
    breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), primaryColor));
    breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), primaryColor));
}
 
Example #20
Source File: PlaylistDetailActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setUpToolBar() {
    toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
    setSupportActionBar(toolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setTitle(playlist.name);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
Example #21
Source File: PlaylistDetailActivity.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void setUpToolbar() {
    toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
    setSupportActionBar(toolbar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setToolbarTitle(playlist.name);
}
 
Example #22
Source File: VolumeFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    volumeSeekbar.setOnSeekBarChangeListener(this);
    setColor(ThemeStore.accentColor(getContext()));
    setupSettingsContentObserver();
}
 
Example #23
Source File: MainActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setUpNavigationView() {
    int accentColor = ThemeStore.accentColor(this);
    NavigationViewUtil.setItemIconColors(navigationView, ATHUtil.resolveColor(this, R.attr.iconColor, ThemeStore.textColorSecondary(this)), accentColor);
    NavigationViewUtil.setItemTextColors(navigationView, ThemeStore.textColorPrimary(this), accentColor);

    navigationView.setNavigationItemSelectedListener(menuItem -> {
        drawerLayout.closeDrawers();
        switch (menuItem.getItemId()) {
            case R.id.nav_library:
                new Handler().postDelayed(() -> setMusicChooser(LIBRARY), 200);
                break;
            case R.id.nav_folders:
                new Handler().postDelayed(() -> setMusicChooser(FOLDERS), 200);
                break;
            case R.id.action_scan:
                new Handler().postDelayed(() -> {
                    ScanMediaFolderChooserDialog dialog = ScanMediaFolderChooserDialog.create();
                    dialog.show(getSupportFragmentManager(), "SCAN_MEDIA_FOLDER_CHOOSER");
                }, 200);
                break;
            case R.id.nav_settings:
                new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, SettingsActivity.class)), 200);
                break;
            case R.id.nav_about:
                new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, AboutActivity.class)), 200);
                break;
        }
        return true;
    });
}
 
Example #24
Source File: AbsTagEditorActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
protected void setNoImageMode() {
    isInNoImageMode = true;
    imageContainer.setVisibility(View.GONE);
    image.setVisibility(View.GONE);
    image.setEnabled(false);

    setColors(getIntent().getIntExtra(EXTRA_PALETTE, ThemeStore.primaryColor(this)));
    toolbar.setBackgroundColor(paletteColorPrimary);
}
 
Example #25
Source File: LibraryFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setUpToolbar() {
    int primaryColor = ThemeStore.primaryColor(getActivity());
    appbar.setBackgroundColor(primaryColor);
    toolbar.setBackgroundColor(primaryColor);
    toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
    getActivity().setTitle(R.string.app_name);
    getMainActivity().setSupportActionBar(toolbar);
}
 
Example #26
Source File: AbsBaseActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == PERMISSION_REQUEST) {
        for (int grantResult : grantResults) {
            if (grantResult != PackageManager.PERMISSION_GRANTED) {
                if (ActivityCompat.shouldShowRequestPermissionRationale(AbsBaseActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                    //User has deny from permission dialog
                    Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
                            Snackbar.LENGTH_INDEFINITE)
                            .setAction(R.string.action_grant, view -> requestPermissions())
                            .setActionTextColor(ThemeStore.accentColor(this))
                            .show();
                } else {
                    // User has deny permission and checked never show permission dialog so you can redirect to Application settings page
                    Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
                            Snackbar.LENGTH_INDEFINITE)
                            .setAction(R.string.action_settings, view -> {
                                Intent intent = new Intent();
                                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                                Uri uri = Uri.fromParts("package", AbsBaseActivity.this.getPackageName(), null);
                                intent.setData(uri);
                                startActivity(intent);
                            })
                            .setActionTextColor(ThemeStore.accentColor(this))
                            .show();
                }
                return;
            }
        }
        hadPermissions = true;
        onHasPermissionsChanged(true);
    }
}
 
Example #27
Source File: AutoMusicProvider.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private MediaBrowserCompat.MediaItem createPlayableMediaItem(String mediaId, String title, int iconDrawableId,
                                                             @Nullable String subtitle) {
    MediaDescriptionCompat.Builder builder = new MediaDescriptionCompat.Builder()
            .setMediaId(mediaId)
            .setTitle(title)
            .setIconBitmap(ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(mContext, iconDrawableId, ThemeStore.textColorSecondary(mContext))));

    if (subtitle != null) {
        builder.setSubtitle(subtitle);
    }

    return new MediaBrowserCompat.MediaItem(builder.build(),
            MediaBrowserCompat.MediaItem.FLAG_PLAYABLE);
}
 
Example #28
Source File: LibraryFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public MaterialCab openCab(final int menuRes, final MaterialCab.Callback callback) {
    if (cab != null && cab.isActive()) cab.finish();
    cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
            .setMenu(menuRes)
            .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
            .setBackgroundColor(PhonographColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
            .start(callback);
    return cab;
}
 
Example #29
Source File: FoldersFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) {
    if (cab != null && cab.isActive()) cab.finish();
    cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
            .setMenu(menuRes)
            .setCloseDrawableRes(R.drawable.ic_close_white_24dp)
            .setBackgroundColor(PhonographColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
            .start(callback);
    return cab;
}
 
Example #30
Source File: FoldersFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void setUpAppbarColor() {
    int primaryColor = ThemeStore.primaryColor(getActivity());
    appbar.setBackgroundColor(primaryColor);
    toolbar.setBackgroundColor(primaryColor);
    breadCrumbs.setBackgroundColor(primaryColor);
    breadCrumbs.setActivatedContentColor(ToolbarContentTintHelper.toolbarTitleColor(getActivity(), primaryColor));
    breadCrumbs.setDeactivatedContentColor(ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), primaryColor));
}