diff options
author | stefan-niedermann <info@niedermann.it> | 2019-10-19 22:11:15 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2019-10-19 22:11:15 +0300 |
commit | 00b4ac3996b5032895cff2021cd2958a1d303871 (patch) | |
tree | 8c8a1751564ef6978bae70f8820d5a09abaf5d9e | |
parent | 5007476ae816f37c86f598e8ed7a86b183b2a033 (diff) |
Fix #181 Enhance modified detection for pressing back button in edit mode
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/EditActivity.java | 8 | ||||
-rw-r--r-- | fastlane/metadata/android/en-US/changelogs/13.txt | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/EditActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/EditActivity.java index 8f8c2f055..53a1ea6a7 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/EditActivity.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/EditActivity.java @@ -64,8 +64,8 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme String edit; private Unbinder unbinder; - private boolean modified = false; + private FullCard originalCard; private FullCard fullCard; private long accountId; @@ -111,6 +111,7 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme } else { observeOnce(syncManager.getCardByLocalId(accountId, localId), EditActivity.this, (next) -> { fullCard = next; + originalCard = new FullCard(fullCard); setupViewPager(); setupTitle(createMode); }); @@ -179,7 +180,6 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme title.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { - modified = true; fullCard.getCard().setTitle(title.getText().toString()); } @@ -206,7 +206,6 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme @Override public void onDescriptionChanged(String description) { this.fullCard.getCard().setDescription(description); - modified = true; } @@ -233,7 +232,6 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme @Override public void onDueDateChanged(Date dueDate) { this.fullCard.getCard().setDueDate(dueDate); - modified = true; } @Override @@ -244,7 +242,7 @@ public class EditActivity extends AppCompatActivity implements CardDetailsFragme @Override public void onBackPressed() { - if (modified && canEdit) { + if (!fullCard.equals(originalCard) && canEdit) { new AlertDialog.Builder(this) .setTitle(R.string.simple_save) .setMessage(R.string.do_you_want_to_save_your_changes) diff --git a/fastlane/metadata/android/en-US/changelogs/13.txt b/fastlane/metadata/android/en-US/changelogs/13.txt index 5077a3deb..09a426ae0 100644 --- a/fastlane/metadata/android/en-US/changelogs/13.txt +++ b/fastlane/metadata/android/en-US/changelogs/13.txt @@ -6,4 +6,5 @@ - Title field should have focus when creating a new card (#191) - Do not show already assigned users and cards in search (#167) - Make user and label assignments cancelable (#180) -- Create stacks button is now always visible in stack tabs
\ No newline at end of file +- Create stacks button is now always visible in stack tabs +- Enhance modified detection for pressing back button in edit mode (#181)
\ No newline at end of file |