diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-07-09 19:46:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 19:46:46 +0200 |
commit | f5ae8815612c01c0e9bb3c4407b4813792fa6959 (patch) | |
tree | 308b0b0e34cbf6255d24e89f0c30fe81456d4978 /app | |
parent | 7f5aba0c333afb9bbe1eec75fec48613f4eb5210 (diff) | |
parent | 239a30c26760d0761912d70600a8da7826f36c66 (diff) | |
download | AntennaPod-f5ae8815612c01c0e9bb3c4407b4813792fa6959.zip |
Merge pull request #5962 from ByteHamster/long-press-toolbar
Scroll to top by long-pressing toolbar
Diffstat (limited to 'app')
6 files changed, 31 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java index d82b3ff0c..f1befcd94 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CompletedDownloadsFragment.java @@ -80,6 +80,11 @@ public class CompletedDownloadsFragment extends Fragment toolbar.setTitle(R.string.downloads_label); toolbar.inflateMenu(R.menu.downloads_completed); toolbar.setOnMenuItemClickListener(this); + toolbar.setOnLongClickListener(v -> { + recyclerView.scrollToPosition(5); + recyclerView.post(() -> recyclerView.smoothScrollToPosition(0)); + return false; + }); refreshToolbarState(); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java index f4fafb0ac..77d0c4555 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedItemlistFragment.java @@ -129,6 +129,12 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem speedDialBinding = MultiSelectSpeedDialBinding.bind(viewBinding.getRoot()); viewBinding.toolbar.inflateMenu(R.menu.feedlist); viewBinding.toolbar.setOnMenuItemClickListener(this); + viewBinding.toolbar.setOnLongClickListener(v -> { + viewBinding.recyclerView.scrollToPosition(5); + viewBinding.recyclerView.post(() -> viewBinding.recyclerView.smoothScrollToPosition(0)); + viewBinding.appBar.setExpanded(true); + return false; + }); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/InboxFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/InboxFragment.java index 9d5376c2a..0ff0bd24a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/InboxFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/InboxFragment.java @@ -58,6 +58,11 @@ public class InboxFragment extends EpisodesListFragment implements Toolbar.OnMen toolbar = inboxContainer.findViewById(R.id.toolbar); toolbar.setOnMenuItemClickListener(this); toolbar.inflateMenu(R.menu.inbox); + toolbar.setOnLongClickListener(v -> { + recyclerView.scrollToPosition(5); + recyclerView.post(() -> recyclerView.smoothScrollToPosition(0)); + return false; + }); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java index 8bcef4181..a22edbc76 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/PlaybackHistoryFragment.java @@ -51,6 +51,11 @@ public class PlaybackHistoryFragment extends EpisodesListFragment implements Too toolbar = historyContainer.findViewById(R.id.toolbar); toolbar.setTitle(R.string.playback_history_label); toolbar.setOnMenuItemClickListener(this); + toolbar.setOnLongClickListener(v -> { + recyclerView.scrollToPosition(5); + recyclerView.post(() -> recyclerView.smoothScrollToPosition(0)); + return false; + }); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); 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 61f45f0f9..2d60e5498 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -445,6 +445,11 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi View root = inflater.inflate(R.layout.queue_fragment, container, false); toolbar = root.findViewById(R.id.toolbar); toolbar.setOnMenuItemClickListener(this); + toolbar.setOnLongClickListener(v -> { + recyclerView.scrollToPosition(5); + recyclerView.post(() -> recyclerView.smoothScrollToPosition(0)); + return false; + }); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 10f80441a..578a2fa84 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -125,6 +125,11 @@ public class SubscriptionFragment extends Fragment View root = inflater.inflate(R.layout.fragment_subscriptions, container, false); toolbar = root.findViewById(R.id.toolbar); toolbar.setOnMenuItemClickListener(this); + toolbar.setOnLongClickListener(v -> { + subscriptionRecycler.scrollToPosition(5); + subscriptionRecycler.post(() -> subscriptionRecycler.smoothScrollToPosition(0)); + return false; + }); displayUpArrow = getParentFragmentManager().getBackStackEntryCount() != 0; if (savedInstanceState != null) { displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW); |