Improved main filter snoozed toggle

pull/162/head
M66B 5 years ago
parent cbc10b4887
commit 4cf5bce2c4

@ -856,7 +856,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
addBackPressedListener(onBackPressedListener);
// Initialize
if (cards && !Helper.isDarkTheme(getContext()))
view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.lightColorBackground_cards));
@ -864,10 +863,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
seekBar.setVisibility(View.GONE);
ibDown.setVisibility(View.GONE);
ibUp.setVisibility(View.GONE);
ibSnoozed.setVisibility(
BuildConfig.DEBUG &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
? View.VISIBLE : View.GONE);
ibSnoozed.setVisibility(View.GONE);
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false);
bottom_navigation.setVisibility(actionbar && viewType == AdapterMessage.ViewType.THREAD ? View.INVISIBLE : View.GONE);
@ -2438,6 +2434,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onPrepareOptionsMenu(Menu menu) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String sort = prefs.getString("sort", "time");
boolean filter_seen = prefs.getBoolean("filter_seen", false);
boolean filter_unflagged = prefs.getBoolean("filter_unflagged", false);
boolean filter_snoozed = prefs.getBoolean("filter_snoozed", true);
boolean filter_duplicates = prefs.getBoolean("filter_duplicates", false);
boolean compact = prefs.getBoolean("compact", false);
boolean experiments = prefs.getBoolean("experiments", false);
menu.findItem(R.id.menu_search).setVisible(
viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
@ -2450,7 +2453,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_sort_on).setVisible(
viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
String sort = prefs.getString("sort", "time");
if ("time".equals(sort))
menu.findItem(R.id.menu_sort_on_time).setChecked(true);
else if ("unread".equals(sort))
@ -2471,12 +2473,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_filter_unflagged).setVisible(viewType != AdapterMessage.ViewType.THREAD);
menu.findItem(R.id.menu_filter_snoozed).setVisible(viewType != AdapterMessage.ViewType.THREAD);
menu.findItem(R.id.menu_filter_duplicates).setVisible(viewType == AdapterMessage.ViewType.THREAD);
menu.findItem(R.id.menu_filter_seen).setChecked(prefs.getBoolean("filter_seen", false));
menu.findItem(R.id.menu_filter_unflagged).setChecked(prefs.getBoolean("filter_unflagged", false));
menu.findItem(R.id.menu_filter_snoozed).setChecked(prefs.getBoolean("filter_snoozed", true));
menu.findItem(R.id.menu_filter_duplicates).setChecked(prefs.getBoolean("filter_duplicates", false));
menu.findItem(R.id.menu_filter_seen).setChecked(filter_seen);
menu.findItem(R.id.menu_filter_unflagged).setChecked(filter_unflagged);
menu.findItem(R.id.menu_filter_snoozed).setChecked(filter_snoozed);
menu.findItem(R.id.menu_filter_duplicates).setChecked(filter_duplicates);
menu.findItem(R.id.menu_compact).setChecked(prefs.getBoolean("compact", false));
menu.findItem(R.id.menu_compact).setChecked(compact);
menu.findItem(R.id.menu_select_all).setVisible(!outbox &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER));
@ -2484,6 +2486,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_force_sync).setVisible(viewType == AdapterMessage.ViewType.UNIFIED);
ibSnoozed.setImageResource(filter_snoozed ? R.drawable.baseline_all_inclusive_24 : R.drawable.baseline_timelapse_24);
ibSnoozed.setVisibility(experiments &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)
? View.VISIBLE : View.GONE);
super.onPrepareOptionsMenu(menu);
}

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M18.6,6.62c-1.44,0 -2.8,0.56 -3.77,1.53L12,10.66 10.48,12h0.01L7.8,14.39c-0.64,0.64 -1.49,0.99 -2.4,0.99 -1.87,0 -3.39,-1.51 -3.39,-3.38S3.53,8.62 5.4,8.62c0.91,0 1.76,0.35 2.44,1.03l1.13,1 1.51,-1.34L9.22,8.2C8.2,7.18 6.84,6.62 5.4,6.62 2.42,6.62 0,9.04 0,12s2.42,5.38 5.4,5.38c1.44,0 2.8,-0.56 3.77,-1.53l2.83,-2.5 0.01,0.01L13.52,12h-0.01l2.69,-2.39c0.64,-0.64 1.49,-0.99 2.4,-0.99 1.87,0 3.39,1.51 3.39,3.38s-1.52,3.38 -3.39,3.38c-0.9,0 -1.76,-0.35 -2.44,-1.03l-1.14,-1.01 -1.51,1.34 1.27,1.12c1.02,1.01 2.37,1.57 3.82,1.57 2.98,0 5.4,-2.41 5.4,-5.38s-2.42,-5.37 -5.4,-5.37z"/>
</vector>
Loading…
Cancel
Save