Hide images on podcast details screen

This commit is contained in:
ByteHamster 2020-02-05 16:17:51 +01:00
parent 5a26207fdb
commit df99d684b7
4 changed files with 24 additions and 22 deletions

View File

@ -16,18 +16,19 @@ public class FeedItemlistAdapter extends BaseAdapter {
private final ItemAccess itemAccess; private final ItemAccess itemAccess;
private final MainActivity activity; private final MainActivity activity;
/** true if played items should be made partially transparent */
private final boolean makePlayedItemsTransparent; private final boolean makePlayedItemsTransparent;
private final boolean showIcons;
private int currentlyPlayingItem = -1; private int currentlyPlayingItem = -1;
public FeedItemlistAdapter(MainActivity activity, public FeedItemlistAdapter(MainActivity activity,
ItemAccess itemAccess, ItemAccess itemAccess,
boolean showFeedtitle, boolean showIcons,
boolean makePlayedItemsTransparent) { boolean makePlayedItemsTransparent) {
super(); super();
this.activity = activity; this.activity = activity;
this.itemAccess = itemAccess; this.itemAccess = itemAccess;
this.showIcons = showIcons;
this.makePlayedItemsTransparent = makePlayedItemsTransparent; this.makePlayedItemsTransparent = makePlayedItemsTransparent;
} }
@ -56,6 +57,10 @@ public class FeedItemlistAdapter extends BaseAdapter {
holder = (EpisodeItemViewHolder) convertView.getTag(); holder = (EpisodeItemViewHolder) convertView.getTag();
} }
if (!showIcons) {
holder.coverHolder.setVisibility(View.GONE);
}
final FeedItem item = getItem(position); final FeedItem item = getItem(position);
holder.bind(item); holder.bind(item);
holder.dragHandle.setVisibility(View.GONE); holder.dragHandle.setVisibility(View.GONE);

View File

@ -89,25 +89,18 @@ public class FeedItemlistFragment extends ListFragment {
private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id"; private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id";
private FeedItemlistAdapter adapter; private FeedItemlistAdapter adapter;
private ContextMenu contextMenu;
private AdapterView.AdapterContextMenuInfo lastMenuInfo = null; private AdapterView.AdapterContextMenuInfo lastMenuInfo = null;
private MoreContentListFooterUtil listFooter;
private long feedID; private long feedID;
private Feed feed; private Feed feed;
private boolean headerCreated = false; private boolean headerCreated = false;
private List<Downloader> downloaderList;
private MoreContentListFooterUtil listFooter;
private boolean isUpdatingFeed; private boolean isUpdatingFeed;
private TextView txtvTitle; private TextView txtvTitle;
private IconTextView txtvFailure; private IconTextView txtvFailure;
private ImageView imgvBackground; private ImageView imgvBackground;
private ImageView imgvCover; private ImageView imgvCover;
private TextView txtvInformation; private TextView txtvInformation;
private Disposable disposable; private Disposable disposable;
@ -305,7 +298,6 @@ public class FeedItemlistFragment extends ListFragment {
menu.setHeaderTitle(item.getTitle()); menu.setHeaderTitle(item.getTitle());
} }
contextMenu = menu;
lastMenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo; lastMenuInfo = (AdapterView.AdapterContextMenuInfo) menuInfo;
FeedItemMenuHandler.onPrepareMenu(menu, item); FeedItemMenuHandler.onPrepareMenu(menu, item);
} }
@ -366,7 +358,6 @@ public class FeedItemlistFragment extends ListFragment {
public void onEventMainThread(DownloadEvent event) { public void onEventMainThread(DownloadEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
DownloaderUpdate update = event.update; DownloaderUpdate update = event.update;
downloaderList = update.downloaders;
if (event.hasChangedFeedUpdateStatus(isUpdatingFeed)) { if (event.hasChangedFeedUpdateStatus(isUpdatingFeed)) {
updateProgressBarVisibility(); updateProgressBarVisibility();
} }

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.joanzapata.iconify.Iconify; import com.joanzapata.iconify.Iconify;
@ -54,9 +55,10 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
public final View secondaryActionButton; public final View secondaryActionButton;
public final ImageView secondaryActionIcon; public final ImageView secondaryActionIcon;
private final CircularProgressBar secondaryActionProgress; private final CircularProgressBar secondaryActionProgress;
private final MainActivity activity;
private final TextView separatorIcons; private final TextView separatorIcons;
public final RelativeLayout coverHolder;
private final MainActivity activity;
private FeedItem item; private FeedItem item;
public EpisodeItemViewHolder(MainActivity activity, ViewGroup parent) { public EpisodeItemViewHolder(MainActivity activity, ViewGroup parent) {
@ -83,6 +85,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
secondaryActionProgress = itemView.findViewById(R.id.secondaryActionProgress); secondaryActionProgress = itemView.findViewById(R.id.secondaryActionProgress);
secondaryActionButton = itemView.findViewById(R.id.secondaryActionButton); secondaryActionButton = itemView.findViewById(R.id.secondaryActionButton);
secondaryActionIcon = itemView.findViewById(R.id.secondaryActionIcon); secondaryActionIcon = itemView.findViewById(R.id.secondaryActionIcon);
coverHolder = itemView.findViewById(R.id.coverHolder);
itemView.setTag(this); itemView.setTag(this);
} }
@ -117,12 +120,14 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder
secondaryActionProgress.setPercentage(0, item); secondaryActionProgress.setPercentage(0, item);
} }
new CoverLoader(activity) if (coverHolder.getVisibility() == View.VISIBLE) {
.withUri(ImageResourceUtils.getImageLocation(item)) new CoverLoader(activity)
.withFallbackUri(item.getFeed().getImageLocation()) .withUri(ImageResourceUtils.getImageLocation(item))
.withPlaceholderView(placeholder) .withFallbackUri(item.getFeed().getImageLocation())
.withCoverView(cover) .withPlaceholderView(placeholder)
.load(); .withCoverView(cover)
.load();
}
} }
private void bind(FeedMedia media) { private void bind(FeedMedia media) {

View File

@ -30,7 +30,10 @@
android:layout_width="@dimen/thumbnail_length_queue_item" android:layout_width="@dimen/thumbnail_length_queue_item"
android:layout_height="@dimen/thumbnail_length_queue_item" android:layout_height="@dimen/thumbnail_length_queue_item"
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding"
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"> android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"
android:layout_marginRight="@dimen/listitem_threeline_textleftpadding"
android:layout_marginEnd="@dimen/listitem_threeline_textleftpadding"
android:id="@+id/coverHolder">
<TextView <TextView
android:id="@+id/txtvPlaceholder" android:id="@+id/txtvPlaceholder"
@ -55,8 +58,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" 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_marginRight="@dimen/listitem_threeline_textrightpadding"
android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding"
android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding"