@Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   ButterKnife.inject(this);
   String pickedview = settings.getString(NOW_PLAYING_VIEW, NOW_PLAYING_VIEW_ARTWORK);
   switch (pickedview) {
     case NOW_PLAYING_VIEW_VIS_CIRCLE:
     case NOW_PLAYING_VIEW_VIS_CIRCLE_BAR:
     case NOW_PLAYING_VIEW_VIS_LINES:
       visualizerView =
           ViewUtils.inflate(getContext(), R.layout.now_playing_visualization, placeholder, false);
       placeholder.addView(visualizerView);
       initVisualizer(pickedview);
       break;
     case NOW_PLAYING_VIEW_ARTWORK:
     default:
       artwork = ViewUtils.inflate(getContext(), R.layout.now_playing_artwork, placeholder, false);
       placeholder.addView(artwork);
       initArtwork();
       break;
   }
   if (!VersionUtils.hasLollipop()) {
     seekBar
         .getThumb()
         .mutate()
         .setColorFilter(ThemeUtils.getColorAccent(getContext()), PorterDuff.Mode.SRC_IN);
   }
   PlaybackDrawableTint.repeatDrawable36(repeat);
   PlaybackDrawableTint.shuffleDrawable36(shuffle);
   if (!isInEditMode()) presenter.takeView(this);
 }
 public NowPlayingScreenView(Context context, AttributeSet attrs) {
   super(context, attrs);
   lightTheme = ThemeUtils.isLightTheme(getContext());
   if (!isInEditMode()) {
     NowPlayingScreenComponent component = DaggerService.getDaggerComponent(getContext());
     component.inject(this);
   }
 }
示例#3
0
 public PlayingIndicator(Context context, AttributeSet attrs) {
   super(context, attrs);
   setImageResource(R.drawable.now_playing_indicator);
   mRotateDrawable = (RotateDrawable) getDrawable();
   if (!VersionUtils.hasLollipop()) {
     mRotateDrawable.setColorFilter(
         ThemeUtils.getColorAccent(getContext()), PorterDuff.Mode.SRC_IN);
   }
 }
 @Override
 public void onNext(PaletteResponse paletteResponse) {
   if (artwork != null) {
     Palette p = paletteResponse.palette;
     int color = p.getDarkVibrantColor(getResources().getColor(R.color.transparent_black));
     color = ThemeUtils.setColorAlpha(color, 0x66);
     PorterDuffColorFilter cf = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP);
     artwork.setColorFilter(cf);
   }
 }
  void initVisualizer(String type) {
    int accentColor = ThemeUtils.getColorAccent(getContext());
    int paintColor = Color.argb(255, 222, 92, 143);
    switch (type) {
      case NOW_PLAYING_VIEW_VIS_CIRCLE:
        {
          Paint paint = new Paint();
          paint.setStrokeWidth(3f);
          paint.setAntiAlias(true);
          paint.setColor(paintColor);
          CircleRenderer circleRenderer = new CircleRenderer(paint, true);
          visualizerView.addRenderer(circleRenderer);
          break;
        }
      case NOW_PLAYING_VIEW_VIS_CIRCLE_BAR:
        {
          Paint paint = new Paint();
          paint.setStrokeWidth(8f);
          paint.setAntiAlias(true);
          paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.LIGHTEN));
          paint.setColor(paintColor);
          CircleBarRenderer circleBarRenderer = new CircleBarRenderer(paint, 32, true);
          visualizerView.addRenderer(circleBarRenderer);
          break;
        }
      case NOW_PLAYING_VIEW_VIS_LINES:
        {
          Paint linePaint = new Paint();
          linePaint.setStrokeWidth(1f);
          linePaint.setAntiAlias(true);
          linePaint.setColor(paintColor);

          Paint lineFlashPaint = new Paint();
          lineFlashPaint.setStrokeWidth(5f);
          lineFlashPaint.setAntiAlias(true);
          lineFlashPaint.setColor(accentColor);
          LineRenderer lineRenderer = new LineRenderer(linePaint, lineFlashPaint, true);
          visualizerView.addRenderer(lineRenderer);
          break;
        }
    }
    attachVisualizer(presenter.sessionId);
  }