summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2022-02-26 18:46:53 +0100
committerGitHub <noreply@github.com>2022-02-26 18:46:53 +0100
commit30e7dd0755a40c7eb5bf66b14ca9f6562e8efdbd (patch)
treeeb879a436c52b0e39970604de50abf4067be3931
parent7a207ce870a18591462a71d05424d12dd55992d2 (diff)
parent441928b046e7a672cc27195f921aac421215330d (diff)
downloadAntennaPod-30e7dd0755a40c7eb5bf66b14ca9f6562e8efdbd.zip
Merge pull request #5753 from ByteHamster/do-not-jump-chapters
Do not jump chapter screen when switching to new chapter
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java12
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);
}
}