From 0f1643fa4450c10eace51131a740b58043c60708 Mon Sep 17 00:00:00 2001 From: "Warren R. Bank" Date: Mon, 21 Oct 2019 10:31:30 -0700 Subject: [PATCH] v2.0.1: minor fix - persist data after deletion of rule --- .../ui/PreferenceActivity.java | 15 +++++++++++---- android-studio-project/constants.gradle | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/android-studio-project/SMS-my-GPS/src/main/java/com/github/warren_bank/sms_automatic_reply_gps/ui/PreferenceActivity.java b/android-studio-project/SMS-my-GPS/src/main/java/com/github/warren_bank/sms_automatic_reply_gps/ui/PreferenceActivity.java index e24bd8e..71dfa1a 100644 --- a/android-studio-project/SMS-my-GPS/src/main/java/com/github/warren_bank/sms_automatic_reply_gps/ui/PreferenceActivity.java +++ b/android-studio-project/SMS-my-GPS/src/main/java/com/github/warren_bank/sms_automatic_reply_gps/ui/PreferenceActivity.java @@ -28,6 +28,15 @@ public class PreferenceActivity extends Activity { private ArrayList listItems; private ArrayAdapter listAdapter; + // --------------------------------------------------------------------------------------------- + // Data Mutation: + // --------------------------------------------------------------------------------------------- + + private void handleDataSetChange() { + listAdapter.notifyDataSetChanged(); + Preferences.setListItems(PreferenceActivity.this, listItems); + } + // --------------------------------------------------------------------------------------------- // Lifecycle Events: // --------------------------------------------------------------------------------------------- @@ -124,7 +133,7 @@ private void showEditDialog(final int position) { public void onClick(View v) { if (!isAdd) { listItems.remove(position); - listAdapter.notifyDataSetChanged(); + handleDataSetChange(); } dialog.dismiss(); } @@ -164,10 +173,8 @@ public void onClick(View v) { } } - listAdapter.notifyDataSetChanged(); + handleDataSetChange(); dialog.dismiss(); - - Preferences.setListItems(PreferenceActivity.this, listItems); } }); diff --git a/android-studio-project/constants.gradle b/android-studio-project/constants.gradle index 74b1f75..24f2258 100644 --- a/android-studio-project/constants.gradle +++ b/android-studio-project/constants.gradle @@ -1,6 +1,6 @@ project.ext { - releaseVersionCode = Integer.parseInt("002000011", 10) - releaseVersion = '002.00.00-11API' + releaseVersionCode = Integer.parseInt("002000111", 10) + releaseVersion = '002.00.01-11API' minSdkVersion = 11 targetSdkVersion = 28 compileSdkVersion = 28