Skip to content

Commit d19d7f7

Browse files
committed
save during onStop and during onDestroy only if there are actually changes to be saved
1 parent e037bcb commit d19d7f7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

platform/android/src/com/cgogolin/penandpdf/PenAndPDFActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ protected void onPause() {
520520
protected void onStop() {
521521
super.onStop();
522522
//Save only during onStop() as this can take some time
523-
if(core != null && !isChangingConfigurations())
523+
if(core != null && core.hasChanges() && !isChangingConfigurations())
524524
{
525525
if(mSaveOnStop && !mIgnoreSaveOnStopThisTime && core.canSaveToCurrentUri(this))
526526
{
@@ -550,7 +550,7 @@ protected void onDestroy() {//There is no guarantee that this is ever called!!!
550550
super.onDestroy();
551551

552552
getSharedPreferences(SettingsActivity.SHARED_PREFERENCES_STRING, MODE_MULTI_PROCESS).unregisterOnSharedPreferenceChangeListener(this);
553-
if(core != null && !isChangingConfigurations())
553+
if(core != null && core.hasChanges() && !isChangingConfigurations())
554554
{
555555
SharedPreferences sharedPref = getSharedPreferences(SettingsActivity.SHARED_PREFERENCES_STRING, MODE_MULTI_PROCESS);
556556
if(mSaveOnDestroy && !mIgnoreSaveOnDestroyThisTime && core.canSaveToCurrentUri(this))

0 commit comments

Comments
 (0)