com.kabouzeid.appthemehelper.util.MaterialValueHelper Java Examples

The following examples show how to use com.kabouzeid.appthemehelper.util.MaterialValueHelper. 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 Orin with GNU General Public License v3.0 6 votes vote down vote up
private void setUpPlayPauseFab() {
    final int fabColor = Color.WHITE;
    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(new Runnable() {
        @Override
        public void run() {
            if (playPauseFab != null) {
                playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
                playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
            }
        }
    });
}
 
Example #2
Source File: ArtistDetailActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
private void setColors(int color) {
    toolbarColor = color;
    headerView.setBackgroundColor(color);

    setNavigationbarColor(color);
    setTaskDescriptionColor(color);

    toolbar.setBackgroundColor(color);
    setSupportActionBar(toolbar); // needed to auto readjust the toolbar content color
    setStatusbarColor(color);

    int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
    durationIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    songCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    albumCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    durationTextView.setTextColor(secondaryTextColor);
    songCountTextView.setTextColor(secondaryTextColor);
    albumCountTextView.setTextColor(secondaryTextColor);
}
 
Example #3
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 #4
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 #5
Source File: AlbumDetailActivity.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
private void setColors(int color) {
    toolbarColor = color;
    headerView.setBackgroundColor(color);

    setNavigationbarColor(color);
    setTaskDescriptionColor(color);

    toolbar.setBackgroundColor(color);
    setSupportActionBar(toolbar); // needed to auto readjust the toolbar content color
    setStatusbarColor(color);

    int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
    artistIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    durationIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    songCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    albumYearIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    artistTextView.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
    durationTextView.setTextColor(secondaryTextColor);
    songCountTextView.setTextColor(secondaryTextColor);
    albumYearTextView.setTextColor(secondaryTextColor);
}
 
Example #6
Source File: AlbumDetailActivity.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
private void setColors(int color) {
    toolbarColor = color;
    headerView.setBackgroundColor(color);

    setNavigationbarColor(color);
    setTaskDescriptionColor(color);

    toolbar.setBackgroundColor(color);
    setSupportActionBar(toolbar); // needed to auto readjust the toolbar content color
    setStatusbarColor(color);

    int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
    artistIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    durationIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    songCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    albumYearIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
    artistTextView.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
    durationTextView.setTextColor(secondaryTextColor);
    songCountTextView.setTextColor(secondaryTextColor);
    albumYearTextView.setTextColor(secondaryTextColor);
}
 
Example #7
Source File: CardPlayerPlaybackControlsFragment.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
private void setUpPlayPauseFab() {
    final int fabColor = Color.WHITE;
    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 #8
Source File: CardPlayerPlaybackControlsFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
private void setUpPlayPauseFab() {
    final int fabColor = Color.WHITE;
    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 #9
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 #10
Source File: CardPlayerPlaybackControlsFragment.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 #11
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 #12
Source File: AppWidgetCard.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_card);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
    appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #13
Source File: CardPlayerPlaybackControlsFragment.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();
    updateProgressTextColor();
}
 
Example #14
Source File: BaseAppWidget.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
protected void setButtons(final MusicService service) {
    final boolean isPlaying = service.isPlaying();
    // Set correct drawable for pause state
    int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, true))));

    // Set prev/next button drawables
    appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, true))));
    appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, true))));
}
 
Example #15
Source File: BaseAppWidget.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    appWidgetView = new RemoteViews(context.getPackageName(), getLayout());

    setBackground();
    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
    appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));

    linkButtons(context);
    pushUpdate(context, appWidgetIds);
}
 
Example #16
Source File: ArtistAdapter.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void setColors(int color, ViewHolder holder) {
    if (holder.paletteColorContainer != null) {
        holder.paletteColorContainer.setBackgroundColor(color);
        if (holder.title != null) {
            holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
        if (holder.text != null) {
            holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
    }
}
 
Example #17
Source File: HorizontalAlbumAdapter.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void setColors(int color, ViewHolder holder) {
    if (holder.itemView != null) {
        CardView card = (CardView) holder.itemView;
        card.setCardBackgroundColor(color);
        if (holder.title != null) {
                holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
        if (holder.text != null) {
                holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
    }
}
 
Example #18
Source File: LockScreenActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void changeColor(int color) {
    Drawable drawable = ContextCompat.getDrawable(LockScreenActivity.this, R.drawable.shape_rounded_edit);
    if (drawable != null) {
        drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
        mSwipeButton.setBackground(drawable);
    }

    int colorPrimary = MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color));
    mSwipeButton.setCenterTextColor(colorPrimary);
}
 
Example #19
Source File: ArtistAdapter.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setColors(int color, ViewHolder holder) {
    if (holder.paletteColorContainer != null) {
        holder.paletteColorContainer.setBackgroundColor(color);
        if (holder.title != null) {
            holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
        if (holder.text != null) {
            holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
    }
}
 
Example #20
Source File: AppWidgetCard.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_card);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
    appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true)), 1f));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #21
Source File: AppWidgetBig.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_big);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
    appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #22
Source File: ArtistDetailActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void setColors(int color) {
    toolbarColor = color;
    artistDetailsLayout.setCardBackgroundColor(color);
    artistName.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
    artistDesc.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
    artistBio.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
    setNavigationbarColor(color);
    setTaskDescriptionColor(color);
}
 
Example #23
Source File: AppWidgetClassic.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_classic);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
    appWidgetView.setImageViewBitmap(R.id.button_next, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_prev, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, ImageUtil.createBitmap(ImageUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, true))));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #24
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 #25
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 #26
Source File: AppWidgetSmall.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
private void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_small);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
    appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #27
Source File: ArtistAdapter.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
private void setColors(int color, ViewHolder holder) {
    if (holder.paletteColorContainer != null) {
        holder.paletteColorContainer.setBackgroundColor(color);
        if (holder.title != null) {
            holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
        if (holder.text != null) {
            holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
    }
}
 
Example #28
Source File: AppWidgetClassic.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialize given widgets to default state, where we launch Music on
 * default click and hide actions if service not running.
 */
private void defaultAppWidget(final Context context, final int[] appWidgetIds) {
    final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(), R.layout.app_widget_classic);

    appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
    appWidgetView.setViewVisibility(R.id.image, View.INVISIBLE);
    appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));
    appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp, MaterialValueHelper.getSecondaryTextColor(context, false)), 1f));

    linkButtons(context, appWidgetView);
    pushUpdate(context, appWidgetIds, appWidgetView);
}
 
Example #29
Source File: CardPlayerPlaybackControlsFragment.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 #30
Source File: AlbumAdapter.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
protected void setColors(int color, ViewHolder holder) {
    if (holder.paletteColorContainer != null) {
        holder.paletteColorContainer.setBackgroundColor(color);
        if (holder.title != null) {
            holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
        if (holder.text != null) {
            holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
        }
    }
}