Do not treat position as fixed

This commit is contained in:
Martin Fietz 2018-01-10 23:21:53 +01:00
parent 33f8ead4a0
commit 249bf9bc18
1 changed files with 2 additions and 5 deletions

View File

@ -100,7 +100,6 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
holder.txtvDuration = (TextView) view.findViewById(R.id.txtvDuration);
holder.item = null;
holder.mainActivityRef = mainActivityRef;
holder.position = -1;
// so we can grab this later
view.setTag(holder);
@ -112,11 +111,10 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
final FeedItem item = itemAccess.getItem(position);
if (item == null) return;
holder.itemView.setOnLongClickListener(v -> {
this.position = position;
this.position = holder.getAdapterPosition();
return false;
});
holder.item = item;
holder.position = position;
holder.placeholder.setVisibility(View.VISIBLE);
holder.placeholder.setText(item.getFeed().getTitle());
holder.title.setText(item.getTitle());
@ -252,7 +250,6 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
ImageButton butSecondary;
FeedItem item;
WeakReference<MainActivity> mainActivityRef;
int position;
public Holder(View itemView) {
super(itemView);
@ -265,7 +262,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
MainActivity mainActivity = mainActivityRef.get();
if (mainActivity != null) {
long[] ids = itemAccess.getItemsIds().toArray();
mainActivity.loadChildFragment(ItemFragment.newInstance(ids, position));
mainActivity.loadChildFragment(ItemFragment.newInstance(ids, getAdapterPosition()));
}
}