Java Code Examples for com.kabouzeid.appthemehelper.ThemeStore#accentColor()

The following examples show how to use com.kabouzeid.appthemehelper.ThemeStore#accentColor() . 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: 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 2
Source File: FlatPlaybackControlsFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
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()) {
        updateTextColors(dark);
        setProgressBarColor(dark);
        TintHelper.setTintAuto(mPlayerPlayPauseFab, dark, true);
    } else {
        int accentColor = ThemeStore.accentColor(getContext());
        updateTextColors(accentColor);
        setProgressBarColor(accentColor);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updateProgressTextColor();
}
 
Example 3
Source File: FullPlaybackControlsFragment.java    From RetroMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
public void setDark(int dark) {
    lastPlaybackControlsColor = Color.WHITE;
    lastDisabledPlaybackControlsColor = ContextCompat.getColor(getContext(),R.color.md_grey_500);

    if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
        setProgressBarColor(dark);
    } else {
        int accentColor = ThemeStore.accentColor(getContext());
        setProgressBarColor(accentColor);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updateProgressTextColor();
}
 
Example 4
Source File: ShuffleButtonSongAdapter.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
    if (holder.getItemViewType() == OFFSET_ITEM) {
        int accentColor = ThemeStore.accentColor(activity);
        if (holder.title != null) {
            holder.title.setText(activity.getResources().getString(R.string.action_shuffle_all).toUpperCase());
            holder.title.setTextColor(accentColor);
            holder.title.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
        }
        if (holder.text != null) {
            holder.text.setVisibility(View.GONE);
        }
        if (holder.menu != null) {
            holder.menu.setVisibility(View.GONE);
        }
        if (holder.image != null) {
            final int padding = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin) / 2;
            holder.image.setPadding(padding, padding, padding, padding);
            holder.image.setColorFilter(accentColor);
            holder.image.setImageResource(R.drawable.ic_shuffle_white_24dp);
        }
        if (holder.separator != null) {
            holder.separator.setVisibility(View.VISIBLE);
        }
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.GONE);
        }
    } else {
        super.onBindViewHolder(holder, position - 1);
    }
}
 
Example 5
Source File: MainActivity.java    From Music-Player 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_equalizer:
                NavigationUtil.openEqualizer(this);
                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 6
Source File: HomeAdapter.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int i) {
    ViewHolder viewholder = (ViewHolder) holder;
    Playlist playlist = dataSet.get(holder.getAdapterPosition());
    if (viewholder.title != null) {
        viewholder.title.setVisibility(View.VISIBLE);
        viewholder.title.setText(playlist.name);
    }

    int aColor = ThemeStore.accentColor(activity);
    viewholder.dash.setBackgroundColor(aColor);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        viewholder.seeAll.setBackgroundTintList(ColorStateList.valueOf(aColor));
    } else {
        viewholder.seeAll.setBackgroundColor(aColor);
    }
    int color = MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(aColor));
    viewholder.seeAll.setTextColor(color);
    viewholder.seeAll.setOnClickListener(v -> {
        NavigationUtil.goToPlaylistNew(activity, playlist);
    });

    if (viewholder.recyclerView != null) {
        viewholder.recyclerView.setHasFixedSize(true);
        viewholder.recyclerView.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false));
        viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
        PlaylistSongsLoader.getPlaylistSongList(activity, playlist)
                .subscribeOn(Schedulers.computation())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(songs -> viewholder.recyclerView.setAdapter(new HorizontalItemAdapter(activity, songs)));
    }


}
 
Example 7
Source File: ShuffleButtonSongAdapter.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
    if (holder.getItemViewType() == OFFSET_ITEM) {
        int accentColor = ThemeStore.accentColor(activity);
        if (holder.title != null) {
            holder.title.setText(activity.getResources().getString(R.string.action_shuffle_all));
            holder.title.setTextColor(accentColor);
            /*((GradientTextView) holder.title).setLinearGradient(ThemeStore.accentColor(activity),
                    PhonographColorUtil.getMatColor(activity, "A400"), GradientTextView.LG_VERTICAL);
            */
        }
        if (holder.text != null) {
            holder.text.setVisibility(View.GONE);
        }
        if (holder.menu != null) {
            holder.menu.setVisibility(View.GONE);
        }
        if (holder.image != null) {
            final int padding = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin) / 2;
            holder.image.setPadding(padding, padding, padding, padding);
            holder.image.setColorFilter(accentColor);
            holder.image.setImageResource(R.drawable.ic_shuffle_white_24dp);
        }
        if (holder.separator != null) {
            holder.separator.setVisibility(View.VISIBLE);
        }
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.GONE);
        }
    } else {
        super.onBindViewHolder(holder, position - 1);
    }
}
 
Example 8
Source File: ShuffleButtonSongAdapter.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
    if (holder.getItemViewType() == OFFSET_ITEM) {
        int accentColor = ThemeStore.accentColor(activity);
        if (holder.title != null) {
            holder.title.setText(activity.getResources().getString(R.string.action_shuffle_all).toUpperCase());
            holder.title.setTextColor(accentColor);
            holder.title.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
        }
        if (holder.text != null) {
            holder.text.setVisibility(View.GONE);
        }
        if (holder.menu != null) {
            holder.menu.setVisibility(View.GONE);
        }
        if (holder.image != null) {
            final int padding = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin) / 2;
            holder.image.setPadding(padding, padding, padding, padding);
            holder.image.setColorFilter(accentColor);
            holder.image.setImageResource(R.drawable.ic_shuffle_white_24dp);
        }
        if (holder.separator != null) {
            holder.separator.setVisibility(View.VISIBLE);
        }
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.GONE);
        }
    } else {
        super.onBindViewHolder(holder, position - 1);
    }
}
 
Example 9
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 10
Source File: PreAmpPreferenceDialog.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View view = getActivity().getLayoutInflater().inflate(R.layout.preference_dialog_rg_preamp, null);

    withRgValue = PreferenceUtil.getInstance().getRgPreampWithTag();
    withoutRgValue = PreferenceUtil.getInstance().getRgPreampWithoutTag();

    labelWithRg = view.findViewById(R.id.label_with_rg);
    labelWithoutRg = view.findViewById(R.id.label_without_rg);
    updateLabelWithRg();
    updateLabelWitouthRg();

    int color = ThemeStore.accentColor(getContext());

    SeekBar seekbarWithRg = view.findViewById(R.id.seekbar_with_rg);
    seekbarWithRg.setOnSeekBarChangeListener(this);
    seekbarWithRg.setProgress((int) ((withRgValue + 15) / 0.2f));
    seekbarWithRg.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    seekbarWithRg.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);

    SeekBar seekbarWithoutRg = view.findViewById(R.id.seekbar_without_rg);
    seekbarWithoutRg.setOnSeekBarChangeListener(this);
    seekbarWithoutRg.setProgress((int) ((withoutRgValue + 15) / 0.2f));
    seekbarWithoutRg.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    seekbarWithoutRg.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);

    return new MaterialDialog.Builder(getContext())
            .title(R.string.pref_title_rg_preamp)
            .positiveText(android.R.string.ok)
            .negativeText(android.R.string.cancel)
            .autoDismiss(false)
            .onNegative((dialog, which) -> dismiss())
            .onPositive((dialog, which) -> updateAndClose())
            .customView(view, false)
            .build();
}
 
Example 11
Source File: ShuffleButtonSongAdapter.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
    if (holder.getItemViewType() == OFFSET_ITEM) {
        int accentColor = ThemeStore.accentColor(activity);
        if (holder.title != null) {
            holder.title.setText(activity.getResources().getString(R.string.action_shuffle_all).toUpperCase());
            holder.title.setTextColor(accentColor);
            holder.title.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
        }
        if (holder.text != null) {
            holder.text.setVisibility(View.GONE);
        }
        if (holder.menu != null) {
            holder.menu.setVisibility(View.GONE);
        }
        if (holder.image != null) {
            final int padding = activity.getResources().getDimensionPixelSize(R.dimen.default_item_margin) / 2;
            holder.image.setPadding(padding, padding, padding, padding);
            holder.image.setColorFilter(accentColor);
            holder.image.setImageResource(R.drawable.ic_shuffle_white_24dp);
        }
        if (holder.separator != null) {
            holder.separator.setVisibility(View.VISIBLE);
        }
        if (holder.shortSeparator != null) {
            holder.shortSeparator.setVisibility(View.GONE);
        }
    } else {
        super.onBindViewHolder(holder, position - 1);
    }
}
 
Example 12
Source File: MainActivity.java    From Phonograph 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);

    checkSetUpPro();
    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.buy_pro:
                new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, PurchaseActivity.class)), 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 13
Source File: MainActivity.java    From Orin with GNU General Public License v3.0 4 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(new NavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
                drawerLayout.closeDrawers();
                switch (menuItem.getItemId()) {
                    case R.id.nav_library:
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                setMusicChooser(LIBRARY);
                            }
                        }, 200);
                        break;
                    case R.id.nav_folders:
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                setMusicChooser(FOLDERS);
                            }
                        }, 200);
                        break;
//                    case R.id.support_development:
//                        new Handler().postDelayed(new Runnable() {
//                            @Override
//                            public void run() {
//                                DonationsDialog.create().show(getSupportFragmentManager(), "DONATION_DIALOG");
//                            }
//                        }, 200);
//                        break;
                    case R.id.nav_settings:
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                startActivity(new Intent(MainActivity.this, SettingsActivity.class));
                            }
                        }, 200);
                        break;
                    case R.id.nav_about:
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                startActivity(new Intent(MainActivity.this, AboutActivity.class));
                            }
                        }, 200);
                        break;
                }
                return true;
            }
        });
    }