1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -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

@ -10,7 +10,7 @@
<string name="read_attachment_label">read Email attachments</string>
<string name="read_attachment_desc">Allows this application to read your Email attachments.</string>
<string name="about_title_fmt">About <xliff:g id="app_name">%s</xliff:g></string>
<string name="accounts_title">Accounts</string>
<string name="folder_list_title"><xliff:g id="account">%s</xliff:g> </string>
@ -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_name_label">Your name</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_summary">Vibrate when mail arrives</string>
<string name="account_settings_ringtone">New mail ringtone</string>

View File

@ -180,6 +180,13 @@
android:title="@string/account_settings_ringtone"
android:ringtoneType="notification"
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
android:layout="?android:attr/preferenceLayoutChild"

View File

@ -53,6 +53,7 @@ public class Account implements Serializable
FolderMode mFolderTargetMode;
int mAccountNumber;
boolean mVibrate;
boolean mRing;
String mRingtoneUri;
boolean mNotifySync;
HideButtons mHideMessageViewButtons;
@ -97,6 +98,7 @@ public class Account implements Serializable
mNotifyNewMail = true;
mNotifySync = true;
mVibrate = false;
mRing = true;
mNotifySelfNewMail = true;
mLeftHanded = false;
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
@ -231,6 +233,7 @@ public class Account implements Serializable
mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0);
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);
try
{
@ -531,6 +534,7 @@ public class Account implements Serializable
editor.remove(mUuid + ".autoExpandFolderName");
editor.remove(mUuid + ".accountNumber");
editor.remove(mUuid + ".vibrate");
editor.remove(mUuid + ".ring");
editor.remove(mUuid + ".ringtone");
editor.remove(mUuid + ".lastFullSync");
editor.remove(mUuid + ".folderDisplayMode");
@ -604,6 +608,7 @@ public class Account implements Serializable
editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
editor.putInt(mUuid + ".accountNumber", mAccountNumber);
editor.putBoolean(mUuid + ".vibrate", mVibrate);
editor.putBoolean(mUuid + ".ring", mRing);
editor.putString(mUuid + ".hideButtonsEnum", mHideMessageViewButtons.name());
editor.putString(mUuid + ".ringtone", mRingtoneUri);
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
@ -966,4 +971,14 @@ public class Account implements Serializable
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_SYNC = "account_notify_sync";
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_INCOMING = "incoming";
private static final String PREFERENCE_OUTGOING = "outgoing";
@ -59,6 +60,7 @@ public class AccountSettings extends K9PreferenceActivity
private ListPreference mAccountHideButtons;
private CheckBoxPreference mAccountNotifySync;
private CheckBoxPreference mAccountVibrate;
private CheckBoxPreference mAccountRing;
private RingtonePreference mAccountRingtone;
private ListPreference mDisplayMode;
private ListPreference mSyncMode;
@ -300,6 +302,10 @@ public class AccountSettings extends K9PreferenceActivity
mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
mAccountVibrate.setChecked(mAccount.isVibrate());
mAccountRing = (CheckBoxPreference) findPreference(PREFERENCE_RING);
mAccountRing.setChecked(mAccount.isRing());
mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
@ -376,6 +382,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
mAccount.setVibrate(mAccountVibrate.isChecked());
mAccount.setRing(mAccountRing.isChecked());
mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));