From 2145e7b54f36f819b9e38faf155e8d5ba5de1f61 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 23 Aug 2019 15:59:50 +0200 Subject: [PATCH] Quickly display/hide snoozed messages --- .../java/eu/faircode/email/FragmentMessages.java | 14 ++++++++++++++ app/src/main/res/layout/fragment_messages.xml | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 6f30c279b0..b7da68b195 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -166,6 +166,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. private SeekBar seekBar; private ImageButton ibDown; private ImageButton ibUp; + private ImageButton ibSnoozed; private BottomNavigationView bottom_navigation; private ContentLoadingProgressBar pbWait; private Group grpSupport; @@ -357,6 +358,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. seekBar = view.findViewById(R.id.seekBar); ibDown = view.findViewById(R.id.ibDown); ibUp = view.findViewById(R.id.ibUp); + ibSnoozed = view.findViewById(R.id.ibSnoozed); bottom_navigation = view.findViewById(R.id.bottom_navigation); pbWait = view.findViewById(R.id.pbWait); @@ -607,6 +609,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. } }); + ibSnoozed.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + boolean filter = prefs.getBoolean("filter_snoozed", true); + onMenuFilterSnoozed(!filter); + } + }); + bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { @@ -854,6 +864,10 @@ 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); bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false); bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false); bottom_navigation.setVisibility(actionbar ? View.INVISIBLE : View.GONE); diff --git a/app/src/main/res/layout/fragment_messages.xml b/app/src/main/res/layout/fragment_messages.xml index dfaab47585..47ef3c0cd3 100644 --- a/app/src/main/res/layout/fragment_messages.xml +++ b/app/src/main/res/layout/fragment_messages.xml @@ -217,6 +217,18 @@ app:layout_constraintStart_toEndOf="@+id/ibDown" app:srcCompat="@drawable/baseline_vertical_align_top_24" /> + +