diff options
author | ByteHamster <info@bytehamster.com> | 2022-02-25 19:53:00 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-02-25 19:53:00 +0100 |
commit | 441928b046e7a672cc27195f921aac421215330d (patch) | |
tree | 6cad1e2488b08100b0529bd15af37c29a3c8c96c /app/src/main/java/de/danoeh/antennapod/fragment | |
parent | ecaba7525ff63b7837a370c2ccc3b5f8b1c52aed (diff) | |
download | AntennaPod-441928b046e7a672cc27195f921aac421215330d.zip |
Do not jump chapter screen when switching to new chapter
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/fragment')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java index 04ad6e2bd..de63227e5 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java @@ -71,7 +71,7 @@ public class ChaptersFragment extends AppCompatDialogFragment { } Chapter chapter = adapter.getItem(pos); controller.seekTo((int) chapter.getStart()); - updateChapterSelection(pos); + updateChapterSelection(pos, true); }); recyclerView.setAdapter(adapter); @@ -117,7 +117,7 @@ public class ChaptersFragment extends AppCompatDialogFragment { @Subscribe(threadMode = ThreadMode.MAIN) public void onEventMainThread(PlaybackPositionEvent event) { - updateChapterSelection(getCurrentChapter(media)); + updateChapterSelection(getCurrentChapter(media), false); adapter.notifyTimeChanged(event.getPosition()); } @@ -160,10 +160,10 @@ public class ChaptersFragment extends AppCompatDialogFragment { } adapter.setMedia(media); int positionOfCurrentChapter = getCurrentChapter(media); - updateChapterSelection(positionOfCurrentChapter); + updateChapterSelection(positionOfCurrentChapter, true); } - private void updateChapterSelection(int position) { + private void updateChapterSelection(int position, boolean scrollTo) { if (adapter == null) { return; } @@ -171,8 +171,8 @@ public class ChaptersFragment extends AppCompatDialogFragment { if (position != -1 && focusedChapter != position) { focusedChapter = position; adapter.notifyChapterChanged(focusedChapter); - if (layoutManager.findFirstCompletelyVisibleItemPosition() >= position - || layoutManager.findLastCompletelyVisibleItemPosition() <= position) { + if (scrollTo && (layoutManager.findFirstCompletelyVisibleItemPosition() >= position + || layoutManager.findLastCompletelyVisibleItemPosition() <= position)) { layoutManager.scrollToPositionWithOffset(position, 100); } } |