1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-28 04:02:19 -05:00

Cosmetic code changes

This commit is contained in:
cketti 2010-10-13 20:56:44 +00:00
parent 4be781a749
commit 742db2ac62

View File

@ -82,6 +82,8 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature"; private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature";
private Account mAccount; private Account mAccount;
private boolean mIsPushCapable = false;
private boolean mIsExpungeCapable = false;
private EditTextPreference mAccountDescription; private EditTextPreference mAccountDescription;
private ListPreference mCheckFrequency; private ListPreference mCheckFrequency;
@ -117,18 +119,12 @@ public class AccountSettings extends K9PreferenceActivity
private CheckBoxPreference mReplyAfterQuote; private CheckBoxPreference mReplyAfterQuote;
private CheckBoxPreference mSyncRemoteDeletions; private CheckBoxPreference mSyncRemoteDeletions;
private CheckBoxPreference mSaveAllHeaders; private CheckBoxPreference mSaveAllHeaders;
private CheckBoxPreference mPushPollOnConnect; private CheckBoxPreference mPushPollOnConnect;
private ListPreference mIdleRefreshPeriod; private ListPreference mIdleRefreshPeriod;
private ListPreference mMaxPushFolders; private ListPreference mMaxPushFolders;
private ListPreference mCryptoApp; private ListPreference mCryptoApp;
private CheckBoxPreference mCryptoAutoSignature; private CheckBoxPreference mCryptoAutoSignature;
boolean mIsPushCapable = false;
boolean mIsExpungeCapable = false;
public static void actionSettings(Context context, Account account) public static void actionSettings(Context context, Account account)
{ {
@ -145,8 +141,6 @@ public class AccountSettings extends K9PreferenceActivity
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT); String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
try try
{ {
final Store store = mAccount.getRemoteStore(); final Store store = mAccount.getRemoteStore();
@ -286,7 +280,6 @@ public class AccountSettings extends K9PreferenceActivity
} }
}); });
mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY); mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
mExpungePolicy.setEnabled(mIsExpungeCapable); mExpungePolicy.setEnabled(mIsExpungeCapable);
mExpungePolicy.setValue(mAccount.getExpungePolicy()); mExpungePolicy.setValue(mAccount.getExpungePolicy());
@ -306,12 +299,9 @@ public class AccountSettings extends K9PreferenceActivity
mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS); mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions()); mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
mSaveAllHeaders = (CheckBoxPreference) findPreference(PREFERENCE_SAVE_ALL_HEADERS); mSaveAllHeaders = (CheckBoxPreference) findPreference(PREFERENCE_SAVE_ALL_HEADERS);
mSaveAllHeaders.setChecked(mAccount.saveAllHeaders()); mSaveAllHeaders.setChecked(mAccount.saveAllHeaders());
mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS); mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
mSearchableFolders.setValue(mAccount.getSearchableFolders().name()); mSearchableFolders.setValue(mAccount.getSearchableFolders().name());
mSearchableFolders.setSummary(mSearchableFolders.getEntry()); mSearchableFolders.setSummary(mSearchableFolders.getEntry());
@ -357,8 +347,6 @@ public class AccountSettings extends K9PreferenceActivity
} }
}); });
mMessageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE); mMessageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE);
mMessageSize.setValue(String.valueOf(mAccount.getMaximumAutoDownloadMessageSize())); mMessageSize.setValue(String.valueOf(mAccount.getMaximumAutoDownloadMessageSize()));
mMessageSize.setSummary(mMessageSize.getEntry()); mMessageSize.setSummary(mMessageSize.getEntry());
@ -374,13 +362,10 @@ public class AccountSettings extends K9PreferenceActivity
} }
}); });
mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT); mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
mAccountDefault.setChecked( mAccountDefault.setChecked(
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())); mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS); mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons()); mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons());
mAccountHideButtons.setSummary(mAccountHideButtons.getEntry()); mAccountHideButtons.setSummary(mAccountHideButtons.getEntry());
@ -439,7 +424,6 @@ public class AccountSettings extends K9PreferenceActivity
{ {
mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect()); mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes())); mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes()));
mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry()); mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry());
mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
@ -454,7 +438,6 @@ public class AccountSettings extends K9PreferenceActivity
} }
}); });
mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders())); mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders()));
mMaxPushFolders.setSummary(mMaxPushFolders.getEntry()); mMaxPushFolders.setSummary(mMaxPushFolders.getEntry());
mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
@ -468,17 +451,12 @@ public class AccountSettings extends K9PreferenceActivity
return false; return false;
} }
}); });
} }
else else
{ {
mPushPollOnConnect.setEnabled(false); mPushPollOnConnect.setEnabled(false);
mMaxPushFolders.setEnabled(false); mMaxPushFolders.setEnabled(false);
mIdleRefreshPeriod.setEnabled(false); mIdleRefreshPeriod.setEnabled(false);
} }
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY); mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
@ -539,50 +517,36 @@ public class AccountSettings extends K9PreferenceActivity
mNotificationOpensUnread = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD); mNotificationOpensUnread = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD);
mNotificationOpensUnread.setChecked(mAccount.goToUnreadMessageSearch()); mNotificationOpensUnread.setChecked(mAccount.goToUnreadMessageSearch());
mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER); mAutoExpandFolder = (Preference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName())); mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName()));
mAutoExpandFolder.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
mAutoExpandFolder.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener()
{ {
public boolean onPreferenceClick(Preference preference) public boolean onPreferenceClick(Preference preference)
{ {
onChooseAutoExpandFolder(); onChooseAutoExpandFolder();
return false; return false;
} }
} });
);
mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR); mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR);
mChipColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
mChipColor.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener()
{ {
public boolean onPreferenceClick(Preference preference) public boolean onPreferenceClick(Preference preference)
{ {
onChooseChipColor(); onChooseChipColor();
return false; return false;
} }
} });
);
mLedColor = (Preference)findPreference(PREFERENCE_LED_COLOR); mLedColor = (Preference)findPreference(PREFERENCE_LED_COLOR);
mLedColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
mLedColor.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener()
{ {
public boolean onPreferenceClick(Preference preference) public boolean onPreferenceClick(Preference preference)
{ {
onChooseLedColor(); onChooseLedColor();
return false; return false;
} }
} });
);
findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener( findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() new Preference.OnPreferenceClickListener()
@ -625,9 +589,6 @@ public class AccountSettings extends K9PreferenceActivity
} }
}); });
mCryptoApp = (ListPreference) findPreference(PREFERENCE_CRYPTO_APP); mCryptoApp = (ListPreference) findPreference(PREFERENCE_CRYPTO_APP);
CharSequence cryptoAppEntries[] = mCryptoApp.getEntries(); CharSequence cryptoAppEntries[] = mCryptoApp.getEntries();
if (!new Apg().isAvailable(this)) if (!new Apg().isAvailable(this))
@ -680,7 +641,6 @@ public class AccountSettings extends K9PreferenceActivity
public void onResume() public void onResume()
{ {
super.onResume(); super.onResume();
//mAccount.refresh(Preferences.getPreferences(this));
} }
private void saveSettings() private void saveSettings()
@ -753,6 +713,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setEnableMoveButtons(mAccountEnableMoveButtons.isChecked()); mAccount.setEnableMoveButtons(mAccountEnableMoveButtons.isChecked());
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString())); mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString()));
mAccount.save(Preferences.getPreferences(this)); mAccount.save(Preferences.getPreferences(this));
if (needsRefresh && needsPushRestart) if (needsRefresh && needsPushRestart)
{ {
MailService.actionReset(this, null); MailService.actionReset(this, null);
@ -849,12 +810,10 @@ public class AccountSettings extends K9PreferenceActivity
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_FOLDER_NONE, "yes"); selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_FOLDER_NONE, "yes");
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes"); selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes");
startActivityForResult(selectIntent, SELECT_AUTO_EXPAND_FOLDER); startActivityForResult(selectIntent, SELECT_AUTO_EXPAND_FOLDER);
} }
private String translateFolder(String in) private String translateFolder(String in)
{ {
if (K9.INBOX.equalsIgnoreCase(in)) if (K9.INBOX.equalsIgnoreCase(in))
{ {
return getString(R.string.special_mailbox_name_inbox); return getString(R.string.special_mailbox_name_inbox);
@ -867,7 +826,6 @@ public class AccountSettings extends K9PreferenceActivity
private String reverseTranslateFolder(String in) private String reverseTranslateFolder(String in)
{ {
if (getString(R.string.special_mailbox_name_inbox).equals(in)) if (getString(R.string.special_mailbox_name_inbox).equals(in))
{ {
return K9.INBOX; return K9.INBOX;