@Override
        public void run() {
          mVisualizer.animate().cancel();
          mVisualizer.animate().setDuration(200).alpha(mIsAnythingPlaying ? 1.f : 0.f);

          mStaticVisualizerIcon.animate().cancel();
          mStaticVisualizerIcon.animate().setDuration(200).alpha(mIsAnythingPlaying ? 0.f : 1.f);
        }
Ejemplo n.º 2
0
 @DebugLog
 void attachVisualizer(int id) {
   destroyVisualizer();
   if (id == AudioEffect.ERROR_BAD_VALUE) return;
   if (visualizerView == null) return;
   visualizerView.link(id);
   setVisualizerEnabled(presenter.isPlaying);
 }
 @Override
 public void run() {
   if (mVisualizer != null) {
     if (mLinked) {
       mVisualizer.unlink();
       mLinked = false;
     }
   }
 }
 @Override
 public void run() {
   if (mVisualizer != null) {
     if (!mLinked) {
       mVisualizer.link(0);
       mLinked = true;
     }
   }
 }
Ejemplo n.º 5
0
  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);
  }
Ejemplo n.º 6
0
 @DebugLog
 void setVisualizerEnabled(boolean enabled) {
   if (visualizerView == null) return;
   visualizerView.setEnabled(enabled);
 }
Ejemplo n.º 7
0
 @DebugLog
 void destroyVisualizer() {
   if (visualizerView == null) return;
   visualizerView.release();
 }