1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Create implicit sort remembering setting

This commit is contained in:
Srinath Warrier 2012-03-12 22:04:10 +05:30
parent ff6e1f6c85
commit 3ebd3c1fc2
5 changed files with 8 additions and 62 deletions

View File

@ -149,24 +149,6 @@
<item>NOT_SECOND_CLASS</item>
</string-array>
<string-array name="account_settings_sort_type_entries">
<item>@string/sort_by_date</item>
<item>@string/sort_by_subject</item>
<item>@string/sort_by_sender</item>
<item>@string/sort_by_unread</item>
<item>@string/sort_by_flag</item>
<item>@string/sort_by_attach</item>
</string-array>
<string-array name="account_settings_sort_type_values">
<item>SORT_DATE</item>
<item>SORT_SUBJECT</item>
<item>SORT_SENDER</item>
<item>SORT_UNREAD</item>
<item>SORT_FLAGGED</item>
<item>SORT_ATTACHMENT</item>
</string-array>
<string-array name="account_settings_show_pictures_entries">
<item>@string/account_settings_show_pictures_never</item>
<item>@string/account_settings_show_pictures_only_from_contacts</item>

View File

@ -553,10 +553,6 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_enable_move_buttons_label">Enable refile buttons</string>
<string name="account_settings_enable_move_buttons_summary">Show the Archive, Move, and Spam buttons.</string>
<string name="account_settings_sort_type_label">Default Sort Type</string>
<string name="account_settings_sort_ascending_label">Sort order</string>
<string name="account_settings_sort_ascending_summary">Sort in ascending order</string>
<string name="account_settings_show_pictures_label">Always show images</string>
<string name="account_settings_show_pictures_never">No</string>
<string name="account_settings_show_pictures_only_from_contacts">From contacts</string>

View File

@ -56,21 +56,6 @@
android:title="@string/account_settings_color_label"
android:summary="@string/account_settings_color_summary" />
<ListPreference
android:persistent="false"
android:key="sort_type_enum"
android:title="@string/account_settings_sort_type_label"
android:entries="@array/account_settings_sort_type_entries"
android:entryValues="@array/account_settings_sort_type_values"
android:dialogTitle="@string/account_settings_sort_type_label" />
<CheckBoxPreference
android:persistent="false"
android:key="sort_ascending"
android:title="@string/account_settings_sort_ascending_label"
android:defaultValue="false"
android:summary="@string/account_settings_sort_ascending_summary" />
</PreferenceCategory>
<PreferenceCategory

View File

@ -1183,13 +1183,20 @@ public class MessageList
private void changeSort(SORT_TYPE newSortType) {
if (sortType == newSortType) {
mAccount.setSortAscending( !(mController.isSortAscending(newSortType) ));
mAccount.save(Preferences.getPreferences(this));
onToggleSortAscending();
} else {
sortType = newSortType;
mController.setSortType(sortType);
sortAscending = mController.isSortAscending(sortType);
sortDateAscending = mController.isSortAscending(SORT_TYPE.SORT_DATE);
reSort();
mAccount.setSortType(sortType);
mAccount.setSortAscending(sortAscending);
mAccount.save(Preferences.getPreferences(this));
reSort();
}
}

View File

@ -28,7 +28,6 @@ import com.fsck.k9.activity.ChooseIdentity;
import com.fsck.k9.activity.ColorPickerDialog;
import com.fsck.k9.activity.K9PreferenceActivity;
import com.fsck.k9.activity.ManageIdentities;
import com.fsck.k9.controller.MessagingController.SORT_TYPE;
import com.fsck.k9.crypto.Apg;
import com.fsck.k9.mail.Store;
import com.fsck.k9.service.MailService;
@ -54,8 +53,6 @@ public class AccountSettings extends K9PreferenceActivity {
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
private static final String PREFERENCE_DEFAULT = "account_default";
private static final String PREFERENCE_SORT_TYPE = "sort_type_enum";
private static final String PREFERENCE_SORT_ASCENDING = "sort_ascending";
private static final String PREFERENCE_SHOW_PICTURES = "show_pictures_enum";
private static final String PREFERENCE_ENABLE_MOVE_BUTTONS = "enable_move_buttons";
private static final String PREFERENCE_NOTIFY = "account_notify";
@ -124,8 +121,6 @@ public class AccountSettings extends K9PreferenceActivity {
private CheckBoxPreference mAccountDefault;
private CheckBoxPreference mAccountNotify;
private CheckBoxPreference mAccountNotifySelf;
private ListPreference mAccountSortType;
private CheckBoxPreference mAccountSortAscending;
private ListPreference mAccountShowPictures;
private CheckBoxPreference mAccountEnableMoveButtons;
private CheckBoxPreference mAccountNotifySync;
@ -432,22 +427,6 @@ public class AccountSettings extends K9PreferenceActivity {
mAccountEnableMoveButtons.setEnabled(mIsMoveCapable);
mAccountEnableMoveButtons.setChecked(mAccount.getEnableMoveButtons());
mAccountSortType = (ListPreference) findPreference(PREFERENCE_SORT_TYPE);
mAccountSortType.setValue("" + mAccount.getSortType());
mAccountSortType.setSummary(mAccountSortType.getEntry());
mAccountSortType.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mAccountSortType.findIndexOfValue(summary);
mAccountSortType.setSummary(mAccountSortType.getEntries()[index]);
mAccountSortType.setValue(summary);
return false;
}
});
mAccountSortAscending = (CheckBoxPreference) findPreference(PREFERENCE_SORT_ASCENDING);
mAccountSortAscending.setChecked(mAccount.isSortAscending());
mAccountShowPictures = (ListPreference) findPreference(PREFERENCE_SHOW_PICTURES);
mAccountShowPictures.setValue("" + mAccount.getShowPictures());
mAccountShowPictures.setSummary(mAccountShowPictures.getEntry());
@ -771,9 +750,6 @@ public class AccountSettings extends K9PreferenceActivity {
}
}
mAccount.setSortType(SORT_TYPE.valueOf(mAccountSortType.getValue()));
mAccount.setSortAscending(mAccountSortAscending.isChecked());
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue()));
if (mIsPushCapable) {