aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-11-03 21:33:14 +0100
committersteckbrief <steckbrief@chefmail.de>2015-11-03 21:33:14 +0100
commit0575767152abc391fd1d0241d9cbae154236df70 (patch)
treed4530ebbdb2de9ed0f0c41eb008a712edba6d7f6 /src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java
parent389e3d4f0f5116f5ea22cc7c5e8cec1e6c791e3a (diff)
parentb22d863c362bb6492240700c0f69f1a5d926f46b (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java
index b20cfb8f..b7b7fe47 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java
@@ -4,6 +4,7 @@ import android.content.SharedPreferences;
import java.util.Set;
+import de.thedevstack.conversationsplus.enums.UserDecision;
import de.tzur.conversations.Settings;
/**
@@ -13,6 +14,14 @@ public class ConversationsPlusPreferences extends Settings {
private static ConversationsPlusPreferences instance;
private final SharedPreferences sharedPreferences;
+ public static UserDecision resizePicture() {
+ return getEnumFromStringPref("resize_picture", UserDecision.ASK);
+ }
+
+ public static void applyResizePicture(UserDecision decision) {
+ applyString("resize_picture", decision.name());
+ }
+
/**
* Whether automatic downloads should only be done when connected to Wifi or not.
* @return
@@ -243,6 +252,11 @@ public class ConversationsPlusPreferences extends Settings {
}
}
+ protected static <T extends Enum<T>> T getEnumFromStringPref(String key, T defaultValue) {
+ String enumValueAsString = getString(key, defaultValue.name());
+ return (T) Enum.valueOf(defaultValue.getClass(), enumValueAsString);
+ }
+
private static boolean getBoolean(String key, boolean defValue) {
return getSharedPreferences().getBoolean(key, defValue);
}