Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show bookmark item as toggled when page is first entered #1917

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void onCreate(Bundle savedInstanceState) {
viewPager.setAdapter(pagerAdapter);

ayahToolBar.setOnItemSelectedListener(new AyahMenuItemSelectionHandler());
viewPager.addOnPageChangeListener(new OnPageChangeListener() {
OnPageChangeListener onPageChangeListener = new OnPageChangeListener() {

@Override
public void onPageScrollStateChanged(int state) {
Expand Down Expand Up @@ -446,10 +446,8 @@ public void onPageSelected(int position) {
}

if (bookmarksCache.indexOfKey(page) < 0) {
if (isDualPages && !isSplitScreen) {
if (bookmarksCache.indexOfKey(page - 1) < 0) {
checkIfPageIsBookmarked(page - 1, page);
}
if (isDualPageVisible() && bookmarksCache.indexOfKey(page - 1) < 0) {
checkIfPageIsBookmarked(page - 1, page);
} else {
// we don't have the key
checkIfPageIsBookmarked(page);
Expand All @@ -468,7 +466,8 @@ public void onPageSelected(int position) {
}
}
}
});
};
viewPager.addOnPageChangeListener(onPageChangeListener);

setUiVisibilityListener();
audioStatusBar.setVisibility(View.VISIBLE);
Expand All @@ -495,6 +494,9 @@ public void onPageSelected(int position) {
}

viewPager.setCurrentItem(page);
if (page == 0) {
onPageChangeListener.onPageSelected(0);
}

// just got created, need to reconnect to service
shouldReconnect = true;
Expand Down