1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Add a preference to use volume up / volume down to navigate items.

From a patch by paul.kilroy@gmail.com. Partial resolution of Issue 2112
This commit is contained in:
Jesse Vincent 2010-08-30 02:15:59 +00:00
parent be8ac83198
commit 0f1a1baa89
4 changed files with 25 additions and 0 deletions

View File

@ -825,6 +825,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="gestures_title">Gestures</string>
<string name="gestures_summary">Accept gesture control</string>
<string name="volume_navigation_title">Volume up/down nav</string>
<string name="volume_navigation_summary">Flip through items using the volume controls</string>
<string name="manage_back_title">Manage \"Back\" button</string>
<string name="manage_back_summary">Make \"Back\" always go up a level</string>

View File

@ -55,6 +55,11 @@
android:title="@string/gestures_title"
android:summary="@string/gestures_summary" />
<CheckBoxPreference
android:key="volumeNavigation"
android:title="@string/volume_navigation_title"
android:summary="@string/volume_navigation_summary" />
<CheckBoxPreference
android:key="manage_back"
android:title="@string/manage_back_title"

View File

@ -115,6 +115,7 @@ public class K9 extends Application
private static boolean mMessageViewReturnToList = false;
private static boolean mGesturesEnabled = true;
private static boolean mUseVolumeKeysForNavigation = false;
private static boolean mManageBack = false;
private static boolean mStartIntegratedInbox = false;
private static boolean mMeasureAccounts = true;
@ -336,6 +337,7 @@ public class K9 extends Application
editor.putString("backgroundOperations", K9.backgroundOps.toString());
editor.putBoolean("animations", mAnimations);
editor.putBoolean("gesturesEnabled", mGesturesEnabled);
editor.putBoolean("useVolumeKeysForNavigation", mUseVolumeKeysForNavigation);
editor.putBoolean("manageBack", mManageBack);
editor.putBoolean("startIntegratedInbox", mStartIntegratedInbox);
editor.putBoolean("measureAccounts", mMeasureAccounts);
@ -368,6 +370,7 @@ public class K9 extends Application
DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false);
mAnimations = sprefs.getBoolean("animations", true);
mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", true);
mUseVolumeKeysForNavigation = sprefs.getBoolean("useVolumeKeysForNavigation", false);
mManageBack = sprefs.getBoolean("manageBack", false);
mStartIntegratedInbox = sprefs.getBoolean("startIntegratedInbox", false);
mMeasureAccounts = sprefs.getBoolean("measureAccounts", true);
@ -516,6 +519,15 @@ public class K9 extends Application
mGesturesEnabled = gestures;
}
public static boolean useVolumeKeysForNavigationEnabled()
{
return mUseVolumeKeysForNavigation;
}
public static void setUseVolumeKeysForNavigation(boolean volume)
{
mUseVolumeKeysForNavigation = volume;
}
public static boolean manageBack()
{

View File

@ -40,6 +40,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_ANIMATIONS = "animations";
private static final String PREFERENCE_GESTURES = "gestures";
private static final String PREFERENCE_VOLUME_NAVIGATION = "volumeNavigation";
private static final String PREFERENCE_MANAGE_BACK = "manage_back";
private static final String PREFERENCE_START_INTEGRATED_INBOX = "start_integrated_inbox";
private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars";
@ -59,6 +60,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference mGestures;
private CheckBoxPreference mVolumeNavigation;
private CheckBoxPreference mManageBack;
private CheckBoxPreference mStartIntegratedInbox;
private CheckBoxPreference mAnimations;
@ -198,6 +200,8 @@ public class Prefs extends K9PreferenceActivity
mAnimations.setChecked(K9.showAnimations());
mGestures = (CheckBoxPreference)findPreference(PREFERENCE_GESTURES);
mGestures.setChecked(K9.gesturesEnabled());
mVolumeNavigation = (CheckBoxPreference)findPreference(PREFERENCE_VOLUME_NAVIGATION);
mVolumeNavigation.setChecked(K9.useVolumeKeysForNavigationEnabled());
mManageBack = (CheckBoxPreference)findPreference(PREFERENCE_MANAGE_BACK);
mManageBack.setChecked(K9.manageBack());
@ -248,6 +252,7 @@ public class Prefs extends K9PreferenceActivity
K9.setAnimations(mAnimations.isChecked());
K9.setGesturesEnabled(mGestures.isChecked());
K9.setUseVolumeKeysForNavigation(mVolumeNavigation.isChecked());
K9.setManageBack(mManageBack.isChecked());
K9.setStartIntegratedInbox(mStartIntegratedInbox.isChecked());
K9.setMessageListStars(mStars.isChecked());