mirror of https://github.com/M66B/FairEmail.git
Filter improvement/fix
This commit is contained in:
parent
8db7b8fdda
commit
bb1f911d8f
|
@ -611,7 +611,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean filter = prefs.getBoolean("filter_seen", true);
|
||||
onMenuFilterSeen(!filter);
|
||||
onMenuFilter("filter_seen", !filter);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -619,7 +619,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean filter = prefs.getBoolean("filter_unflagged", true);
|
||||
onMenuFilterUnflagged(!filter);
|
||||
onMenuFilter("filter_unflagged", !filter);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -627,7 +627,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean filter = prefs.getBoolean("filter_snoozed", true);
|
||||
onMenuFilterSnoozed(!filter);
|
||||
onMenuFilter("filter_snoozed", !filter);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2685,15 +2685,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
return true;
|
||||
|
||||
case R.id.menu_filter_seen:
|
||||
onMenuFilterSeen(!item.isChecked());
|
||||
onMenuFilter("filter_seen", !item.isChecked());
|
||||
return true;
|
||||
|
||||
case R.id.menu_filter_unflagged:
|
||||
onMenuFilterUnflagged(!item.isChecked());
|
||||
onMenuFilter("filter_unflagged", !item.isChecked());
|
||||
return true;
|
||||
|
||||
case R.id.menu_filter_snoozed:
|
||||
onMenuFilterSnoozed(!item.isChecked());
|
||||
onMenuFilter("filter_snoozed", !item.isChecked());
|
||||
return true;
|
||||
|
||||
case R.id.menu_filter_duplicates:
|
||||
|
@ -2760,27 +2760,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
loadMessages(true);
|
||||
}
|
||||
|
||||
private void onMenuFilterSeen(boolean filter) {
|
||||
private void onMenuFilter(String name, boolean filter) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putBoolean("filter_seen", filter).apply();
|
||||
getActivity().invalidateOptionsMenu();
|
||||
if (selectionTracker != null)
|
||||
selectionTracker.clearSelection();
|
||||
loadMessages(true);
|
||||
}
|
||||
|
||||
private void onMenuFilterUnflagged(boolean filter) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putBoolean("filter_unflagged", filter).apply();
|
||||
getActivity().invalidateOptionsMenu();
|
||||
if (selectionTracker != null)
|
||||
selectionTracker.clearSelection();
|
||||
loadMessages(true);
|
||||
}
|
||||
|
||||
private void onMenuFilterSnoozed(boolean filter) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putBoolean("filter_snoozed", filter).apply();
|
||||
prefs.edit().putBoolean(name, filter).apply();
|
||||
getActivity().invalidateOptionsMenu();
|
||||
if (selectionTracker != null)
|
||||
selectionTracker.clearSelection();
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
android:title="@string/title_filter"
|
||||
app:showAsAction="ifRoom">
|
||||
<menu>
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/menu_filter_seen"
|
||||
android:checkable="true"
|
||||
|
@ -77,7 +76,6 @@
|
|||
android:id="@+id/menu_filter_duplicates"
|
||||
android:checkable="true"
|
||||
android:title="@string/title_filter_duplicates" />
|
||||
</group>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
|
Loading…
Reference in New Issue