Added folder quick actions

This commit is contained in:
M66B 2019-09-06 15:35:18 +02:00
parent e64fa77fd5
commit bcc2619960
5 changed files with 71 additions and 17 deletions

2
FAQ.md
View File

@ -2166,6 +2166,8 @@ Reformatting and displaying such messages will take too long. You can try to use
The current experimental features are:
* Small, dimmed unread / read icon at the bottom of the messages to quicly toggle filtering of read messages
* Small, dimmed starred / unstarred icon at the bottom of the messages to quicly toggle filtering of starred messages
* Small, dimmed infinite / timelapse icon at the bottom of the messages to quicly toggle filtering of snoozed messages
<br />

View File

@ -166,6 +166,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private SeekBar seekBar;
private ImageButton ibDown;
private ImageButton ibUp;
private ImageButton ibSeen;
private ImageButton ibUnflagged;
private ImageButton ibSnoozed;
private BottomNavigationView bottom_navigation;
private ContentLoadingProgressBar pbWait;
@ -359,6 +361,8 @@ 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);
ibSeen = view.findViewById(R.id.ibSeen);
ibUnflagged = view.findViewById(R.id.ibUnflagged);
ibSnoozed = view.findViewById(R.id.ibSnoozed);
bottom_navigation = view.findViewById(R.id.bottom_navigation);
@ -611,6 +615,22 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
ibSeen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean filter = prefs.getBoolean("filter_seen", true);
onMenuFilterSeen(!filter);
}
});
ibUnflagged.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean filter = prefs.getBoolean("filter_unflagged", true);
onMenuFilterUnflagged(!filter);
}
});
ibSnoozed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -865,6 +885,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
seekBar.setVisibility(View.GONE);
ibDown.setVisibility(View.GONE);
ibUp.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE);
ibUnflagged.setVisibility(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);
@ -2507,10 +2529,15 @@ 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);
ibSeen.setImageResource(filter_seen ? R.drawable.baseline_drafts_24 : R.drawable.baseline_mail_24);
ibUnflagged.setImageResource(filter_unflagged ? R.drawable.baseline_star_border_24 : R.drawable.baseline_star_24);
ibSnoozed.setImageResource(filter_snoozed ? R.drawable.baseline_timelapse_24: R.drawable.baseline_timer_off_24);
boolean folder = (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
ibSeen.setVisibility(experiments && folder ? View.VISIBLE : View.GONE);
ibUnflagged.setVisibility(experiments && folder ? View.VISIBLE : View.GONE);
ibSnoozed.setVisibility(experiments && folder ? View.VISIBLE : View.GONE);
super.onPrepareOptionsMenu(menu);
}
@ -2563,7 +2590,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return true;
case R.id.menu_filter_seen:
onMenuFilterRead(!item.isChecked());
onMenuFilterSeen(!item.isChecked());
return true;
case R.id.menu_filter_unflagged:
@ -2633,7 +2660,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
loadMessages(true);
}
private void onMenuFilterRead(boolean filter) {
private void onMenuFilterSeen(boolean filter) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("filter_seen", filter).apply();
getActivity().invalidateOptionsMenu();

View File

@ -1,10 +0,0 @@
<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>

View File

@ -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="M19.04,4.55l-1.42,1.42C16.07,4.74 14.12,4 12,4c-1.83,0 -3.53,0.55 -4.95,1.48l1.46,1.46C9.53,6.35 10.73,6 12,6c3.87,0 7,3.13 7,7 0,1.27 -0.35,2.47 -0.94,3.49l1.45,1.45C20.45,16.53 21,14.83 21,13c0,-2.12 -0.74,-4.07 -1.97,-5.61l1.42,-1.42 -1.41,-1.42zM15,1L9,1v2h6L15,1zM11,9.44l2,2L13,8h-2v1.44zM3.02,4L1.75,5.27 4.5,8.03C3.55,9.45 3,11.16 3,13c0,4.97 4.02,9 9,9 1.84,0 3.55,-0.55 4.98,-1.5l2.5,2.5 1.27,-1.27 -7.71,-7.71L3.02,4zM12,20c-3.87,0 -7,-3.13 -7,-7 0,-1.28 0.35,-2.48 0.95,-3.52l9.56,9.56c-1.03,0.61 -2.23,0.96 -3.51,0.96z"/>
</vector>

View File

@ -217,6 +217,31 @@
app:layout_constraintStart_toEndOf="@+id/ibDown"
app:srcCompat="@drawable/baseline_vertical_align_top_24" />
<ImageButton
android:id="@+id/ibSeen"
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_toStartOf="@id/ibUnflagged"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/baseline_drafts_24" />
<ImageButton
android:id="@+id/ibUnflagged"
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="@+id/ibSnoozed"
app:layout_constraintStart_toEndOf="@id/ibSeen"
app:srcCompat="@drawable/baseline_star_24" />
<ImageButton
android:id="@+id/ibSnoozed"
android:layout_width="wrap_content"
@ -226,7 +251,7 @@
android:tint="?attr/colorSeparator"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@id/ibUnflagged"
app:srcCompat="@drawable/baseline_timelapse_24" />
<SeekBar