Converted FeedItemlistAdapter to use new EpisodeItemViewHolder

This commit is contained in:
ByteHamster 2020-02-04 16:38:53 +01:00
parent cae04b5b13
commit 1313cde481
7 changed files with 259 additions and 653 deletions

View File

@ -1,74 +0,0 @@
package de.danoeh.antennapod.adapter;
import android.util.Log;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.joanzapata.iconify.Iconify;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.NetworkUtils;
/**
* Utility methods for adapters
*/
class AdapterUtils {
private static final String TAG = AdapterUtils.class.getSimpleName();
private AdapterUtils() {
}
/**
* Updates the contents of the TextView that shows the current playback position and the ProgressBar.
*/
static void updateEpisodePlaybackProgress(FeedItem item, TextView txtvPos, ProgressBar episodeProgress) {
FeedMedia media = item.getMedia();
episodeProgress.setVisibility(View.GONE);
if (media == null) {
txtvPos.setVisibility(View.GONE);
return;
} else {
txtvPos.setVisibility(View.VISIBLE);
}
FeedItem.State state = item.getState();
if (state == FeedItem.State.PLAYING
|| state == FeedItem.State.IN_PROGRESS) {
if (media.getDuration() > 0) {
episodeProgress.setVisibility(View.VISIBLE);
episodeProgress.setProgress((int) (((double) media
.getPosition()) / media.getDuration() * 100));
txtvPos.setText(Converter.getDurationStringLong(media.getDuration()
- media.getPosition()));
}
} else if (!media.isDownloaded()) {
if (media.getSize() > 0) {
txtvPos.setText(Converter.byteToString(media.getSize()));
} else if(NetworkUtils.isEpisodeHeadDownloadAllowed() && !media.checkedOnSizeButUnknown()) {
txtvPos.setText("{fa-spinner}");
Iconify.addIcons(txtvPos);
NetworkUtils.getFeedMediaSizeObservable(media)
.subscribe(
size -> {
if (size > 0) {
txtvPos.setText(Converter.byteToString(size));
} else {
txtvPos.setText("");
}
}, error -> {
txtvPos.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else {
txtvPos.setText("");
}
} else {
txtvPos.setText(Converter.getDurationStringLong(media.getDuration()));
}
}
}

View File

@ -1,33 +1,13 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import androidx.core.content.ContextCompat;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.DateUtils;
import de.danoeh.antennapod.core.util.LongList;
import de.danoeh.antennapod.core.util.ThemeUtils;
import de.danoeh.antennapod.view.EpisodeItemViewHolder;
/**
* List adapter for items of feeds that the user has already subscribed to.
@ -35,27 +15,20 @@ import de.danoeh.antennapod.core.util.ThemeUtils;
public class FeedItemlistAdapter extends BaseAdapter {
private final ItemAccess itemAccess;
private final Context context;
private final boolean showFeedtitle;
private final MainActivity activity;
/** true if played items should be made partially transparent */
private final boolean makePlayedItemsTransparent;
private final int playingBackGroundColor;
private final int normalBackGroundColor;
private int currentlyPlayingItem = -1;
public FeedItemlistAdapter(Context context,
public FeedItemlistAdapter(MainActivity activity,
ItemAccess itemAccess,
boolean showFeedtitle,
boolean makePlayedItemsTransparent) {
super();
this.context = context;
this.activity = activity;
this.itemAccess = itemAccess;
this.showFeedtitle = showFeedtitle;
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
playingBackGroundColor = ThemeUtils.getColorFromAttr(context, R.attr.currently_playing_background);
normalBackGroundColor = ContextCompat.getColor(context, android.R.color.transparent);
}
@Override
@ -75,130 +48,22 @@ public class FeedItemlistAdapter extends BaseAdapter {
}
@Override
@SuppressWarnings("ResourceType")
public View getView(final int position, View convertView, ViewGroup parent) {
Holder holder;
final FeedItem item = getItem(position);
EpisodeItemViewHolder holder;
if (convertView == null) {
holder = new Holder();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.feeditemlist_item, parent, false);
holder.container = convertView
.findViewById(R.id.container);
holder.title = convertView.findViewById(R.id.txtvItemname);
if(Build.VERSION.SDK_INT >= 23) {
holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
}
holder.lenSize = convertView
.findViewById(R.id.txtvLenSize);
holder.butAction = convertView
.findViewById(R.id.butSecondaryAction);
holder.published = convertView
.findViewById(R.id.txtvPublished);
holder.inPlaylist = convertView
.findViewById(R.id.imgvInPlaylist);
holder.type = convertView.findViewById(R.id.imgvType);
holder.statusUnread = convertView
.findViewById(R.id.statusUnread);
holder.episodeProgress = convertView
.findViewById(R.id.pbar_episode_progress);
convertView.setTag(holder);
holder = new EpisodeItemViewHolder(activity);
} else {
holder = (Holder) convertView.getTag();
holder = (EpisodeItemViewHolder) convertView.getTag();
}
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
convertView.setVisibility(View.VISIBLE);
final FeedItem item = getItem(position);
holder.bind(item);
holder.dragHandle.setVisibility(View.GONE);
StringBuilder buffer = new StringBuilder(item.getTitle());
if (showFeedtitle) {
buffer.append(" (");
buffer.append(item.getFeed().getTitle());
buffer.append(")");
}
holder.title.setText(buffer.toString());
if(item.isNew()) {
holder.statusUnread.setVisibility(View.VISIBLE);
} else {
holder.statusUnread.setVisibility(View.INVISIBLE);
}
if(item.isPlayed() && makePlayedItemsTransparent) {
convertView.setAlpha(0.5f);
} else {
convertView.setAlpha(1.0f);
}
String pubDateStr = DateUtils.formatAbbrev(context, item.getPubDate());
holder.published.setText(pubDateStr);
boolean isInQueue = item.isTagged(FeedItem.TAG_QUEUE);
FeedMedia media = item.getMedia();
if (media == null) {
holder.episodeProgress.setVisibility(View.INVISIBLE);
holder.inPlaylist.setVisibility(View.INVISIBLE);
holder.type.setVisibility(View.INVISIBLE);
holder.lenSize.setVisibility(View.INVISIBLE);
} else {
AdapterUtils.updateEpisodePlaybackProgress(item, holder.lenSize, holder.episodeProgress);
if (isInQueue) {
holder.inPlaylist.setVisibility(View.VISIBLE);
} else {
holder.inPlaylist.setVisibility(View.INVISIBLE);
}
if (DownloadRequester.getInstance().isDownloadingFile(item.getMedia())) {
holder.episodeProgress.setVisibility(View.VISIBLE);
holder.episodeProgress.setProgress(itemAccess.getItemDownloadProgressPercent(item));
} else {
if(media.getPosition() == 0) {
holder.episodeProgress.setVisibility(View.INVISIBLE);
}
}
TypedArray typeDrawables = context.obtainStyledAttributes(
new int[]{R.attr.type_audio, R.attr.type_video});
final int[] labels = new int[]{R.string.media_type_audio_label, R.string.media_type_video_label};
MediaType mediaType = item.getMedia().getMediaType();
if (mediaType == MediaType.AUDIO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(0));
holder.type.setContentDescription(context.getString(labels[0]));
holder.type.setVisibility(View.VISIBLE);
} else if (mediaType == MediaType.VIDEO) {
holder.type.setImageDrawable(typeDrawables.getDrawable(1));
holder.type.setContentDescription(context.getString(labels[1]));
holder.type.setVisibility(View.VISIBLE);
} else {
holder.type.setImageBitmap(null);
holder.type.setVisibility(View.GONE);
}
typeDrawables.recycle();
if (media.isCurrentlyPlaying()) {
holder.container.setBackgroundColor(playingBackGroundColor);
currentlyPlayingItem = position;
} else {
holder.container.setBackgroundColor(normalBackGroundColor);
}
}
ItemActionButton actionButton = ItemActionButton.forItem(item, isInQueue);
actionButton.configure(holder.butAction, context);
holder.butAction.setFocusable(false);
holder.butAction.setTag(item);
} else {
convertView.setVisibility(View.GONE);
if (item.getMedia() != null && item.getMedia().isCurrentlyPlaying()) {
currentlyPlayingItem = position;
}
return convertView;
return holder.itemView;
}
public void notifyCurrentlyPlayingItemChanged(PlaybackPositionEvent event, ListView listView) {
@ -208,35 +73,15 @@ public class FeedItemlistAdapter extends BaseAdapter {
if (view == null) {
return;
}
Holder holder = (Holder) view.getTag();
holder.episodeProgress.setVisibility(View.VISIBLE);
holder.episodeProgress.setProgress((int) (100.0 * event.getPosition() / event.getDuration()));
holder.lenSize.setText(Converter.getDurationStringLong(event.getDuration() - event.getPosition()));
EpisodeItemViewHolder holder = (EpisodeItemViewHolder) view.getTag();
holder.notifyPlaybackPositionUpdated(event);
}
}
static class Holder {
LinearLayout container;
TextView title;
TextView published;
TextView lenSize;
ImageView type;
ImageView inPlaylist;
ImageButton butAction;
View statusUnread;
ProgressBar episodeProgress;
}
public interface ItemAccess {
int getItemDownloadProgressPercent(FeedItem item);
int getCount();
FeedItem getItem(int position);
LongList getQueueIds();
}
}

View File

@ -424,7 +424,7 @@ public class FeedItemlistFragment extends ListFragment {
setListAdapter(null);
setupHeaderView();
setupFooterView();
adapter = new FeedItemlistAdapter(getActivity(), itemAccess, false, true);
adapter = new FeedItemlistAdapter((MainActivity) getActivity(), itemAccess, false, true);
setListAdapter(adapter);
}
refreshHeaderView();
@ -574,40 +574,13 @@ public class FeedItemlistFragment extends ListFragment {
}
}
@Override
public LongList getQueueIds() {
LongList queueIds = new LongList();
if(feed == null) {
return queueIds;
}
for(FeedItem item : feed.getItems()) {
if(item.isTagged(FeedItem.TAG_QUEUE)) {
queueIds.add(item.getId());
}
}
return queueIds;
}
@Override
public int getCount() {
return (feed != null) ? feed.getNumOfItems() : 0;
}
@Override
public int getItemDownloadProgressPercent(FeedItem item) {
if (downloaderList != null) {
for (Downloader downloader : downloaderList) {
if (downloader.getDownloadRequest().getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA
&& downloader.getDownloadRequest().getFeedfileId() == item.getMedia().getId()) {
return downloader.getDownloadRequest().getProgressPercent();
}
}
}
return 0;
}
};
private void loadItems() {
if(disposable != null) {
disposable.dispose();

View File

@ -73,7 +73,7 @@ public class PlaybackHistoryFragment extends ListFragment {
// played items shoudln't be transparent for this fragment since, *all* items
// in this fragment will, by definition, be played. So it serves no purpose and can make
// it harder to read.
adapter = new FeedItemlistAdapter(getActivity(), itemAccess, true, false);
adapter = new FeedItemlistAdapter((MainActivity) getActivity(), itemAccess, true, false);
setListAdapter(adapter);
}
@ -180,19 +180,6 @@ public class PlaybackHistoryFragment extends ListFragment {
private final FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
@Override
public int getItemDownloadProgressPercent(FeedItem item) {
if (downloaderList != null) {
for (Downloader downloader : downloaderList) {
if (downloader.getDownloadRequest().getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA
&& downloader.getDownloadRequest().getFeedfileId() == item.getMedia().getId()) {
return downloader.getDownloadRequest().getProgressPercent();
}
}
}
return 0;
}
@Override
public int getCount() {
return (playbackHistory != null) ? playbackHistory.size() : 0;
@ -206,20 +193,6 @@ public class PlaybackHistoryFragment extends ListFragment {
return null;
}
}
@Override
public LongList getQueueIds() {
LongList queueIds = new LongList();
if(playbackHistory == null) {
return queueIds;
}
for (FeedItem item : playbackHistory) {
if (item.isTagged(FeedItem.TAG_QUEUE)) {
queueIds.add(item.getId());
}
}
return queueIds;
}
};
private void loadItems() {

View File

@ -21,6 +21,7 @@ import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.feed.FeedMedia;
import de.danoeh.antennapod.core.feed.MediaType;
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.core.storage.DownloadRequester;
@ -42,8 +43,12 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
private final ImageView cover;
private final TextView title;
private final TextView pubDate;
private final TextView progressLeft;
private final TextView progressRight;
private final TextView position;
private final TextView duration;
private final TextView size;
private final TextView isNew;
private final ImageView isInQueue;
private final ImageView isVideo;
private final ProgressBar progressBar;
private final ImageButton butSecondary;
private final MainActivity activity;
@ -51,7 +56,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
private FeedItem item;
public EpisodeItemViewHolder(MainActivity activity) {
super(View.inflate(activity, R.layout.queue_listitem, null));
super(View.inflate(activity, R.layout.feeditemlist_item, null));
this.activity = activity;
container = itemView.findViewById(R.id.container);
dragHandle = itemView.findViewById(R.id.drag_handle);
@ -62,10 +67,14 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
}
pubDate = itemView.findViewById(R.id.txtvPubDate);
progressLeft = itemView.findViewById(R.id.txtvProgressLeft);
progressRight = itemView.findViewById(R.id.txtvProgressRight);
position = itemView.findViewById(R.id.txtvProgressLeft);
duration = itemView.findViewById(R.id.txtvProgressRight);
butSecondary = itemView.findViewById(R.id.butSecondaryAction);
progressBar = itemView.findViewById(R.id.progressBar);
isInQueue = itemView.findViewById(R.id.ivInPlaylist);
isVideo = itemView.findViewById(R.id.ivIsVideo);
isNew = itemView.findViewById(R.id.statusUnread);
size = itemView.findViewById(R.id.size);
itemView.setTag(this);
}
@ -84,59 +93,13 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
placeholder.setText(item.getFeed().getTitle());
title.setText(item.getTitle());
title.setText(item.getTitle());
pubDate.setText(formatPubDate());
pubDate.setText(DateUtils.formatAbbrev(activity, item.getPubDate()));
isNew.setVisibility(item.isNew() ? View.VISIBLE : View.INVISIBLE);
isInQueue.setVisibility(item.isTagged(FeedItem.TAG_QUEUE) ? View.VISIBLE : View.INVISIBLE);
itemView.setAlpha(item.isPlayed() /*&& makePlayedItemsTransparent*/ ? 0.5f : 1.0f);
FeedMedia media = item.getMedia();
if (media != null) {
final DownloadRequest downloadRequest = DownloadRequester.getInstance().getRequestFor(media);
FeedItem.State state = item.getState();
if (downloadRequest != null) {
progressLeft.setText(Converter.byteToString(downloadRequest.getSoFar()));
if (downloadRequest.getSize() > 0) {
progressRight.setText(Converter.byteToString(downloadRequest.getSize()));
} else {
progressRight.setText(Converter.byteToString(media.getSize()));
}
progressBar.setProgress(downloadRequest.getProgressPercent());
progressBar.setVisibility(View.VISIBLE);
} else if (state == FeedItem.State.PLAYING || state == FeedItem.State.IN_PROGRESS) {
if (media.getDuration() > 0) {
int progress = (int) (100.0 * media.getPosition() / media.getDuration());
progressBar.setProgress(progress);
progressBar.setVisibility(View.VISIBLE);
progressLeft.setText(Converter.getDurationStringLong(media.getPosition()));
progressRight.setText(Converter.getDurationStringLong(media.getDuration()));
}
} else {
if (media.getSize() > 0) {
progressLeft.setText(Converter.byteToString(media.getSize()));
} else if (NetworkUtils.isEpisodeHeadDownloadAllowed() && !media.checkedOnSizeButUnknown()) {
progressLeft.setText("{fa-spinner}");
Iconify.addIcons(progressLeft);
NetworkUtils.getFeedMediaSizeObservable(media).subscribe(
size -> {
if (size > 0) {
progressLeft.setText(Converter.byteToString(size));
} else {
progressLeft.setText("");
}
}, error -> {
progressLeft.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else {
progressLeft.setText("");
}
progressRight.setText(Converter.getDurationStringLong(media.getDuration()));
progressBar.setVisibility(View.INVISIBLE);
}
if (media.isCurrentlyPlaying()) {
container.setBackgroundColor(ThemeUtils.getColorFromAttr(activity,
R.attr.currently_playing_background));
} else {
container.setBackgroundColor(Color.TRANSPARENT);
}
if (item.getMedia() != null) {
bind(item.getMedia());
}
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
@ -152,22 +115,56 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
.load();
}
private String formatPubDate() {
String pubDateStr = DateUtils.formatAbbrev(activity, item.getPubDate());
int index = 0;
if (countMatches(pubDateStr, ' ') == 1 || countMatches(pubDateStr, ' ') == 2) {
index = pubDateStr.lastIndexOf(' ');
} else if (countMatches(pubDateStr, '.') == 2) {
index = pubDateStr.lastIndexOf('.');
} else if (countMatches(pubDateStr, '-') == 2) {
index = pubDateStr.lastIndexOf('-');
} else if (countMatches(pubDateStr, '/') == 2) {
index = pubDateStr.lastIndexOf('/');
private void bind(FeedMedia media) {
isVideo.setVisibility(media.getMediaType() == MediaType.VIDEO ? View.VISIBLE : View.INVISIBLE);
duration.setText(Converter.getDurationStringLong(media.getDuration()));
if (media.isCurrentlyPlaying()) {
container.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.currently_playing_background));
} else {
container.setBackgroundColor(Color.TRANSPARENT);
}
if (index > 0) {
pubDateStr = pubDateStr.substring(0, index+1).trim() + "\n" + pubDateStr.substring(index+1);
final DownloadRequest downloadRequest = DownloadRequester.getInstance().getRequestFor(media);
progressBar.setVisibility(View.INVISIBLE);
if (downloadRequest != null) {
position.setText(Converter.byteToString(downloadRequest.getSoFar()));
if (downloadRequest.getSize() > 0) {
duration.setText(Converter.byteToString(downloadRequest.getSize()));
} else {
duration.setText(Converter.byteToString(media.getSize()));
}
progressBar.setProgress(downloadRequest.getProgressPercent());
progressBar.setVisibility(View.VISIBLE);
} else if (item.getState() == FeedItem.State.PLAYING || item.getState() == FeedItem.State.IN_PROGRESS) {
if (media.getDuration() > 0) {
int progress = (int) (100.0 * media.getPosition() / media.getDuration());
progressBar.setProgress(progress);
progressBar.setVisibility(View.VISIBLE);
position.setText(Converter.getDurationStringLong(media.getPosition()));
duration.setText(Converter.getDurationStringLong(media.getDuration()));
}
}
if (media.getSize() > 0) {
size.setText(Converter.byteToString(media.getSize()));
} else if (NetworkUtils.isEpisodeHeadDownloadAllowed() && !media.checkedOnSizeButUnknown()) {
size.setText("{fa-spinner}");
Iconify.addIcons(size);
NetworkUtils.getFeedMediaSizeObservable(media).subscribe(
sizeValue -> {
if (sizeValue > 0) {
size.setText(Converter.byteToString(sizeValue));
} else {
size.setText("");
}
}, error -> {
size.setText("");
Log.e(TAG, Log.getStackTraceString(error));
});
} else {
size.setText("");
}
return pubDateStr;
}
public boolean isCurrentlyPlayingItem() {
@ -176,21 +173,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
public void notifyPlaybackPositionUpdated(PlaybackPositionEvent event) {
progressBar.setProgress((int) (100.0 * event.getPosition() / event.getDuration()));
progressLeft.setText(Converter.getDurationStringLong(event.getPosition()));
progressRight.setText(Converter.getDurationStringLong(event.getDuration()));
}
// Oh Xiaomi, I hate you so much. How did you manage to fuck this up?
private static int countMatches(final CharSequence str, final char ch) {
if (TextUtils.isEmpty(str)) {
return 0;
}
int count = 0;
for (int i = 0; i < str.length(); i++) {
if (ch == str.charAt(i)) {
count++;
}
}
return count;
position.setText(Converter.getDurationStringLong(event.getPosition()));
duration.setText(Converter.getDurationStringLong(event.getDuration()));
}
}

View File

@ -1,125 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="150dp">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:background="@android:color/darker_gray">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding"
android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding"
android:layout_weight="1"
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
tools:background="@android:color/holo_orange_dark">
<TextView
android:id="@+id/statusUnread"
style="@style/AntennaPod.TextView.UnreadIndicator"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
tools:text="NEW"
tools:background="@android:color/white" />
<TextView
android:id="@+id/txtvItemname"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/statusUnread"
android:layout_toStartOf="@id/statusUnread"
tools:text="Episode title"
tools:background="@android:color/holo_green_dark" />
<TextView
android:id="@+id/txtvLenSize"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@id/txtvItemname"
tools:text="00:42:23"
tools:background="@android:color/holo_green_dark" />
android:layout_marginStart="8dp" >
<ImageView
android:id="@+id/imgvInPlaylist"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/txtvItemname"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:contentDescription="@string/in_queue_label"
android:src="?attr/stat_playlist"
android:visibility="visible"
tools:src="@drawable/ic_list_white_24dp"
tools:background="@android:color/holo_red_light" />
android:id="@+id/drag_handle"
android:layout_width="104dp"
android:layout_height="64dp"
android:layout_marginLeft="-16dp"
android:layout_marginStart="-16dp"
android:layout_marginRight="-72dp"
android:layout_marginEnd="-72dp"
android:contentDescription="@string/drag_handle_content_description"
android:scaleType="fitXY"
android:src="?attr/dragview_background"
tools:src="@drawable/ic_drag_vertical_grey600_48dp"
tools:background="@android:color/holo_green_dark" />
<ImageView
android:id="@+id/imgvType"
android:layout_width="@dimen/enc_icons_size"
android:layout_height="@dimen/enc_icons_size"
android:layout_below="@id/txtvItemname"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_toLeftOf="@id/imgvInPlaylist"
android:layout_toStartOf="@id/imgvInPlaylist"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_hearing_white_18dp"
tools:background="@android:color/holo_red_light" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp">
<TextView
android:id="@+id/txtvPlaceholder"
android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_centerVertical="true"
android:gravity="center"
android:background="@color/light_gray"
android:maxLines="3"
android:ellipsize="end"/>
<ImageView
android:id="@+id/imgvCover"
android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_centerVertical="true"
android:contentDescription="@string/cover_label"
tools:src="@drawable/ic_antenna"
tools:background="@android:color/holo_green_dark"/>
</RelativeLayout>
<TextView
android:id="@+id/txtvPublished"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtvItemname"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_toLeftOf="@id/imgvType"
android:layout_toStartOf="@id/imgvType"
tools:text="Jan 23"
tools:background="@android:color/holo_green_dark" />
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding"
android:layout_marginStart="@dimen/listitem_threeline_textleftpadding"
android:layout_marginRight="@dimen/listitem_threeline_textrightpadding"
android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding"
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
android:layout_weight="1"
tools:background="@android:color/holo_red_dark">
<ProgressBar
android:id="@+id/pbar_episode_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/txtvPublished"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_toStartOf="@id/txtvPublished"
android:layout_toLeftOf="@id/txtvPublished"
android:layout_toEndOf="@id/txtvLenSize"
android:layout_toRightOf="@id/txtvLenSize"
android:layoutDirection="ltr"
android:indeterminate="false"
android:max="100"
android:progress="42"
tools:background="@android:color/holo_blue_light" />
<!-- order is important, pubDate first! -->
<TextView
android:id="@+id/txtvPubDate"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="2"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:gravity="end|top"
android:text="Feb\n12"
tools:background="@android:color/holo_blue_light" />
</RelativeLayout>
<TextView
android:id="@+id/txtvTitle"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/txtvPubDate"
android:layout_toStartOf="@id/txtvPubDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="Item title"
android:ellipsize="end"
tools:background="@android:color/holo_blue_light" />
<include layout="@layout/vertical_list_divider"/>
<RelativeLayout
android:id="@+id/bottom_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<include layout="@layout/secondary_action"/>
<TextView
android:id="@+id/txtvProgressLeft"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:text="00:42:23"
tools:background="@android:color/holo_blue_light"/>
</LinearLayout>
<TextView
android:id="@+id/txtvProgressRight"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="0dp"
tools:text="Jan 23"
tools:background="@android:color/holo_green_dark" />
<ProgressBar
android:id="@+id/progressBar"
style="?attr/progressBarTheme"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_below="@id/txtvProgressLeft"
android:layoutDirection="ltr"
android:max="100"
tools:background="@android:color/holo_blue_light" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_remove_red_eye_grey600_18dp"
android:id="@+id/ivIsVideo"
android:layout_below="@+id/progressBar"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_playlist_grey_24dp"
android:id="@+id/ivInPlaylist"
android:layout_below="@+id/progressBar"
android:layout_toEndOf="@+id/ivIsVideo"
android:layout_toRightOf="@+id/ivIsVideo"/>
<TextView
android:text="@string/new_episodes_label"
style="@style/AntennaPod.TextView.UnreadIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/statusUnread"
android:layout_toEndOf="@+id/ivInPlaylist"
android:layout_toRightOf="@+id/ivInPlaylist"
android:layout_below="@+id/progressBar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/size"
android:layout_toEndOf="@+id/statusUnread"
android:layout_toRightOf="@+id/statusUnread"
android:layout_below="@+id/progressBar"/>
</RelativeLayout>
</RelativeLayout>
<include layout="@layout/vertical_list_divider"/>
<include layout="@layout/secondary_action"/>
</LinearLayout>
</FrameLayout>

View File

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/container"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
tools:background="@android:color/darker_gray" >
<ImageView
android:id="@+id/drag_handle"
android:layout_width="104dp"
android:layout_height="64dp"
android:layout_marginLeft="-16dp"
android:layout_marginStart="-16dp"
android:layout_marginRight="-72dp"
android:layout_marginEnd="-72dp"
android:contentDescription="@string/drag_handle_content_description"
android:scaleType="fitXY"
android:src="?attr/dragview_background"
tools:src="@drawable/ic_drag_vertical_grey600_48dp"
tools:background="@android:color/holo_green_dark" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp">
<TextView
android:id="@+id/txtvPlaceholder"
android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_centerVertical="true"
android:gravity="center"
android:background="@color/light_gray"
android:maxLines="3"
android:ellipsize="end"/>
<ImageView
android:id="@+id/imgvCover"
android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_centerVertical="true"
android:contentDescription="@string/cover_label"
tools:src="@drawable/ic_antenna"
tools:background="@android:color/holo_green_dark"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding"
android:layout_marginStart="@dimen/listitem_threeline_textleftpadding"
android:layout_marginRight="@dimen/listitem_threeline_textrightpadding"
android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding"
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
android:layout_weight="1"
tools:background="@android:color/holo_red_dark">
<!-- order is important, pubDate first! -->
<TextView
android:id="@+id/txtvPubDate"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="2"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:gravity="end|top"
android:text="Feb\n12"
tools:background="@android:color/holo_blue_light" />
<TextView
android:id="@+id/txtvTitle"
style="@style/AntennaPod.TextView.ListItemPrimaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/txtvPubDate"
android:layout_toStartOf="@id/txtvPubDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:text="Queue item title"
android:ellipsize="end"
tools:background="@android:color/holo_blue_light" />
<RelativeLayout
android:id="@+id/bottom_bar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/txtvTitle"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/txtvProgressLeft"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:text="00:42:23"
tools:background="@android:color/holo_blue_light"/>
<TextView
android:id="@+id/txtvProgressRight"
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="0dp"
tools:text="Jan 23"
tools:background="@android:color/holo_green_dark" />
<ProgressBar
android:id="@+id/progressBar"
style="?attr/progressBarTheme"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_below="@id/txtvProgressLeft"
android:layoutDirection="ltr"
android:max="100"
tools:background="@android:color/holo_blue_light" />
</RelativeLayout>
</RelativeLayout>
<include layout="@layout/vertical_list_divider"/>
<include layout="@layout/secondary_action"/>
</LinearLayout>
</FrameLayout>