From d557621df953c72ffa525045e62d3840f1b93321 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 9 Jun 2020 21:39:49 +0200 Subject: [PATCH] Fixed leaking fragments in recycledViewPool --- .../antennapod/adapter/EpisodeItemListAdapter.java | 13 +++++++++++++ .../view/viewholder/EpisodeItemViewHolder.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/EpisodeItemListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/EpisodeItemListAdapter.java index 7099d6f3a..8efc89c9a 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/EpisodeItemListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/EpisodeItemListAdapter.java @@ -86,6 +86,19 @@ public class EpisodeItemListAdapter extends RecyclerView.Adapter recycledViewPool -> EpisodeItemViewHolder -> Listener -> Fragment (can not be garbage collected) + holder.itemView.setOnClickListener(null); + holder.secondaryActionButton.setOnClickListener(null); + holder.dragHandle.setOnTouchListener(null); + holder.coverHolder.setOnTouchListener(null); + holder.container.setOnCreateContextMenuListener(null); + holder.container.setOnLongClickListener(null); + } + /** * {@link #notifyItemChanged(int)} is final, so we can not override. * Calling {@link #notifyItemChanged(int)} may bind the item to a new ViewHolder and execute a transition. diff --git a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java index b7e1728b5..3c577f791 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/view/viewholder/EpisodeItemViewHolder.java @@ -39,7 +39,7 @@ import de.danoeh.antennapod.view.CircularProgressBar; public class EpisodeItemViewHolder extends RecyclerView.ViewHolder { private static final String TAG = "EpisodeItemViewHolder"; - private final View container; + public final View container; public final ImageView dragHandle; private final TextView placeholder; private final ImageView cover;