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

Add explicit ring setting for notifications

This commit is contained in:
Daniel Applebaum 2010-01-04 00:40:41 +00:00
parent 6caec1100c
commit 41729af9b2
4 changed files with 32 additions and 1 deletions

View File

@ -488,6 +488,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_description_label">Account name</string> <string name="account_settings_description_label">Account name</string>
<string name="account_settings_name_label">Your name</string> <string name="account_settings_name_label">Your name</string>
<string name="account_settings_notifications">Notifications</string> <string name="account_settings_notifications">Notifications</string>
<string name="account_settings_ring_enable">Ring</string>
<string name="account_settings_ring_summary">Ring when mail arrives</string>
<string name="account_settings_vibrate_enable">Vibrate</string> <string name="account_settings_vibrate_enable">Vibrate</string>
<string name="account_settings_vibrate_summary">Vibrate when mail arrives</string> <string name="account_settings_vibrate_summary">Vibrate when mail arrives</string>
<string name="account_settings_ringtone">New mail ringtone</string> <string name="account_settings_ringtone">New mail ringtone</string>

View File

@ -180,6 +180,13 @@
android:title="@string/account_settings_ringtone" android:title="@string/account_settings_ringtone"
android:ringtoneType="notification" android:ringtoneType="notification"
android:defaultValue="content://settings/system/notification_sound" /> android:defaultValue="content://settings/system/notification_sound" />
<CheckBoxPreference
android:layout="?android:attr/preferenceLayoutChild"
android:dependency="account_notify"
android:key="account_ring"
android:defaultValue="true"
android:title="@string/account_settings_ring_enable"
android:summary="@string/account_settings_ring_summary" />
<CheckBoxPreference <CheckBoxPreference
android:layout="?android:attr/preferenceLayoutChild" android:layout="?android:attr/preferenceLayoutChild"

View File

@ -53,6 +53,7 @@ public class Account implements Serializable
FolderMode mFolderTargetMode; FolderMode mFolderTargetMode;
int mAccountNumber; int mAccountNumber;
boolean mVibrate; boolean mVibrate;
boolean mRing;
String mRingtoneUri; String mRingtoneUri;
boolean mNotifySync; boolean mNotifySync;
HideButtons mHideMessageViewButtons; HideButtons mHideMessageViewButtons;
@ -97,6 +98,7 @@ public class Account implements Serializable
mNotifyNewMail = true; mNotifyNewMail = true;
mNotifySync = true; mNotifySync = true;
mVibrate = false; mVibrate = false;
mRing = true;
mNotifySelfNewMail = true; mNotifySelfNewMail = true;
mLeftHanded = false; mLeftHanded = false;
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS; mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
@ -231,6 +233,7 @@ public class Account implements Serializable
mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0); mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0);
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false); mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);
try try
{ {
@ -531,6 +534,7 @@ public class Account implements Serializable
editor.remove(mUuid + ".autoExpandFolderName"); editor.remove(mUuid + ".autoExpandFolderName");
editor.remove(mUuid + ".accountNumber"); editor.remove(mUuid + ".accountNumber");
editor.remove(mUuid + ".vibrate"); editor.remove(mUuid + ".vibrate");
editor.remove(mUuid + ".ring");
editor.remove(mUuid + ".ringtone"); editor.remove(mUuid + ".ringtone");
editor.remove(mUuid + ".lastFullSync"); editor.remove(mUuid + ".lastFullSync");
editor.remove(mUuid + ".folderDisplayMode"); editor.remove(mUuid + ".folderDisplayMode");
@ -604,6 +608,7 @@ public class Account implements Serializable
editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName); editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
editor.putInt(mUuid + ".accountNumber", mAccountNumber); editor.putInt(mUuid + ".accountNumber", mAccountNumber);
editor.putBoolean(mUuid + ".vibrate", mVibrate); editor.putBoolean(mUuid + ".vibrate", mVibrate);
editor.putBoolean(mUuid + ".ring", mRing);
editor.putString(mUuid + ".hideButtonsEnum", mHideMessageViewButtons.name()); editor.putString(mUuid + ".hideButtonsEnum", mHideMessageViewButtons.name());
editor.putString(mUuid + ".ringtone", mRingtoneUri); editor.putString(mUuid + ".ringtone", mRingtoneUri);
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name()); editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
@ -966,4 +971,14 @@ public class Account implements Serializable
mMaxPushFolders = maxPushFolders; mMaxPushFolders = maxPushFolders;
} }
public boolean isRing()
{
return mRing;
}
public void setRing(boolean ring)
{
mRing = ring;
}
} }

View File

@ -34,6 +34,7 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_NOTIFY_SELF = "account_notify_self"; private static final String PREFERENCE_NOTIFY_SELF = "account_notify_self";
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync"; private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
private static final String PREFERENCE_VIBRATE = "account_vibrate"; private static final String PREFERENCE_VIBRATE = "account_vibrate";
private static final String PREFERENCE_RING = "account_ring";
private static final String PREFERENCE_RINGTONE = "account_ringtone"; private static final String PREFERENCE_RINGTONE = "account_ringtone";
private static final String PREFERENCE_INCOMING = "incoming"; private static final String PREFERENCE_INCOMING = "incoming";
private static final String PREFERENCE_OUTGOING = "outgoing"; private static final String PREFERENCE_OUTGOING = "outgoing";
@ -59,6 +60,7 @@ public class AccountSettings extends K9PreferenceActivity
private ListPreference mAccountHideButtons; private ListPreference mAccountHideButtons;
private CheckBoxPreference mAccountNotifySync; private CheckBoxPreference mAccountNotifySync;
private CheckBoxPreference mAccountVibrate; private CheckBoxPreference mAccountVibrate;
private CheckBoxPreference mAccountRing;
private RingtonePreference mAccountRingtone; private RingtonePreference mAccountRingtone;
private ListPreference mDisplayMode; private ListPreference mDisplayMode;
private ListPreference mSyncMode; private ListPreference mSyncMode;
@ -301,6 +303,10 @@ public class AccountSettings extends K9PreferenceActivity
mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE); mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
mAccountVibrate.setChecked(mAccount.isVibrate()); mAccountVibrate.setChecked(mAccount.isVibrate());
mAccountRing = (CheckBoxPreference) findPreference(PREFERENCE_RING);
mAccountRing.setChecked(mAccount.isRing());
mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER); mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName())); mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName()));
@ -376,6 +382,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue())); mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue())); mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
mAccount.setVibrate(mAccountVibrate.isChecked()); mAccount.setVibrate(mAccountVibrate.isChecked());
mAccount.setRing(mAccountRing.isChecked());
mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue())); mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue())); mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));