summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/trebuchet/preference
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-12-18 17:37:13 +0000
committernebkat <nebkat@teamhacksung.org>2012-12-18 20:36:16 +0000
commit56c32627fe872b49ed43f62917929c07a865027b (patch)
treec5513cd12a3fd1241f328175a52a568d5f849df5 /src/com/cyanogenmod/trebuchet/preference
parentabb448df67f9c818ce382d70221732e63aace2b4 (diff)
downloadpackages_apps_trebuchet-56c32627fe872b49ed43f62917929c07a865027b.zip
packages_apps_trebuchet-56c32627fe872b49ed43f62917929c07a865027b.tar.gz
packages_apps_trebuchet-56c32627fe872b49ed43f62917929c07a865027b.tar.bz2
PreferencesProvider: Prevent FC when invalid transition effects given
Change-Id: If5c432d78ee65ee898305e0714368591eec6998a
Diffstat (limited to 'src/com/cyanogenmod/trebuchet/preference')
-rw-r--r--src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
index e7f14aa..b4b5d40 100644
--- a/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
+++ b/src/com/cyanogenmod/trebuchet/preference/PreferencesProvider.java
@@ -74,8 +74,20 @@ public final class PreferencesProvider {
public static class Scrolling {
public static Workspace.TransitionEffect getTransitionEffect(Context context, String def) {
final SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_KEY, 0);
- return Workspace.TransitionEffect.valueOf(
- preferences.getString("ui_homescreen_scrolling_transition_effect", def));
+ try {
+ return Workspace.TransitionEffect.valueOf(
+ preferences.getString("ui_homescreen_scrolling_transition_effect", def));
+ } catch (IllegalArgumentException iae) {
+ // Continue
+ }
+
+ try {
+ return Workspace.TransitionEffect.valueOf(def);
+ } catch (IllegalArgumentException iae) {
+ // Continue
+ }
+
+ return Workspace.TransitionEffect.Standard;
}
public static boolean getScrollWallpaper(Context context) {
final SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_KEY, 0);
@@ -122,8 +134,20 @@ public final class PreferencesProvider {
public static class Scrolling {
public static AppsCustomizePagedView.TransitionEffect getTransitionEffect(Context context, String def) {
final SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_KEY, 0);
- return AppsCustomizePagedView.TransitionEffect.valueOf(
- preferences.getString("ui_drawer_scrolling_transition_effect", def));
+ try {
+ return AppsCustomizePagedView.TransitionEffect.valueOf(
+ preferences.getString("ui_drawer_scrolling_transition_effect", def));
+ } catch (IllegalArgumentException iae) {
+ // Continue
+ }
+
+ try {
+ return AppsCustomizePagedView.TransitionEffect.valueOf(def);
+ } catch (IllegalArgumentException iae) {
+ // Continue
+ }
+
+ return AppsCustomizePagedView.TransitionEffect.Standard;
}
public static boolean getFadeInAdjacentScreens(Context context) {
final SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_KEY, 0);