Java Code Examples for com.kabouzeid.appthemehelper.util.MaterialValueHelper#getPrimaryTextColor()

The following examples show how to use com.kabouzeid.appthemehelper.util.MaterialValueHelper#getPrimaryTextColor() . 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: 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 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: CardPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updateProgressTextColor();
}
 
Example 4
Source File: FlatPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updatePlayPauseColor();
    updateProgressTextColor();
}
 
Example 5
Source File: FlatPlayerPlaybackControlsFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 6
Source File: FlatPlayerPlaybackControlsFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updatePlayPauseColor();
    updateProgressTextColor();
}
 
Example 7
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 8
Source File: CardPlayerPlaybackControlsFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 9
Source File: FlatPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updatePlayPauseColor();
    updateProgressTextColor();
}
 
Example 10
Source File: CardPlayerPlaybackControlsFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updateProgressTextColor();
}
 
Example 11
Source File: FlatPlayerPlaybackControlsFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 12
Source File: FlatPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 13
Source File: FlatPlayerPlaybackControlsFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
public void setDark(boolean dark) {
    if (dark) {
        lastPlaybackControlsColor = MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
    } else {
        lastPlaybackControlsColor = MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
        lastDisabledPlaybackControlsColor = MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
    }

    updateRepeatState();
    updateShuffleState();
    updatePrevNextColor();
    updatePlayPauseColor();
    updateProgressTextColor();
}
 
Example 14
Source File: CardPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 15
Source File: FlatPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
private void setUpProgressSlider() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    progressSlider.getThumb().mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
    progressSlider.getProgressDrawable().mutate().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN);

    progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                MusicPlayerRemote.seekTo(progress);
                onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis());
            }
        }
    });
}
 
Example 16
Source File: FlatPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 4 votes vote down vote up
private void updateProgressTextColor() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    songTotalTime.setTextColor(color);
    songCurrentProgress.setTextColor(color);
}
 
Example 17
Source File: CardPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 4 votes vote down vote up
private void updateProgressTextColor() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    songTotalTime.setTextColor(color);
    songCurrentProgress.setTextColor(color);
}
 
Example 18
Source File: CardPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 4 votes vote down vote up
private void updateProgressTextColor() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    songTotalTime.setTextColor(color);
    songCurrentProgress.setTextColor(color);
}
 
Example 19
Source File: FlatPlayerPlaybackControlsFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 4 votes vote down vote up
private void updateProgressTextColor() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    songTotalTime.setTextColor(color);
    songCurrentProgress.setTextColor(color);
}
 
Example 20
Source File: FlatPlayerPlaybackControlsFragment.java    From Music-Player with GNU General Public License v3.0 4 votes vote down vote up
private void updateProgressTextColor() {
    int color = MaterialValueHelper.getPrimaryTextColor(getContext(), false);
    songTotalTime.setTextColor(color);
    songCurrentProgress.setTextColor(color);
}