Check if this is the right fragment

This commit is contained in:
Martin Fietz 2015-11-06 00:32:31 +01:00
parent 51aba83ae2
commit 419e449b6f
2 changed files with 14 additions and 8 deletions

View File

@ -198,7 +198,9 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
}
public int getPosition() {
return position;
int pos = position;
position = -1; // reset
return pos;
}
private class CoverTarget extends GlideDrawableImageViewTarget {

View File

@ -96,12 +96,6 @@ public class AllEpisodesFragment extends Fragment {
setHasOptionsMenu(true);
}
@Override
public void onResume() {
super.onResume();
loadItems();
}
@Override
public void onStart() {
super.onStart();
@ -116,10 +110,18 @@ public class AllEpisodesFragment extends Fragment {
}
}
@Override
public void onResume() {
super.onResume();
loadItems();
registerForContextMenu(recyclerView);
}
@Override
public void onPause() {
super.onPause();
saveScrollPosition();
unregisterForContextMenu(recyclerView);
}
@Override
@ -269,6 +271,9 @@ public class AllEpisodesFragment extends Fragment {
return false;
}
int pos = listAdapter.getPosition();
if(pos < 0) {
return false;
}
FeedItem selectedItem = itemAccess.getItem(pos);
if (selectedItem == null) {
@ -305,7 +310,6 @@ public class AllEpisodesFragment extends Fragment {
recyclerView.setHasFixedSize(true);
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), null);
recyclerView.addItemDecoration(itemDecoration);
registerForContextMenu(recyclerView);
progLoading = (ProgressBar) root.findViewById(R.id.progLoading);