From 549810783ce651f27bdd386488b6690195522372 Mon Sep 17 00:00:00 2001 From: lookshe Date: Tue, 14 Apr 2015 23:48:28 +0200 Subject: changed received and read confirmation setting to one list and put it to settings class --- src/main/java/de/tzur/conversations/Settings.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main/java/de') diff --git a/src/main/java/de/tzur/conversations/Settings.java b/src/main/java/de/tzur/conversations/Settings.java index 72084285..c919d60c 100644 --- a/src/main/java/de/tzur/conversations/Settings.java +++ b/src/main/java/de/tzur/conversations/Settings.java @@ -15,7 +15,7 @@ public final class Settings { */ public static void initSettingsClassWithPreferences(SharedPreferences preferences) { Log.d("SETTING", "Initializing settings"); - String[] preferenceNames = { "parse_emoticons", "send_button_status", "led_notification_color", "auto_download_file_wlan", "auto_download_file_link" }; + String[] preferenceNames = { "parse_emoticons", "send_button_status", "led_notification_color", "auto_download_file_wlan", "auto_download_file_link", "confirm_messages_list" }; for (String name : preferenceNames) { Settings.synchronizeSettingsClassWithPreferences(preferences, name); } @@ -44,6 +44,16 @@ public final class Settings { case "auto_download_file_link": Settings.DOWNLOAD_IMAGE_LINKS = preferences.getBoolean(name, Settings.DOWNLOAD_IMAGE_LINKS); break; + case "confirm_messages_list": + int iPref = Settings.CONFIRM_MESSAGE_RECEIVED && Settings.CONFIRM_MESSAGE_READ ? 2 : Settings.CONFIRM_MESSAGE_RECEIVED ? 1 : 0; + try { + iPref = Integer.valueOf(preferences.getString(name, new Integer(iPref).toString())); + } catch (NumberFormatException e) { + // ignored, fallback-value set above + } + Settings.CONFIRM_MESSAGE_RECEIVED = iPref >= 1; + Settings.CONFIRM_MESSAGE_READ = iPref >= 2; + break; } } /** @@ -66,6 +76,14 @@ public final class Settings { * Boolean if automatic downloads should be done only jif connected to WLAN. */ public static boolean DOWNLOAD_ONLY_WLAN = true; + /** + * Boolean if confirm received messages + */ + public static boolean CONFIRM_MESSAGE_RECEIVED = true; + /** + * Boolean if confirm read message + */ + public static boolean CONFIRM_MESSAGE_READ = true; /** * This is a utility class - private constructor avoids any instantiation. -- cgit v1.2.3