diff --git a/res/values/strings.xml b/res/values/strings.xml index c32b6a68d..ad6c8d9ea 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -627,4 +627,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin 500 folders 1000 folders + Animations + Activate enhanced animations + diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index c32151f4e..8c3bf0fb3 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -31,6 +31,12 @@ android:entries="@array/date_formats" android:entryValues="@array/date_formats" android:dialogTitle="@string/date_format_label" /> + + @@ -55,7 +61,4 @@ android:summary="@string/debug_enable_sensitive_logging_summary" /> - - - diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 8650d9152..7e103ad3d 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -18,6 +18,7 @@ import com.fsck.k9.service.BootReceiver; import com.fsck.k9.service.MailService; import java.io.File; +import java.util.UUID; public class K9 extends Application { @@ -60,6 +61,8 @@ public class K9 extends Application */ public static boolean ENABLE_ERROR_FOLDER = true; public static String ERROR_FOLDER_NAME = "K9mail-errors"; + + private static boolean mAnimations = true; /** * The MIME type(s) of attachments we're willing to send. At the moment it is not possible @@ -468,6 +471,7 @@ public class K9 extends Application editor.putBoolean("enableDebugLogging", K9.DEBUG); editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE); editor.putString("backgroundOperations", K9.backgroundOps.toString()); + editor.putBoolean("animations", mAnimations); editor.putInt("theme", theme); } @@ -480,7 +484,7 @@ public class K9 extends Application SharedPreferences sprefs = prefs.getPreferences(); DEBUG = sprefs.getBoolean("enableDebugLogging", false); DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); - + mAnimations = sprefs.getBoolean("animations", true); try { setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED"))); @@ -587,6 +591,16 @@ public class K9 extends Application { K9.backgroundOps = BACKGROUND_OPS.valueOf(nbackgroundOps); } + + public static boolean isAnimations() + { + return mAnimations; + } + + public static void setAnimations(boolean animations) + { + mAnimations = animations; + } } diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 6ad5fff20..bc71ec283 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -168,13 +168,13 @@ public class MessageView extends K9Activity case KeyEvent.KEYCODE_J: case KeyEvent.KEYCODE_P: { - onPrevious(false); + onPrevious(K9.isAnimations()); return true; } case KeyEvent.KEYCODE_N: case KeyEvent.KEYCODE_K: { - onNext(false); + onNext(K9.isAnimations()); return true; } case KeyEvent.KEYCODE_Z: @@ -714,19 +714,19 @@ public class MessageView extends K9Activity if (mLastDirection == NEXT && mNextMessageUid != null) { - onNext(false); + onNext(K9.isAnimations()); } else if (mLastDirection == PREVIOUS && mPreviousMessageUid != null) { - onPrevious(false); + onPrevious(K9.isAnimations()); } else if (mNextMessageUid != null) { - onNext(false); + onNext(K9.isAnimations()); } else if (mPreviousMessageUid != null) { - onPrevious(false); + onPrevious(K9.isAnimations()); } @@ -1060,11 +1060,11 @@ public class MessageView extends K9Activity break; case R.id.next: case R.id.next_scrolling: - onNext(false); + onNext(K9.isAnimations()); break; case R.id.previous: case R.id.previous_scrolling: - onPrevious(false); + onPrevious(K9.isAnimations()); break; case R.id.download: onDownloadAttachment((Attachment) view.getTag()); diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index f19b563f2..05aee72cb 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -6,6 +6,7 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.Bundle; import android.preference.CheckBoxPreference; +import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.view.KeyEvent; @@ -25,11 +26,14 @@ public class Prefs extends K9PreferenceActivity private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging"; private static final String PREFERENCE_SENSITIVE_LOGGING = "sensitive_logging"; + private static final String PREFERENCE_ANIMATIONS = "animations"; + private ListPreference mTheme; private ListPreference mDateFormat; private ListPreference mBackgroundOps; private CheckBoxPreference mDebugLogging; private CheckBoxPreference mSensitiveLogging; + private CheckBoxPreference mAnimations; private String initBackgroundOps; @@ -112,6 +116,8 @@ public class Prefs extends K9PreferenceActivity mDebugLogging.setChecked(K9.DEBUG); mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE); + mAnimations = (CheckBoxPreference)findPreference(PREFERENCE_ANIMATIONS); + mAnimations.setChecked(K9.isAnimations()); } @Override @@ -128,6 +134,7 @@ public class Prefs extends K9PreferenceActivity K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked(); String newBackgroundOps = mBackgroundOps.getValue(); K9.setBackgroundOps(newBackgroundOps); + K9.setAnimations(mAnimations.isChecked()); Editor editor = preferences.edit(); K9.save(editor); DateFormatter.setDateFormat(editor, mDateFormat.getValue());