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

Remember the last reading mode #736

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
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 @@ -72,4 +72,5 @@ public class Constants {
public static final String PREF_LOGS = "sendLogsKey";
public static final String PREF_DID_PRESENT_PERMISSIONS_DIALOG =
"didPresentStoragePermissionDialog";
public static final String PREF_WAS_SHOWING_TRANSLATION = "wasShowingTranslation";
}
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@ public void onPause() {
promptDialog = null;
}
recentPagePresenter.unbind(this);
settings.setWasShowingTranslation(pagerAdapter.getIsShowingTranslation());
super.onPause();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ private void launchTranslationActivity() {
public void jumpTo(int page) {
Intent i = new Intent(this, PagerActivity.class);
i.putExtra("page", page);
i.putExtra(PagerActivity.EXTRA_JUMP_TO_TRANSLATION, settings.getWasShowingTranslation());
startActivity(i);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public void setQuranMode() {
}
}

public boolean getIsShowingTranslation() {
return mIsShowingTranslation;
}

@Override
public int getItemPosition(Object object) {
/* when the ViewPager gets a notifyDataSetChanged (or invalidated),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,13 @@ public void setDefaultImagesDirectory(String directory) {
public String getDefaultImagesDirectory() {
return mPerInstallationPrefs.getString(Constants.PREF_DEFAULT_IMAGES_DIR, "");
}

public void setWasShowingTranslation(boolean wasShowingTranslation) {
mPerInstallationPrefs.edit().putBoolean(Constants.PREF_WAS_SHOWING_TRANSLATION,
wasShowingTranslation).apply();
}

public boolean getWasShowingTranslation() {
return mPerInstallationPrefs.getBoolean(Constants.PREF_WAS_SHOWING_TRANSLATION, false);
}
}