1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-12 04:25:08 -05:00

Add a global preference for enabling animations, beyond those that are

necessary.  Defaults to "enabled."
This commit is contained in:
Daniel Applebaum 2009-12-27 00:54:19 +00:00
parent ea65007b99
commit 1ea96796d6
5 changed files with 39 additions and 12 deletions

View File

@ -627,4 +627,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_setup_push_limit_500">500 folders</string> <string name="account_setup_push_limit_500">500 folders</string>
<string name="account_setup_push_limit_1000">1000 folders</string> <string name="account_setup_push_limit_1000">1000 folders</string>
<string name="animations_title">Animations</string>
<string name="animations_summary">Activate enhanced animations</string>
</resources> </resources>

View File

@ -31,6 +31,12 @@
android:entries="@array/date_formats" android:entries="@array/date_formats"
android:entryValues="@array/date_formats" android:entryValues="@array/date_formats"
android:dialogTitle="@string/date_format_label" /> android:dialogTitle="@string/date_format_label" />
<CheckBoxPreference
android:key="animations"
android:title="@string/animations_title"
android:summary="@string/animations_summary"
/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences"> <PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences">
@ -55,7 +61,4 @@
android:summary="@string/debug_enable_sensitive_logging_summary" android:summary="@string/debug_enable_sensitive_logging_summary"
/> />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -18,6 +18,7 @@ import com.fsck.k9.service.BootReceiver;
import com.fsck.k9.service.MailService; import com.fsck.k9.service.MailService;
import java.io.File; import java.io.File;
import java.util.UUID;
public class K9 extends Application public class K9 extends Application
{ {
@ -61,6 +62,8 @@ public class K9 extends Application
public static boolean ENABLE_ERROR_FOLDER = true; public static boolean ENABLE_ERROR_FOLDER = true;
public static String ERROR_FOLDER_NAME = "K9mail-errors"; 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 * The MIME type(s) of attachments we're willing to send. At the moment it is not possible
* to open a chooser with a list of filter types, so the chooser is only opened with the first * to open a chooser with a list of filter types, so the chooser is only opened with the first
@ -468,6 +471,7 @@ public class K9 extends Application
editor.putBoolean("enableDebugLogging", K9.DEBUG); editor.putBoolean("enableDebugLogging", K9.DEBUG);
editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE); editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE);
editor.putString("backgroundOperations", K9.backgroundOps.toString()); editor.putString("backgroundOperations", K9.backgroundOps.toString());
editor.putBoolean("animations", mAnimations);
editor.putInt("theme", theme); editor.putInt("theme", theme);
} }
@ -480,7 +484,7 @@ public class K9 extends Application
SharedPreferences sprefs = prefs.getPreferences(); SharedPreferences sprefs = prefs.getPreferences();
DEBUG = sprefs.getBoolean("enableDebugLogging", false); DEBUG = sprefs.getBoolean("enableDebugLogging", false);
DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false);
mAnimations = sprefs.getBoolean("animations", true);
try try
{ {
setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED"))); setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED")));
@ -587,6 +591,16 @@ public class K9 extends Application
{ {
K9.backgroundOps = BACKGROUND_OPS.valueOf(nbackgroundOps); K9.backgroundOps = BACKGROUND_OPS.valueOf(nbackgroundOps);
} }
public static boolean isAnimations()
{
return mAnimations;
}
public static void setAnimations(boolean animations)
{
mAnimations = animations;
}
} }

View File

@ -168,13 +168,13 @@ public class MessageView extends K9Activity
case KeyEvent.KEYCODE_J: case KeyEvent.KEYCODE_J:
case KeyEvent.KEYCODE_P: case KeyEvent.KEYCODE_P:
{ {
onPrevious(false); onPrevious(K9.isAnimations());
return true; return true;
} }
case KeyEvent.KEYCODE_N: case KeyEvent.KEYCODE_N:
case KeyEvent.KEYCODE_K: case KeyEvent.KEYCODE_K:
{ {
onNext(false); onNext(K9.isAnimations());
return true; return true;
} }
case KeyEvent.KEYCODE_Z: case KeyEvent.KEYCODE_Z:
@ -714,19 +714,19 @@ public class MessageView extends K9Activity
if (mLastDirection == NEXT && mNextMessageUid != null) if (mLastDirection == NEXT && mNextMessageUid != null)
{ {
onNext(false); onNext(K9.isAnimations());
} }
else if (mLastDirection == PREVIOUS && mPreviousMessageUid != null) else if (mLastDirection == PREVIOUS && mPreviousMessageUid != null)
{ {
onPrevious(false); onPrevious(K9.isAnimations());
} }
else if (mNextMessageUid != null) else if (mNextMessageUid != null)
{ {
onNext(false); onNext(K9.isAnimations());
} }
else if (mPreviousMessageUid != null) else if (mPreviousMessageUid != null)
{ {
onPrevious(false); onPrevious(K9.isAnimations());
} }
@ -1060,11 +1060,11 @@ public class MessageView extends K9Activity
break; break;
case R.id.next: case R.id.next:
case R.id.next_scrolling: case R.id.next_scrolling:
onNext(false); onNext(K9.isAnimations());
break; break;
case R.id.previous: case R.id.previous:
case R.id.previous_scrolling: case R.id.previous_scrolling:
onPrevious(false); onPrevious(K9.isAnimations());
break; break;
case R.id.download: case R.id.download:
onDownloadAttachment((Attachment) view.getTag()); onDownloadAttachment((Attachment) view.getTag());

View File

@ -6,6 +6,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.view.KeyEvent; 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_DEBUG_LOGGING = "debug_logging";
private static final String PREFERENCE_SENSITIVE_LOGGING = "sensitive_logging"; private static final String PREFERENCE_SENSITIVE_LOGGING = "sensitive_logging";
private static final String PREFERENCE_ANIMATIONS = "animations";
private ListPreference mTheme; private ListPreference mTheme;
private ListPreference mDateFormat; private ListPreference mDateFormat;
private ListPreference mBackgroundOps; private ListPreference mBackgroundOps;
private CheckBoxPreference mDebugLogging; private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging; private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference mAnimations;
private String initBackgroundOps; private String initBackgroundOps;
@ -112,6 +116,8 @@ public class Prefs extends K9PreferenceActivity
mDebugLogging.setChecked(K9.DEBUG); mDebugLogging.setChecked(K9.DEBUG);
mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE); mSensitiveLogging.setChecked(K9.DEBUG_SENSITIVE);
mAnimations = (CheckBoxPreference)findPreference(PREFERENCE_ANIMATIONS);
mAnimations.setChecked(K9.isAnimations());
} }
@Override @Override
@ -128,6 +134,7 @@ public class Prefs extends K9PreferenceActivity
K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked(); K9.DEBUG_SENSITIVE = mSensitiveLogging.isChecked();
String newBackgroundOps = mBackgroundOps.getValue(); String newBackgroundOps = mBackgroundOps.getValue();
K9.setBackgroundOps(newBackgroundOps); K9.setBackgroundOps(newBackgroundOps);
K9.setAnimations(mAnimations.isChecked());
Editor editor = preferences.edit(); Editor editor = preferences.edit();
K9.save(editor); K9.save(editor);
DateFormatter.setDateFormat(editor, mDateFormat.getValue()); DateFormatter.setDateFormat(editor, mDateFormat.getValue());