@Override
  public void onBindViewHolder(ItemHolder itemHolder, int i) {
    Song localItem = arraylist.get(i);

    itemHolder.title.setText(localItem.title);
    itemHolder.artist.setText(localItem.artistName);

    if (MusicPlayer.getCurrentAudioId() == localItem.id) {
      // itemHolder.title.setTextColor(ContextCompat.getColor(mContext, R.color.colorAccent));
      if (MusicPlayer.isPlaying()) {
        itemHolder.visualizer.setColor(ContextCompat.getColor(mContext, R.color.colorAccent));
        itemHolder.visualizer.setVisibility(View.VISIBLE);
      }
    } else {
      // itemHolder.title.setTextColor(Config.textColorPrimary(mContext, ateKey));
      itemHolder.visualizer.setVisibility(View.GONE);
    }
    ImageLoader.getInstance()
        .displayImage(
            TimberUtils.getAlbumArtUri(localItem.albumId).toString(),
            itemHolder.albumArt,
            new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .showImageOnFail(R.drawable.ic_dribble)
                .resetViewBeforeLoading(true)
                .build());
    setOnPopupMenuListener(itemHolder, i);
  }
Esempio n. 2
0
  public void updateShuffleState() {
    if (shuffle != null && getActivity() != null) {
      MaterialDrawableBuilder builder =
          MaterialDrawableBuilder.with(getActivity())
              .setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE)
              .setSizeDp(30);

      if (getActivity() != null) {
        if (MusicPlayer.getShuffleMode() == 0) {
          builder.setColor(Color.BLACK);
        } else builder.setColor(accentColor);
      }

      shuffle.setImageDrawable(builder.build());
      shuffle.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              MusicPlayer.cycleShuffle();
              updateShuffleState();
              updateRepeatState();
            }
          });
    }
  }
 public PlayingQueueAdapter(Activity context, List<Song> arraylist) {
   this.arraylist = arraylist;
   this.mContext = context;
   this.currentlyPlayingPosition = MusicPlayer.getQueuePosition();
   this.ateKey = Helpers.getATEKey(context);
 }