Converted FeedItemlistAdapter to use new EpisodeItemViewHolder
This commit is contained in:
parent
cae04b5b13
commit
1313cde481
|
@ -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()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,33 +1,13 @@
|
||||||
package de.danoeh.antennapod.adapter;
|
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.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Adapter;
|
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
|
||||||
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
|
||||||
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
|
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
import de.danoeh.antennapod.view.EpisodeItemViewHolder;
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List adapter for items of feeds that the user has already subscribed to.
|
* 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 {
|
public class FeedItemlistAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private final ItemAccess itemAccess;
|
private final ItemAccess itemAccess;
|
||||||
private final Context context;
|
private final MainActivity activity;
|
||||||
private final boolean showFeedtitle;
|
|
||||||
/** true if played items should be made partially transparent */
|
/** true if played items should be made partially transparent */
|
||||||
private final boolean makePlayedItemsTransparent;
|
private final boolean makePlayedItemsTransparent;
|
||||||
private final int playingBackGroundColor;
|
|
||||||
private final int normalBackGroundColor;
|
|
||||||
|
|
||||||
private int currentlyPlayingItem = -1;
|
private int currentlyPlayingItem = -1;
|
||||||
|
|
||||||
public FeedItemlistAdapter(Context context,
|
public FeedItemlistAdapter(MainActivity activity,
|
||||||
ItemAccess itemAccess,
|
ItemAccess itemAccess,
|
||||||
boolean showFeedtitle,
|
boolean showFeedtitle,
|
||||||
boolean makePlayedItemsTransparent) {
|
boolean makePlayedItemsTransparent) {
|
||||||
super();
|
super();
|
||||||
this.context = context;
|
this.activity = activity;
|
||||||
this.itemAccess = itemAccess;
|
this.itemAccess = itemAccess;
|
||||||
this.showFeedtitle = showFeedtitle;
|
|
||||||
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
|
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
|
||||||
|
|
||||||
playingBackGroundColor = ThemeUtils.getColorFromAttr(context, R.attr.currently_playing_background);
|
|
||||||
normalBackGroundColor = ContextCompat.getColor(context, android.R.color.transparent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,130 +48,22 @@ public class FeedItemlistAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("ResourceType")
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
Holder holder;
|
EpisodeItemViewHolder holder;
|
||||||
final FeedItem item = getItem(position);
|
|
||||||
|
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
holder = new Holder();
|
holder = new EpisodeItemViewHolder(activity);
|
||||||
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);
|
|
||||||
} else {
|
} else {
|
||||||
holder = (Holder) convertView.getTag();
|
holder = (EpisodeItemViewHolder) convertView.getTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
|
final FeedItem item = getItem(position);
|
||||||
convertView.setVisibility(View.VISIBLE);
|
holder.bind(item);
|
||||||
|
holder.dragHandle.setVisibility(View.GONE);
|
||||||
|
|
||||||
StringBuilder buffer = new StringBuilder(item.getTitle());
|
if (item.getMedia() != null && item.getMedia().isCurrentlyPlaying()) {
|
||||||
if (showFeedtitle) {
|
currentlyPlayingItem = position;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
return convertView;
|
return holder.itemView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyCurrentlyPlayingItemChanged(PlaybackPositionEvent event, ListView listView) {
|
public void notifyCurrentlyPlayingItemChanged(PlaybackPositionEvent event, ListView listView) {
|
||||||
|
@ -208,35 +73,15 @@ public class FeedItemlistAdapter extends BaseAdapter {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Holder holder = (Holder) view.getTag();
|
EpisodeItemViewHolder holder = (EpisodeItemViewHolder) view.getTag();
|
||||||
holder.episodeProgress.setVisibility(View.VISIBLE);
|
holder.notifyPlaybackPositionUpdated(event);
|
||||||
holder.episodeProgress.setProgress((int) (100.0 * event.getPosition() / event.getDuration()));
|
|
||||||
holder.lenSize.setText(Converter.getDurationStringLong(event.getDuration() - event.getPosition()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Holder {
|
|
||||||
LinearLayout container;
|
|
||||||
TextView title;
|
|
||||||
TextView published;
|
|
||||||
TextView lenSize;
|
|
||||||
ImageView type;
|
|
||||||
ImageView inPlaylist;
|
|
||||||
ImageButton butAction;
|
|
||||||
View statusUnread;
|
|
||||||
ProgressBar episodeProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ItemAccess {
|
public interface ItemAccess {
|
||||||
|
|
||||||
int getItemDownloadProgressPercent(FeedItem item);
|
|
||||||
|
|
||||||
int getCount();
|
int getCount();
|
||||||
|
|
||||||
FeedItem getItem(int position);
|
FeedItem getItem(int position);
|
||||||
|
|
||||||
LongList getQueueIds();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,7 +424,7 @@ public class FeedItemlistFragment extends ListFragment {
|
||||||
setListAdapter(null);
|
setListAdapter(null);
|
||||||
setupHeaderView();
|
setupHeaderView();
|
||||||
setupFooterView();
|
setupFooterView();
|
||||||
adapter = new FeedItemlistAdapter(getActivity(), itemAccess, false, true);
|
adapter = new FeedItemlistAdapter((MainActivity) getActivity(), itemAccess, false, true);
|
||||||
setListAdapter(adapter);
|
setListAdapter(adapter);
|
||||||
}
|
}
|
||||||
refreshHeaderView();
|
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
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return (feed != null) ? feed.getNumOfItems() : 0;
|
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() {
|
private void loadItems() {
|
||||||
if(disposable != null) {
|
if(disposable != null) {
|
||||||
disposable.dispose();
|
disposable.dispose();
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||||
// played items shoudln't be transparent for this fragment since, *all* items
|
// 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
|
// in this fragment will, by definition, be played. So it serves no purpose and can make
|
||||||
// it harder to read.
|
// it harder to read.
|
||||||
adapter = new FeedItemlistAdapter(getActivity(), itemAccess, true, false);
|
adapter = new FeedItemlistAdapter((MainActivity) getActivity(), itemAccess, true, false);
|
||||||
setListAdapter(adapter);
|
setListAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,19 +180,6 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||||
|
|
||||||
private final FeedItemlistAdapter.ItemAccess itemAccess = new FeedItemlistAdapter.ItemAccess() {
|
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
|
@Override
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return (playbackHistory != null) ? playbackHistory.size() : 0;
|
return (playbackHistory != null) ? playbackHistory.size() : 0;
|
||||||
|
@ -206,20 +193,6 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||||
return null;
|
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() {
|
private void loadItems() {
|
||||||
|
|
|
@ -21,6 +21,7 @@ import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
|
||||||
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
|
import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
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.feed.util.ImageResourceUtils;
|
||||||
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
import de.danoeh.antennapod.core.service.download.DownloadRequest;
|
||||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||||
|
@ -42,8 +43,12 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
private final ImageView cover;
|
private final ImageView cover;
|
||||||
private final TextView title;
|
private final TextView title;
|
||||||
private final TextView pubDate;
|
private final TextView pubDate;
|
||||||
private final TextView progressLeft;
|
private final TextView position;
|
||||||
private final TextView progressRight;
|
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 ProgressBar progressBar;
|
||||||
private final ImageButton butSecondary;
|
private final ImageButton butSecondary;
|
||||||
private final MainActivity activity;
|
private final MainActivity activity;
|
||||||
|
@ -51,7 +56,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
private FeedItem item;
|
private FeedItem item;
|
||||||
|
|
||||||
public EpisodeItemViewHolder(MainActivity activity) {
|
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;
|
this.activity = activity;
|
||||||
container = itemView.findViewById(R.id.container);
|
container = itemView.findViewById(R.id.container);
|
||||||
dragHandle = itemView.findViewById(R.id.drag_handle);
|
dragHandle = itemView.findViewById(R.id.drag_handle);
|
||||||
|
@ -62,10 +67,14 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
|
title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL);
|
||||||
}
|
}
|
||||||
pubDate = itemView.findViewById(R.id.txtvPubDate);
|
pubDate = itemView.findViewById(R.id.txtvPubDate);
|
||||||
progressLeft = itemView.findViewById(R.id.txtvProgressLeft);
|
position = itemView.findViewById(R.id.txtvProgressLeft);
|
||||||
progressRight = itemView.findViewById(R.id.txtvProgressRight);
|
duration = itemView.findViewById(R.id.txtvProgressRight);
|
||||||
butSecondary = itemView.findViewById(R.id.butSecondaryAction);
|
butSecondary = itemView.findViewById(R.id.butSecondaryAction);
|
||||||
progressBar = itemView.findViewById(R.id.progressBar);
|
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);
|
itemView.setTag(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,59 +93,13 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
placeholder.setText(item.getFeed().getTitle());
|
placeholder.setText(item.getFeed().getTitle());
|
||||||
title.setText(item.getTitle());
|
title.setText(item.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 (item.getMedia() != null) {
|
||||||
if (media != null) {
|
bind(item.getMedia());
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
|
ItemActionButton actionButton = ItemActionButton.forItem(item, true);
|
||||||
|
@ -152,22 +115,56 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
.load();
|
.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatPubDate() {
|
private void bind(FeedMedia media) {
|
||||||
String pubDateStr = DateUtils.formatAbbrev(activity, item.getPubDate());
|
isVideo.setVisibility(media.getMediaType() == MediaType.VIDEO ? View.VISIBLE : View.INVISIBLE);
|
||||||
int index = 0;
|
duration.setText(Converter.getDurationStringLong(media.getDuration()));
|
||||||
if (countMatches(pubDateStr, ' ') == 1 || countMatches(pubDateStr, ' ') == 2) {
|
|
||||||
index = pubDateStr.lastIndexOf(' ');
|
if (media.isCurrentlyPlaying()) {
|
||||||
} else if (countMatches(pubDateStr, '.') == 2) {
|
container.setBackgroundColor(ThemeUtils.getColorFromAttr(activity, R.attr.currently_playing_background));
|
||||||
index = pubDateStr.lastIndexOf('.');
|
} else {
|
||||||
} else if (countMatches(pubDateStr, '-') == 2) {
|
container.setBackgroundColor(Color.TRANSPARENT);
|
||||||
index = pubDateStr.lastIndexOf('-');
|
|
||||||
} else if (countMatches(pubDateStr, '/') == 2) {
|
|
||||||
index = pubDateStr.lastIndexOf('/');
|
|
||||||
}
|
}
|
||||||
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() {
|
public boolean isCurrentlyPlayingItem() {
|
||||||
|
@ -176,21 +173,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
|
||||||
|
|
||||||
public void notifyPlaybackPositionUpdated(PlaybackPositionEvent event) {
|
public void notifyPlaybackPositionUpdated(PlaybackPositionEvent event) {
|
||||||
progressBar.setProgress((int) (100.0 * event.getPosition() / event.getDuration()));
|
progressBar.setProgress((int) (100.0 * event.getPosition() / event.getDuration()));
|
||||||
progressLeft.setText(Converter.getDurationStringLong(event.getPosition()));
|
position.setText(Converter.getDurationStringLong(event.getPosition()));
|
||||||
progressRight.setText(Converter.getDurationStringLong(event.getDuration()));
|
duration.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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,125 +1,184 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:layout_width="match_parent"
|
||||||
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"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:orientation="horizontal"
|
||||||
android:layout_alignParentEnd="true"
|
android:gravity="center_vertical"
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginStart="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" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imgvInPlaylist"
|
android:id="@+id/drag_handle"
|
||||||
android:layout_width="@dimen/enc_icons_size"
|
android:layout_width="104dp"
|
||||||
android:layout_height="@dimen/enc_icons_size"
|
android:layout_height="64dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_marginLeft="-16dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginStart="-16dp"
|
||||||
android:layout_below="@id/txtvItemname"
|
android:layout_marginRight="-72dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginEnd="-72dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:contentDescription="@string/drag_handle_content_description"
|
||||||
android:contentDescription="@string/in_queue_label"
|
android:scaleType="fitXY"
|
||||||
android:src="?attr/stat_playlist"
|
android:src="?attr/dragview_background"
|
||||||
android:visibility="visible"
|
tools:src="@drawable/ic_drag_vertical_grey600_48dp"
|
||||||
tools:src="@drawable/ic_list_white_24dp"
|
tools:background="@android:color/holo_green_dark" />
|
||||||
tools:background="@android:color/holo_red_light" />
|
|
||||||
|
|
||||||
<ImageView
|
<RelativeLayout
|
||||||
android:id="@+id/imgvType"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="@dimen/enc_icons_size"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="@dimen/enc_icons_size"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_below="@id/txtvItemname"
|
android:layout_marginStart="8dp">
|
||||||
android:layout_marginRight="8dp"
|
<TextView
|
||||||
android:layout_marginEnd="8dp"
|
android:id="@+id/txtvPlaceholder"
|
||||||
android:layout_toLeftOf="@id/imgvInPlaylist"
|
android:layout_width="@dimen/thumbnail_length_queue_item"
|
||||||
android:layout_toStartOf="@id/imgvInPlaylist"
|
android:layout_height="@dimen/thumbnail_length_queue_item"
|
||||||
tools:ignore="ContentDescription"
|
android:layout_centerVertical="true"
|
||||||
tools:src="@drawable/ic_hearing_white_18dp"
|
android:gravity="center"
|
||||||
tools:background="@android:color/holo_red_light" />
|
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
|
<RelativeLayout
|
||||||
android:id="@+id/txtvPublished"
|
android:layout_width="0dp"
|
||||||
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding"
|
||||||
android:layout_below="@id/txtvItemname"
|
android:layout_marginStart="@dimen/listitem_threeline_textleftpadding"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="@dimen/listitem_threeline_textrightpadding"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding"
|
||||||
android:layout_toLeftOf="@id/imgvType"
|
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
|
||||||
android:layout_toStartOf="@id/imgvType"
|
android:layout_weight="1"
|
||||||
tools:text="Jan 23"
|
tools:background="@android:color/holo_red_dark">
|
||||||
tools:background="@android:color/holo_green_dark" />
|
|
||||||
|
|
||||||
<ProgressBar
|
<!-- order is important, pubDate first! -->
|
||||||
android:id="@+id/pbar_episode_progress"
|
<TextView
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
android:id="@+id/txtvPubDate"
|
||||||
android:layout_width="0dp"
|
style="@style/AntennaPod.TextView.ListItemSecondaryTitle"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_alignBottom="@id/txtvPublished"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="8dp"
|
android:lines="2"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_toStartOf="@id/txtvPublished"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_toLeftOf="@id/txtvPublished"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_toEndOf="@id/txtvLenSize"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_toRightOf="@id/txtvLenSize"
|
android:layout_marginStart="8dp"
|
||||||
android:layoutDirection="ltr"
|
android:gravity="end|top"
|
||||||
android:indeterminate="false"
|
android:text="Feb\n12"
|
||||||
android:max="100"
|
tools:background="@android:color/holo_blue_light" />
|
||||||
android:progress="42"
|
|
||||||
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>
|
||||||
|
|
|
@ -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>
|
|
Loading…
Reference in New Issue