move 3 IMAP preferences out of the "wizard" flow to an advanced page

where they belong
This commit is contained in:
Jesse Vincent 2010-10-11 00:08:47 +00:00
parent 28388b235e
commit a683186f6e
5 changed files with 87 additions and 90 deletions

View File

@ -245,51 +245,6 @@
android:contentDescription="@string/account_setup_incoming_compression_label"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/push_poll_on_connect_section"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="@string/push_poll_on_connect_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary" />
<CheckBox
android:id="@+id/push_poll_on_connect"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:label="foo"
/>
</LinearLayout>
<TextView
android:id="@+id/idle_refresh_period_label"
android:text="@string/idle_refresh_period_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/idle_refresh_period"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:contentDescription="@string/idle_refresh_period_label"
/>
<TextView
android:id="@+id/account_setup_push_limit_label"
android:text="@string/account_setup_push_limit_label"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/folder_push_limit"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:contentDescription="@string/account_setup_push_limit_label"
/>
<View
android:layout_width="fill_parent"
android:layout_height="0dip"

View File

@ -501,6 +501,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_setup_failed_dlg_edit_details_action">Edit details</string>
<string name="account_setup_failed_dlg_continue_action">Continue</string>
<string name="account_settings_push_advanced_title">Advanced</string>
<string name="account_settings_title_fmt">General settings</string>
<string name="account_settings_default">Default account</string>
<string name="account_settings_default_label">Default account</string>

View File

@ -82,7 +82,7 @@
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="@string/account_settings_sync" android:key="incoming">
<PreferenceScreen android:title="@string/account_settings_sync" android:key="incoming_prefs">
<ListPreference
@ -154,6 +154,26 @@
android:key="incoming"
android:title="@string/account_settings_incoming_label"
android:summary="@string/account_settings_incoming_summary" />
<PreferenceScreen
android:key="push_advanced"
android:title="@string/account_settings_push_advanced_title">
<CheckBoxPreference
android:key="push_poll_on_connect"
android:title="@string/push_poll_on_connect_label"
/>
<ListPreference
android:key="max_push_folders"
android:title="@string/account_setup_push_limit_label"
android:entries="@array/account_settings_push_limit_entries"
android:entryValues="@array/account_settings_push_limit_values"
/>
<ListPreference
android:key="idle_refresh_period"
android:title="@string/idle_refresh_period_label"
android:entries="@array/idle_refresh_period_entries"
android:entryValues="@array/idle_refresh_period_values"
/>
</PreferenceScreen>
</PreferenceScreen>

View File

@ -61,6 +61,9 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_DISPLAY_MODE = "folder_display_mode";
private static final String PREFERENCE_SYNC_MODE = "folder_sync_mode";
private static final String PREFERENCE_PUSH_MODE = "folder_push_mode";
private static final String PREFERENCE_PUSH_POLL_ON_CONNECT = "push_poll_on_connect";
private static final String PREFERENCE_MAX_PUSH_FOLDERS = "max_push_folders";
private static final String PREFERENCE_IDLE_REFRESH_PERIOD = "idle_refresh_period";
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
private static final String PREFERENCE_DELETE_POLICY = "delete_policy";
private static final String PREFERENCE_EXPUNGE_POLICY = "expunge_policy";
@ -114,6 +117,12 @@ public class AccountSettings extends K9PreferenceActivity
private CheckBoxPreference mReplyAfterQuote;
private CheckBoxPreference mSyncRemoteDeletions;
private CheckBoxPreference mSaveAllHeaders;
private CheckBoxPreference mPushPollOnConnect;
private ListPreference mIdleRefreshPeriod;
private ListPreference mMaxPushFolders;
private ListPreference mCryptoApp;
private CheckBoxPreference mCryptoAutoSignature;
@ -416,6 +425,58 @@ public class AccountSettings extends K9PreferenceActivity
}
});
// IMAP-specific preferences
mPushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
mIdleRefreshPeriod = (ListPreference) findPreference(PREFERENCE_IDLE_REFRESH_PERIOD);
mMaxPushFolders = (ListPreference) findPreference(PREFERENCE_MAX_PUSH_FOLDERS);
if (isPushCapable)
{
mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes()));
mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry());
mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
{
public boolean onPreferenceChange(Preference preference, Object newValue)
{
final String summary = newValue.toString();
int index = mIdleRefreshPeriod.findIndexOfValue(summary);
mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntries()[index]);
mIdleRefreshPeriod.setValue(summary);
return false;
}
});
mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders()));
mMaxPushFolders.setSummary(mMaxPushFolders.getEntry());
mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
{
public boolean onPreferenceChange(Preference preference, Object newValue)
{
final String summary = newValue.toString();
int index = mMaxPushFolders.findIndexOfValue(summary);
mMaxPushFolders.setSummary(mMaxPushFolders.getEntries()[index]);
mMaxPushFolders.setValue(summary);
return false;
}
});
}
else
{
mPushPollOnConnect.setEnabled(false);
mMaxPushFolders.setEnabled(false);
mIdleRefreshPeriod.setEnabled(false);
}
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
@ -645,6 +706,10 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setCryptoApp(mCryptoApp.getValue());
mAccount.setCryptoAutoSignature(mCryptoAutoSignature.isChecked());
mAccount.setPushPollOnConnect(mPushPollOnConnect.isChecked());
mAccount.setIdleRefreshMinutes(Integer.parseInt(mIdleRefreshPeriod.getValue()));
mAccount.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));

View File

@ -88,9 +88,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
private CheckBox compressionMobile;
private CheckBox compressionWifi;
private CheckBox compressionOther;
private CheckBox pushPollOnConnect;
private Spinner idleRefreshPeriod;
private Spinner folderPushLimit;
private CheckBox subscribedFoldersOnly;
public static void actionIncomingSettings(Activity context, Account account, boolean makeDefault)
@ -136,12 +133,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
compressionMobile = (CheckBox)findViewById(R.id.compression_mobile);
compressionWifi = (CheckBox)findViewById(R.id.compression_wifi);
compressionOther = (CheckBox)findViewById(R.id.compression_other);
pushPollOnConnect = (CheckBox)findViewById(R.id.push_poll_on_connect);
subscribedFoldersOnly = (CheckBox)findViewById(R.id.subscribed_folders_only);
idleRefreshPeriod = (Spinner)findViewById(R.id.idle_refresh_period);
folderPushLimit = (Spinner)findViewById(R.id.folder_push_limit);
mImapFolderDrafts.setOnClickListener(this);
mImapFolderSent.setOnClickListener(this);
@ -310,11 +302,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.account_auth_type).setVisibility(View.GONE);
findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE);
findViewById(R.id.push_poll_on_connect_section).setVisibility(View.GONE);
findViewById(R.id.idle_refresh_period_label).setVisibility(View.GONE);
findViewById(R.id.idle_refresh_period).setVisibility(View.GONE);
findViewById(R.id.account_setup_push_limit_label).setVisibility(View.GONE);
findViewById(R.id.folder_push_limit).setVisibility(View.GONE);
mAccount.setDeletePolicy(Account.DELETE_POLICY_NEVER);
@ -351,11 +338,6 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
findViewById(R.id.account_auth_type).setVisibility(View.GONE);
findViewById(R.id.compression_section).setVisibility(View.GONE);
findViewById(R.id.compression_label).setVisibility(View.GONE);
findViewById(R.id.push_poll_on_connect_section).setVisibility(View.GONE);
findViewById(R.id.idle_refresh_period_label).setVisibility(View.GONE);
findViewById(R.id.idle_refresh_period).setVisibility(View.GONE);
findViewById(R.id.account_setup_push_limit_label).setVisibility(View.GONE);
findViewById(R.id.folder_push_limit).setVisibility(View.GONE);
subscribedFoldersOnly.setVisibility(View.GONE);
if (uri.getPath() != null && uri.getPath().length() > 0)
{
@ -421,13 +403,8 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
updatePortFromSecurityType();
}
pushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
subscribedFoldersOnly.setChecked(mAccount.subscribedFoldersOnly());
SpinnerHelper.initSpinner(this, idleRefreshPeriod, R.array.idle_refresh_period_entries,
R.array.idle_refresh_period_values, String.valueOf(mAccount.getIdleRefreshMinutes()));
SpinnerHelper.initSpinner(this, folderPushLimit, R.array.account_settings_push_limit_entries,
R.array.account_settings_push_limit_values, String.valueOf(mAccount.getMaxPushFolders()));
validateFields();
}
@ -585,28 +562,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
mAccount.setCompression(Account.TYPE_MOBILE, compressionMobile.isChecked());
mAccount.setCompression(Account.TYPE_WIFI, compressionWifi.isChecked());
mAccount.setCompression(Account.TYPE_OTHER, compressionOther.isChecked());
mAccount.setPushPollOnConnect(pushPollOnConnect.isChecked());
mAccount.setSubscribedFoldersOnly(subscribedFoldersOnly.isChecked());
String idleRefreshPeriodValue = SpinnerHelper.getSpinnerValue(idleRefreshPeriod);
try
{
mAccount.setIdleRefreshMinutes(Integer.parseInt(idleRefreshPeriodValue));
}
catch (Exception e)
{
Log.e(K9.LOG_TAG, "Unable to parse idle refresh period value '" + idleRefreshPeriodValue + "'", e);
mAccount.setIdleRefreshMinutes(24);
}
String maxPushFoldersValue = SpinnerHelper.getSpinnerValue(folderPushLimit);
try
{
mAccount.setMaxPushFolders(Integer.parseInt(maxPushFoldersValue));
}
catch (Exception e)
{
Log.e(K9.LOG_TAG, "Unable to parse max push folders value '" + maxPushFoldersValue + "'", e);
mAccount.setMaxPushFolders(10);
}
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, true, false);
}