diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 6e37084..de8a190 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -448,4 +448,43 @@ 0 1 + + + + @string/toast_none_animation + @string/toast_default_animation + @string/toast_fade_animation + @string/toast_SlideRight_animation + @string/toast_SlideLeft_animation + @string/toast_Xylon_animation + @string/toast_Toko_animation + @string/toast_Tn_animation + @string/toast_Honami_animation + @string/toast_FastFade_animation + @string/toast_GrowFade_animation + @string/toast_GrowFadeCenter_animation + @string/toast_GrowFadeBottom_animation + @string/toast_Translucent_animation + @string/toast_SlideLeftRight_animation + @string/toast_SlideRightLeft_animation + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 20b9adf..7f470e8 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -562,4 +562,23 @@ Prevent app overrides Prevent apps from overriding transitions Default + + + Toast animation + None + Default + Fade + Slide right + Slide left + Xylon + Toko + Tn + Honami + Fast fade + Grow fade + Grow fade center + Grow fade bottom + Translucent + Slide left to right + Slide right to left diff --git a/res/xml/cherish_settings_animations.xml b/res/xml/cherish_settings_animations.xml index 90e9708..b9ac710 100644 --- a/res/xml/cherish_settings_animations.xml +++ b/res/xml/cherish_settings_animations.xml @@ -64,4 +64,11 @@ android:title="@string/wallpaper_intra_close_title" /> + + diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index 19c52be..c0956f6 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -61,7 +61,9 @@ public class AnimationsSettings extends SettingsPreferenceFragment private static final String WALLPAPER_CLOSE = "wallpaper_close"; private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open"; private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close"; + private static final String KEY_TOAST_ANIMATION = "toast_animation"; + private ListPreference mToastAnimation; ListPreference mActivityOpenPref; ListPreference mActivityClosePref; ListPreference mTaskOpenPref; @@ -91,6 +93,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment PreferenceScreen prefs = getPreferenceScreen(); mContext = getActivity(); + mToastAnimation = (ListPreference) findPreference(KEY_TOAST_ANIMATION); + mToastAnimation.setSummary(mToastAnimation.getEntry()); + int CurrentToastAnimation = Settings.Global.getInt(getContentResolver(), Settings.Global.TOAST_ANIMATION, 1); + mToastAnimation.setValueIndex(CurrentToastAnimation); //set to index of default value + mToastAnimation.setSummary(mToastAnimation.getEntries()[CurrentToastAnimation]); + mToastAnimation.setOnPreferenceChangeListener(this); + mAnimations = AwesomeAnimationHelper.getAnimationsList(); int animqty = mAnimations.length; mAnimationsStrings = new String[animqty]; @@ -171,7 +180,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment ContentResolver resolver = getActivity().getContentResolver(); boolean result = false; - if (preference == mActivityOpenPref) { + if (preference == mToastAnimation) { + int index = mToastAnimation.findIndexOfValue((String) newValue); + Settings.Global.putString(getContentResolver(), Settings.Global.TOAST_ANIMATION, (String) newValue); + mToastAnimation.setSummary(mToastAnimation.getEntries()[index]); + Toast.makeText(mContext, "Toast Test", Toast.LENGTH_SHORT).show(); + return true; + } else if (preference == mActivityOpenPref) { int val = Integer.parseInt((String) newValue); result = Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ACTIVITY_ANIMATION_CONTROLS[0], val);