//TODO:: Change Icon based on action. If playing, equalizer icon, pause pause-icon etc
@Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {
        final Item item = mItemList.get(position);
        setListener(mListener);
        String dateStr = item.getPubDate();
        DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss", Locale.getDefault());
        try {
            Date date = formatter.parse(dateStr);
            String pubDateStr = DateUtils.formatAbbrev(mContext, date);
            String[] dateMonth = pubDateStr.split(" ");
            holder.mTvMonth.setText(dateMonth[0]);
            holder.mTvDate.setText(dateMonth[1]);
        } catch (ParseException e) {
            e.printStackTrace();
            GoogleAnalyticsUtil.trackException(mContext, e);
        }
        if (null != item.getItunesDuration()) {
            //Check if the duration is already formatted
            if (item.getItunesDuration().contains(":")) {
                holder.mTvPodcastDuration.setText(item.getItunesDuration());
            } else {
                long min = Integer.parseInt(item.getItunesDuration()) / 60000;
                long sec = Integer.parseInt(item.getItunesDuration()) % 60000 / 1000;
                holder.mTvPodcastDuration.setText(String.format(mContext.getResources().getString(R.string.duration), min, sec));
            }
        }
        holder.mTvPodcastTitle.setText(item.getTitle());
        holder.mPlayImageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //TODO:: Change Icon based on action. If playing, equalizer icon, pause pause-icon etc
                String imageUrl = "";
                Cursor cursor = mContext.getContentResolver().query(mUri, null, null, null, null);
                if (cursor != null) {
                    while (cursor.moveToNext()) {
                        imageUrl = cursor.getString(ApplicationConstants.COLUMN_SUBSCRIBED_PODCAST_FEED_IMAGE_URL);
                    }
                }
                Track track = new Track();
                track.setTitle(item.getTitle());
                track.setStreamUrl(item.getEnclosure().getUrl());
                track.setArtist(item.getItunesAuthor());
                track.setArtworkUrl(imageUrl);
                track.setDurationInMilli(Converter.getMilliSeconds(item.getItunesDuration()));
                if (mListener != null) {
                    mListener.onTrackClicked(track);
                }
            }
        });
        holder.mEpisodeRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                displayBottomSheet(item);
            }
        });
    }
@Override
public void onClick(View v) {
//TODO:: Change Icon based on action. If playing, equalizer icon, pause pause-icon etc
String imageUrl = "";
Cursor cursor = mContext.getContentResolver().query(mUri, null, null, null, null);
} else {
long min = Integer.parseInt(item.getItunesDuration()) / 60000;
long sec = Integer.parseInt(item.getItunesDuration()) % 60000 / 1000;
holder.mTvPodcastDuration.setText(String.format(mContext.getResources().getString(R.string.duration), min, sec));
}
}
holder.mTvPodcastTitle.setText(item.getTitle());
holder.mPlayImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//TODO:: Change Icon based on action. If playing, equalizer icon, pause pause-icon etc
String imageUrl = "";
Cursor cursor = mContext.getContentResolver().query(mUri, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
imageUrl = cursor.getString(ApplicationConstants.COLUMN_SUBSCRIBED_PODCAST_FEED_IMAGE_URL);
}
}
Track track = new Track();
track.setTitle(item.getTitle());
track.setStreamUrl(item.getEnclosure().getUrl());
holder.mTvMonth.setText(dateMonth[0]);
holder.mTvDate.setText(dateMonth[1]);
} catch (ParseException e) {
e.printStackTrace();
GoogleAnalyticsUtil.trackException(mContext, e);
}
if (null != item.getItunesDuration()) {
//Check if the duration is already formatted
if (item.getItunesDuration().contains(":")) {
holder.mTvPodcastDuration.setText(item.getItunesDuration());
} else {
long min = Integer.parseInt(item.getItunesDuration()) / 60000;
long sec = Integer.parseInt(item.getItunesDuration()) % 60000 / 1000;
holder.mTvPodcastDuration.setText(String.format(mContext.getResources().getString(R.string.duration), min, sec));
}
}
holder.mTvPodcastTitle.setText(item.getTitle());
holder.mPlayImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//TODO:: Change Icon based on action. If playing, equalizer icon, pause pause-icon etc
String imageUrl = "";
Cursor cursor = mContext.getContentResolver().query(mUri, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
imageUrl = cursor.getString(ApplicationConstants.COLUMN_SUBSCRIBED_PODCAST_FEED_IMAGE_URL);
}
}
Track track = new Track();
track.setTitle(item.getTitle());
track.setStreamUrl(item.getEnclosure().getUrl());
track.setArtist(item.getItunesAuthor());
track.setArtworkUrl(imageUrl);
track.setDurationInMilli(Converter.getMilliSeconds(item.getItunesDuration()));
if (mListener != null) {
mListener.onTrackClicked(track);
}
}
});
holder.mEpisodeRl.setOnClickListener(new View.OnClickListener() {
@Override