2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-16 18:34:01 -05:00
|
|
|
package com.android.email.activity.setup;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.KeyEvent;
|
2009-04-08 14:14:52 -04:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.widget.Button;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.preference.PreferenceActivity;
|
|
|
|
import android.preference.EditTextPreference;
|
|
|
|
import android.preference.ListPreference;
|
|
|
|
import android.preference.CheckBoxPreference;
|
|
|
|
import android.preference.Preference;
|
2009-04-08 14:14:52 -04:00
|
|
|
import android.preference.PreferenceScreen;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.preference.RingtonePreference;
|
2009-04-08 14:14:52 -04:00
|
|
|
import android.preference.Preference.OnPreferenceClickListener;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-16 18:34:01 -05:00
|
|
|
import com.android.email.Account;
|
|
|
|
import com.android.email.Email;
|
|
|
|
import com.android.email.Preferences;
|
|
|
|
import com.android.email.R;
|
2009-04-08 14:14:52 -04:00
|
|
|
import com.android.email.activity.ChooseFolder;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public class AccountSettings extends PreferenceActivity {
|
|
|
|
private static final String EXTRA_ACCOUNT = "account";
|
2009-04-08 14:14:52 -04:00
|
|
|
|
|
|
|
private static final int SELECT_AUTO_EXPAND_FOLDER = 1;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private static final String PREFERENCE_TOP_CATERGORY = "account_settings";
|
|
|
|
private static final String PREFERENCE_DESCRIPTION = "account_description";
|
|
|
|
private static final String PREFERENCE_COMPOSITION = "composition";
|
|
|
|
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
|
2008-12-11 00:25:59 -05:00
|
|
|
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_DEFAULT = "account_default";
|
2009-01-24 13:58:40 -05:00
|
|
|
private static final String PREFERENCE_HIDE_BUTTONS = "hide_buttons_enum";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_NOTIFY = "account_notify";
|
2009-01-18 11:42:55 -05:00
|
|
|
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_VIBRATE = "account_vibrate";
|
|
|
|
private static final String PREFERENCE_RINGTONE = "account_ringtone";
|
|
|
|
private static final String PREFERENCE_INCOMING = "incoming";
|
|
|
|
private static final String PREFERENCE_OUTGOING = "outgoing";
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
private static final String PREFERENCE_DISPLAY_MODE = "folder_display_mode";
|
|
|
|
private static final String PREFERENCE_SYNC_MODE = "folder_sync_mode";
|
2009-03-05 02:32:45 -05:00
|
|
|
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
private static final String PREFERENCE_DELETE_POLICY = "delete_policy";
|
2009-04-08 14:14:52 -04:00
|
|
|
private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder";
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private Account mAccount;
|
|
|
|
|
|
|
|
private EditTextPreference mAccountDescription;
|
|
|
|
private ListPreference mCheckFrequency;
|
2008-12-11 00:25:59 -05:00
|
|
|
private ListPreference mDisplayCount;
|
2008-11-01 17:32:06 -04:00
|
|
|
private CheckBoxPreference mAccountDefault;
|
|
|
|
private CheckBoxPreference mAccountNotify;
|
2009-01-24 13:58:40 -05:00
|
|
|
private ListPreference mAccountHideButtons;
|
2009-01-18 11:42:55 -05:00
|
|
|
private CheckBoxPreference mAccountNotifySync;
|
2008-11-01 17:32:06 -04:00
|
|
|
private CheckBoxPreference mAccountVibrate;
|
|
|
|
private RingtonePreference mAccountRingtone;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
private ListPreference mDisplayMode;
|
|
|
|
private ListPreference mSyncMode;
|
2009-03-05 02:32:45 -05:00
|
|
|
private ListPreference mTargetMode;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
private ListPreference mDeletePolicy;
|
2009-04-08 14:14:52 -04:00
|
|
|
private Preference mAutoExpandFolder;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public static void actionSettings(Context context, Account account) {
|
|
|
|
Intent i = new Intent(context, AccountSettings.class);
|
|
|
|
i.putExtra(EXTRA_ACCOUNT, account);
|
|
|
|
context.startActivity(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
mAccount = (Account)getIntent().getSerializableExtra(EXTRA_ACCOUNT);
|
|
|
|
|
|
|
|
addPreferencesFromResource(R.xml.account_settings_preferences);
|
|
|
|
|
|
|
|
Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
|
|
|
|
category.setTitle(getString(R.string.account_settings_title_fmt));
|
|
|
|
|
|
|
|
mAccountDescription = (EditTextPreference) findPreference(PREFERENCE_DESCRIPTION);
|
|
|
|
mAccountDescription.setSummary(mAccount.getDescription());
|
|
|
|
mAccountDescription.setText(mAccount.getDescription());
|
|
|
|
mAccountDescription.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
mAccountDescription.setSummary(summary);
|
|
|
|
mAccountDescription.setText(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
|
|
|
|
mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
|
|
|
|
mCheckFrequency.setSummary(mCheckFrequency.getEntry());
|
|
|
|
mCheckFrequency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mCheckFrequency.findIndexOfValue(summary);
|
|
|
|
mCheckFrequency.setSummary(mCheckFrequency.getEntries()[index]);
|
|
|
|
mCheckFrequency.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
|
|
|
mDisplayMode = (ListPreference) findPreference(PREFERENCE_DISPLAY_MODE);
|
|
|
|
mDisplayMode.setValue(mAccount.getFolderDisplayMode().name());
|
|
|
|
mDisplayMode.setSummary(mDisplayMode.getEntry());
|
|
|
|
mDisplayMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDisplayMode.findIndexOfValue(summary);
|
|
|
|
mDisplayMode.setSummary(mDisplayMode.getEntries()[index]);
|
|
|
|
mDisplayMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
mSyncMode = (ListPreference) findPreference(PREFERENCE_SYNC_MODE);
|
|
|
|
mSyncMode.setValue(mAccount.getFolderSyncMode().name());
|
|
|
|
mSyncMode.setSummary(mSyncMode.getEntry());
|
|
|
|
mSyncMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mSyncMode.findIndexOfValue(summary);
|
|
|
|
mSyncMode.setSummary(mSyncMode.getEntries()[index]);
|
|
|
|
mSyncMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2009-03-05 02:32:45 -05:00
|
|
|
mTargetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
|
|
|
|
mTargetMode.setValue(mAccount.getFolderTargetMode().name());
|
|
|
|
mTargetMode.setSummary(mTargetMode.getEntry());
|
|
|
|
mTargetMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mTargetMode.findIndexOfValue(summary);
|
|
|
|
mTargetMode.setSummary(mTargetMode.getEntries()[index]);
|
|
|
|
mTargetMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
|
|
|
|
mDeletePolicy.setValue("" + mAccount.getDeletePolicy());
|
|
|
|
mDeletePolicy.setSummary(mDeletePolicy.getEntry());
|
|
|
|
mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDeletePolicy.findIndexOfValue(summary);
|
|
|
|
mDeletePolicy.setSummary(mDeletePolicy.getEntries()[index]);
|
|
|
|
mDeletePolicy.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-11 00:25:59 -05:00
|
|
|
mDisplayCount = (ListPreference) findPreference(PREFERENCE_DISPLAY_COUNT);
|
|
|
|
mDisplayCount.setValue(String.valueOf(mAccount.getDisplayCount()));
|
|
|
|
mDisplayCount.setSummary(mDisplayCount.getEntry());
|
|
|
|
mDisplayCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDisplayCount.findIndexOfValue(summary);
|
|
|
|
mDisplayCount.setSummary(mDisplayCount.getEntries()[index]);
|
|
|
|
mDisplayCount.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
|
|
|
|
mAccountDefault.setChecked(
|
|
|
|
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
|
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
|
|
|
|
mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons());
|
|
|
|
mAccountHideButtons.setSummary(mAccountHideButtons.getEntry());
|
|
|
|
mAccountHideButtons.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mAccountHideButtons.findIndexOfValue(summary);
|
|
|
|
mAccountHideButtons.setSummary(mAccountHideButtons.getEntries()[index]);
|
|
|
|
mAccountHideButtons.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
|
|
|
|
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
|
|
|
|
|
2009-01-18 11:42:55 -05:00
|
|
|
mAccountNotifySync = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SYNC);
|
|
|
|
mAccountNotifySync.setChecked(mAccount.isShowOngoing());
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountRingtone = (RingtonePreference) findPreference(PREFERENCE_RINGTONE);
|
|
|
|
|
|
|
|
// XXX: The following two lines act as a workaround for the RingtonePreference
|
|
|
|
// which does not let us set/get the value programmatically
|
|
|
|
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
|
|
|
prefs.edit().putString(PREFERENCE_RINGTONE, mAccount.getRingtone()).commit();
|
|
|
|
|
|
|
|
mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
|
|
|
|
mAccountVibrate.setChecked(mAccount.isVibrate());
|
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName()));
|
|
|
|
|
|
|
|
mAutoExpandFolder.setOnPreferenceClickListener(
|
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
onChooseAutoExpandFolder();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener(
|
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
onCompositionSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
findPreference(PREFERENCE_INCOMING).setOnPreferenceClickListener(
|
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
onIncomingSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
findPreference(PREFERENCE_OUTGOING).setOnPreferenceClickListener(
|
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
|
|
|
onOutgoingSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
mAccount.refresh(Preferences.getPreferences(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
private void saveSettings() {
|
|
|
|
if (mAccountDefault.isChecked()) {
|
|
|
|
Preferences.getPreferences(this).setDefaultAccount(mAccount);
|
|
|
|
}
|
|
|
|
mAccount.setDescription(mAccountDescription.getText());
|
|
|
|
mAccount.setNotifyNewMail(mAccountNotify.isChecked());
|
2009-01-18 11:42:55 -05:00
|
|
|
mAccount.setShowOngoing(mAccountNotifySync.isChecked());
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
2008-12-11 00:25:59 -05:00
|
|
|
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount.setVibrate(mAccountVibrate.isChecked());
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
|
|
|
mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
|
2009-03-05 02:32:45 -05:00
|
|
|
mAccount.setFolderTargetMode(Account.FolderMode.valueOf(mTargetMode.getValue()));
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
|
2008-11-01 17:32:06 -04:00
|
|
|
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
|
|
|
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));
|
2009-01-24 13:58:40 -05:00
|
|
|
mAccount.setHideMessageViewButtons(Account.HideButtons.valueOf(mAccountHideButtons.getValue()));
|
2009-04-08 14:14:52 -04:00
|
|
|
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString()));
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount.save(Preferences.getPreferences(this));
|
2008-12-16 18:34:01 -05:00
|
|
|
Email.setServicesEnabled(this);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
// TODO: refresh folder list here
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-04-08 14:14:52 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
switch (requestCode) {
|
|
|
|
case SELECT_AUTO_EXPAND_FOLDER:
|
|
|
|
mAutoExpandFolder.setSummary(translateFolder(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
|
saveSettings();
|
|
|
|
}
|
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onCompositionSettings() {
|
|
|
|
AccountSetupComposition.actionEditCompositionSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onIncomingSettings() {
|
|
|
|
AccountSetupIncoming.actionEditIncomingSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onOutgoingSettings() {
|
|
|
|
AccountSetupOutgoing.actionEditOutgoingSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
public void onChooseAutoExpandFolder()
|
|
|
|
{
|
|
|
|
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount);
|
|
|
|
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mAutoExpandFolder.getSummary());
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_CURRENT, "yes");
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_FOLDER_NONE, "yes");
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes");
|
|
|
|
startActivityForResult(selectIntent, SELECT_AUTO_EXPAND_FOLDER);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private String translateFolder(String in)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (Email.INBOX.equalsIgnoreCase(in))
|
|
|
|
{
|
|
|
|
return getString(R.string.special_mailbox_name_inbox);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private String reverseTranslateFolder(String in)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (getString(R.string.special_mailbox_name_inbox).equals(in))
|
|
|
|
{
|
|
|
|
return Email.INBOX;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|