mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-30 06:40:15 -05:00
Patch from debauchedsloth for issue 190 that makes the ongoing
notifications duing email send/receive optional.
This commit is contained in:
parent
dc40026b31
commit
0706b7de45
@ -39,6 +39,11 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:text="@string/account_setup_options_notify_label" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_notify_sync"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:text="@string/account_setup_options_notify_sync_label" />
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
|
@ -256,6 +256,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
|
||||
<string name="account_setup_options_mail_check_frequency_1hour">Every hour</string>
|
||||
<string name="account_setup_options_default_label">Send email from this account by default.</string>
|
||||
<string name="account_setup_options_notify_label">Notify me when email arrives.</string>
|
||||
<string name="account_setup_options_notify_sync_label">Notify me while email is being checked.</string>
|
||||
|
||||
<!-- Number of displayed messages, also used in account_settings_* -->
|
||||
<string name="account_setup_options_mail_display_count_label">Number of emails to display</string>
|
||||
@ -275,8 +276,10 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
|
||||
<string name="account_settings_default_label">Default account</string>
|
||||
<string name="account_settings_default_summary">Send email from this account by default</string>
|
||||
<string name="account_settings_notify_label">Email notifications</string>
|
||||
<string name="account_settings_notify_sync_label">Email check notifications</string>
|
||||
<string name="account_settings_email_label">Your email address</string>
|
||||
<string name="account_settings_notify_summary">Notify in status bar when email arrives</string>
|
||||
<string name="account_settings_notify_sync_summary">Notify in status bar while email is checked</string>
|
||||
<string name="account_settings_show_combined_label">Show combined Inbox</string>
|
||||
|
||||
<string name="account_settings_display_sync">Display and synchronization</string>
|
||||
@ -318,7 +321,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
|
||||
<string name="account_settings_name_label">Your name</string>
|
||||
<string name="account_settings_notifications">Notification settings</string>
|
||||
<string name="account_settings_vibrate_enable">Vibrate</string>
|
||||
<string name="account_settings_vibrate_summary">Also vibrate when email arrives</string>
|
||||
<string name="account_settings_vibrate_summary">Vibrate when email arrives</string>
|
||||
<string name="account_settings_ringtone">Select ringtone</string>
|
||||
<string name="account_settings_servers">Server settings</string>
|
||||
|
||||
|
@ -103,6 +103,12 @@
|
||||
android:title="@string/account_settings_vibrate_enable"
|
||||
android:summary="@string/account_settings_vibrate_summary" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="account_notify_sync"
|
||||
android:title="@string/account_settings_notify_sync_label"
|
||||
android:defaultValue="true"
|
||||
android:summary="@string/account_settings_notify_sync_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/account_settings_servers">
|
||||
|
@ -51,7 +51,7 @@ public class Account implements Serializable {
|
||||
int mAccountNumber;
|
||||
boolean mVibrate;
|
||||
String mRingtoneUri;
|
||||
boolean showOngoing = true;
|
||||
boolean mNotifySync;
|
||||
|
||||
public enum FolderMode {
|
||||
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
|
||||
@ -74,6 +74,7 @@ public class Account implements Serializable {
|
||||
mDisplayCount = -1;
|
||||
mAccountNumber = -1;
|
||||
mNotifyNewMail = true;
|
||||
mNotifySync = true;
|
||||
mSignature = "Sent from my Android phone with K-9. Please excuse my brevity.";
|
||||
mVibrate = false;
|
||||
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||
@ -107,6 +108,8 @@ public class Account implements Serializable {
|
||||
+ ".lastAutomaticCheckTime", 0);
|
||||
mNotifyNewMail = preferences.mSharedPreferences.getBoolean(mUuid + ".notifyNewMail",
|
||||
false);
|
||||
mNotifySync = preferences.mSharedPreferences.getBoolean(mUuid + ".notifyMailCheck",
|
||||
false);
|
||||
mDeletePolicy = preferences.mSharedPreferences.getInt(mUuid + ".deletePolicy", 0);
|
||||
mDraftsFolderName = preferences.mSharedPreferences.getString(mUuid + ".draftsFolderName",
|
||||
"Drafts");
|
||||
@ -308,6 +311,7 @@ public class Account implements Serializable {
|
||||
editor.putInt(mUuid + ".displayCount", mDisplayCount);
|
||||
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);
|
||||
editor.putBoolean(mUuid + ".notifyNewMail", mNotifyNewMail);
|
||||
editor.putBoolean(mUuid + ".notifyMailCheck", mNotifySync);
|
||||
editor.putInt(mUuid + ".deletePolicy", mDeletePolicy);
|
||||
editor.putString(mUuid + ".draftsFolderName", mDraftsFolderName);
|
||||
editor.putString(mUuid + ".sentFolderName", mSentFolderName);
|
||||
@ -508,12 +512,12 @@ public class Account implements Serializable {
|
||||
|
||||
public boolean isShowOngoing()
|
||||
{
|
||||
return showOngoing;
|
||||
return mNotifySync;
|
||||
}
|
||||
|
||||
public void setShowOngoing(boolean showOngoing)
|
||||
{
|
||||
this.showOngoing = showOngoing;
|
||||
this.mNotifySync = showOngoing;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -632,18 +632,6 @@ public class MessagingController implements Runnable {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Trash any remote messages that are marked as trashed locally.
|
||||
*/
|
||||
// for (Message message : localMessages) {
|
||||
// Message remoteMessage = remoteUidMap.get(message.getUid());
|
||||
// // skip things deleted on the server side
|
||||
// if (remoteMessage != null && message.isSet(Flag.DELETED)) {
|
||||
// remoteMessage.setFlag(Flag.DELETED, true);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
* A list of messages that were downloaded and which did not have the Seen flag set.
|
||||
@ -744,7 +732,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
||||
{
|
||||
if (remoteMessage.isSet(flag) != localMessage.isSet(flag)) {
|
||||
localMessage.setFlag(flag, remoteMessage.isSet(flag));
|
||||
|
||||
messageChanged = true;
|
||||
}
|
||||
}
|
||||
if (messageChanged) {
|
||||
@ -2157,7 +2145,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
||||
sendPendingMessagesSynchronous(account);
|
||||
}
|
||||
finally {
|
||||
if (account.showOngoing) {
|
||||
if (account.isShowOngoing()) {
|
||||
notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ public class AccountSettings extends PreferenceActivity {
|
||||
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
|
||||
private static final String PREFERENCE_DEFAULT = "account_default";
|
||||
private static final String PREFERENCE_NOTIFY = "account_notify";
|
||||
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
|
||||
private static final String PREFERENCE_VIBRATE = "account_vibrate";
|
||||
private static final String PREFERENCE_RINGTONE = "account_ringtone";
|
||||
private static final String PREFERENCE_INCOMING = "incoming";
|
||||
@ -43,6 +44,7 @@ public class AccountSettings extends PreferenceActivity {
|
||||
private ListPreference mDisplayCount;
|
||||
private CheckBoxPreference mAccountDefault;
|
||||
private CheckBoxPreference mAccountNotify;
|
||||
private CheckBoxPreference mAccountNotifySync;
|
||||
private CheckBoxPreference mAccountVibrate;
|
||||
private RingtonePreference mAccountRingtone;
|
||||
private ListPreference mDisplayMode;
|
||||
@ -151,6 +153,9 @@ public class AccountSettings extends PreferenceActivity {
|
||||
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
|
||||
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
|
||||
|
||||
mAccountNotifySync = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SYNC);
|
||||
mAccountNotifySync.setChecked(mAccount.isShowOngoing());
|
||||
|
||||
mAccountRingtone = (RingtonePreference) findPreference(PREFERENCE_RINGTONE);
|
||||
|
||||
// XXX: The following two lines act as a workaround for the RingtonePreference
|
||||
@ -199,6 +204,7 @@ public class AccountSettings extends PreferenceActivity {
|
||||
}
|
||||
mAccount.setDescription(mAccountDescription.getText());
|
||||
mAccount.setNotifyNewMail(mAccountNotify.isChecked());
|
||||
mAccount.setShowOngoing(mAccountNotifySync.isChecked());
|
||||
mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
||||
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
|
||||
mAccount.setVibrate(mAccountVibrate.isChecked());
|
||||
|
@ -28,6 +28,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
||||
private CheckBox mDefaultView;
|
||||
|
||||
private CheckBox mNotifyView;
|
||||
private CheckBox mNotifySyncView;
|
||||
|
||||
private Account mAccount;
|
||||
|
||||
@ -47,6 +48,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
||||
mDisplayCountView = (Spinner)findViewById(R.id.account_display_count);
|
||||
mDefaultView = (CheckBox)findViewById(R.id.account_default);
|
||||
mNotifyView = (CheckBox)findViewById(R.id.account_notify);
|
||||
mNotifySyncView = (CheckBox)findViewById(R.id.account_notify_sync);
|
||||
|
||||
findViewById(R.id.next).setOnClickListener(this);
|
||||
|
||||
@ -96,6 +98,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
||||
mDefaultView.setChecked(true);
|
||||
}
|
||||
mNotifyView.setChecked(mAccount.isNotifyNewMail());
|
||||
mNotifySyncView.setChecked(mAccount.isShowOngoing());
|
||||
SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView, mAccount
|
||||
.getAutomaticCheckIntervalMinutes());
|
||||
SpinnerOption.setSpinnerOptionValue(mDisplayCountView, mAccount
|
||||
@ -105,6 +108,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
|
||||
private void onDone() {
|
||||
mAccount.setDescription(mAccount.getEmail());
|
||||
mAccount.setNotifyNewMail(mNotifyView.isChecked());
|
||||
mAccount.setShowOngoing(mNotifySyncView.isChecked());
|
||||
mAccount.setAutomaticCheckIntervalMinutes((Integer)((SpinnerOption)mCheckFrequencyView
|
||||
.getSelectedItem()).value);
|
||||
mAccount.setDisplayCount((Integer)((SpinnerOption)mDisplayCountView
|
||||
|
Loading…
Reference in New Issue
Block a user