diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-10-30 20:05:36 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-10-30 20:05:36 +0100 |
commit | 11659eadb02b382804845d4e01a8536e02698468 (patch) | |
tree | 21962ec200324bda4646ae358c305259a6d68841 /src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java | |
parent | 7aed735df28984e76486f23d17d02981b268930e (diff) |
Implements FS#24: Introduce setting for picture resizing
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java | 13 |
1 files changed, 13 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..47daddb0 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,10 @@ public class ConversationsPlusPreferences extends Settings { } } + protected static <T extends Enum<T>> T getEnumFromStringPref(String key, T defaultValue) { + return (T) T.valueOf(defaultValue.getClass(), defaultValue.name()); + } + private static boolean getBoolean(String key, boolean defValue) { return getSharedPreferences().getBoolean(key, defValue); } |