diff --git a/res/layout/account_setup_options.xml b/res/layout/account_setup_options.xml index e4472a239..8061e39d3 100644 --- a/res/layout/account_setup_options.xml +++ b/res/layout/account_setup_options.xml @@ -39,6 +39,11 @@ android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="@string/account_setup_options_notify_label" /> + Every hour Send email from this account by default. Notify me when email arrives. + Notify me while email is being checked. Number of emails to display @@ -275,8 +276,10 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based Default account Send email from this account by default Email notifications + Email check notifications Your email address Notify in status bar when email arrives + Notify in status bar while email is checked Show combined Inbox Display and synchronization @@ -318,7 +321,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based Your name Notification settings Vibrate - Also vibrate when email arrives + Vibrate when email arrives Select ringtone Server settings diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml index f0bc3961a..a76541a35 100644 --- a/res/xml/account_settings_preferences.xml +++ b/res/xml/account_settings_preferences.xml @@ -103,6 +103,12 @@ android:title="@string/account_settings_vibrate_enable" android:summary="@string/account_settings_vibrate_summary" /> + + diff --git a/src/com/android/email/Account.java b/src/com/android/email/Account.java index 04486d98a..35325c5bf 100644 --- a/src/com/android/email/Account.java +++ b/src/com/android/email/Account.java @@ -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; } } diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index 05a76ea93..d29a81f6a 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -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); } } diff --git a/src/com/android/email/activity/setup/AccountSettings.java b/src/com/android/email/activity/setup/AccountSettings.java index e3a71b8ee..90dcb59f9 100644 --- a/src/com/android/email/activity/setup/AccountSettings.java +++ b/src/com/android/email/activity/setup/AccountSettings.java @@ -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()); diff --git a/src/com/android/email/activity/setup/AccountSetupOptions.java b/src/com/android/email/activity/setup/AccountSetupOptions.java index 124186ff3..85be1553e 100644 --- a/src/com/android/email/activity/setup/AccountSetupOptions.java +++ b/src/com/android/email/activity/setup/AccountSetupOptions.java @@ -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