diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-11-28 11:35:36 -0500 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-11-28 11:35:36 -0500 |
commit | 99f7aaa2286da2f3f12af3e152f84794f463c456 (patch) | |
tree | f9548719446c8517b901da50d7943630fa3f3ae5 /app | |
parent | cc93cd8600905ad831f90cb2bfa73570b74663c0 (diff) | |
parent | b5a753c1cd7148b837062283f1061063b3f14859 (diff) | |
download | AntennaPod-99f7aaa2286da2f3f12af3e152f84794f463c456.zip |
Merge pull request #1427 from TomHennen/fix_scoll_position
only restore scoll position if we're starting or resuming
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index e13fd76b3..3335310c1 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -100,7 +100,7 @@ public class QueueFragment extends Fragment { public void onStart() { super.onStart(); if (queue != null) { - onFragmentLoaded(); + onFragmentLoaded(true); } } @@ -108,7 +108,7 @@ public class QueueFragment extends Fragment { public void onResume() { super.onResume(); recyclerView.setAdapter(recyclerAdapter); - loadItems(); + loadItems(true); EventDistributor.getInstance().register(contentUpdate); EventBus.getDefault().registerSticky(this); } @@ -156,7 +156,7 @@ public class QueueFragment extends Fragment { return; } saveScrollPosition(); - onFragmentLoaded(); + onFragmentLoaded(false); } public void onEventMainThread(FeedItemEvent event) { @@ -450,7 +450,7 @@ public class QueueFragment extends Fragment { return root; } - private void onFragmentLoaded() { + private void onFragmentLoaded(final boolean restoreScrollPosition) { if (recyclerAdapter == null) { MainActivity activity = (MainActivity) getActivity(); recyclerAdapter = new QueueRecyclerAdapter(activity, itemAccess, @@ -465,7 +465,9 @@ public class QueueFragment extends Fragment { recyclerView.setVisibility(View.VISIBLE); } - restoreScrollPosition(); + if (restoreScrollPosition) { + restoreScrollPosition(); + } // we need to refresh the options menu because it sometimes // needs data that may have just been loaded. @@ -554,7 +556,7 @@ public class QueueFragment extends Fragment { public void update(EventDistributor eventDistributor, Integer arg) { if ((arg & EVENTS) != 0) { Log.d(TAG, "arg: " + arg); - loadItems(); + loadItems(false); if (isUpdatingFeeds != updateRefreshMenuItemChecker.isRefreshing()) { getActivity().supportInvalidateOptionsMenu(); } @@ -562,7 +564,7 @@ public class QueueFragment extends Fragment { } }; - private void loadItems() { + private void loadItems(final boolean restoreScrollPosition) { Log.d(TAG, "loadItems()"); if(subscription != null) { subscription.unsubscribe(); @@ -579,7 +581,7 @@ public class QueueFragment extends Fragment { if(items != null) { progLoading.setVisibility(View.GONE); queue = items; - onFragmentLoaded(); + onFragmentLoaded(restoreScrollPosition); if(recyclerAdapter != null) { recyclerAdapter.notifyDataSetChanged(); } |