Quickly display/hide snoozed messages

This commit is contained in:
M66B 2019-08-23 15:59:50 +02:00
parent 28b091e975
commit 2145e7b54f
2 changed files with 26 additions and 0 deletions

View File

@ -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);

View File

@ -217,6 +217,18 @@
app:layout_constraintStart_toEndOf="@+id/ibDown"
app:srcCompat="@drawable/baseline_vertical_align_top_24" />
<ImageButton
android:id="@+id/ibSnoozed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="12dp"
android:tint="?attr/colorSeparator"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/baseline_timelapse_24" />
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"