Added quick action hide

pull/207/head
M66B 2 years ago
parent 874c1481cd
commit ecb5b62b4d

@ -293,6 +293,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private CardView cardMore;
private ImageButton ibBatchSeen;
private ImageButton ibBatchSnooze;
private ImageButton ibBatchHide;
private ImageButton ibBatchFlag;
private ImageButton ibLowImportance;
private ImageButton ibHighImportance;
@ -569,6 +570,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
cardMore = view.findViewById(R.id.cardMore);
ibBatchSeen = view.findViewById(R.id.ibBatchSeen);
ibBatchSnooze = view.findViewById(R.id.ibBatchSnooze);
ibBatchHide = view.findViewById(R.id.ibBatchHide);
ibBatchFlag = view.findViewById(R.id.ibBatchFlag);
ibLowImportance = view.findViewById(R.id.ibLowImportance);
ibHighImportance = view.findViewById(R.id.ibHighImportance);
@ -1317,6 +1319,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
ibBatchHide.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onHideSelection(true);
}
});
ibBatchFlag.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -5801,15 +5810,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
protected void onExecuted(Bundle args, MoreResult result) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean more_trash = prefs.getBoolean("more_trash", true);
boolean more_junk = prefs.getBoolean("more_junk", true);
boolean more_archive = prefs.getBoolean("more_archive", true);
boolean more_inbox = prefs.getBoolean("more_inbox", true);
boolean more_snooze = prefs.getBoolean("more_snooze", true);
boolean more_flag = prefs.getBoolean("more_flag", true);
boolean more_seen = prefs.getBoolean("more_seen", true);
boolean more_importance_high = prefs.getBoolean("more_importance_high", true);
boolean more_importance_low = prefs.getBoolean("more_importance_low", true);
boolean more_snooze = prefs.getBoolean("more_snooze", false);
boolean more_hide = prefs.getBoolean("more_hide", false);
boolean more_flag = prefs.getBoolean("more_flag", false);
boolean more_importance_high = prefs.getBoolean("more_importance_high", false);
boolean more_importance_low = prefs.getBoolean("more_importance_low", false);
boolean more_inbox = prefs.getBoolean("more_inbox", true);
boolean more_archive = prefs.getBoolean("more_archive", true);
boolean more_junk = prefs.getBoolean("more_junk", true);
boolean more_trash = prefs.getBoolean("more_trash", true);
int count = 0;
@ -5843,6 +5853,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (flag)
count++;
boolean hide = (more_hide && count < MAX_QUICK_ACTIONS && result.visible);
if (hide)
count++;
boolean snooze = (more_snooze && count < MAX_QUICK_ACTIONS);
if (snooze)
count++;
@ -5853,6 +5867,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ibBatchSeen.setVisibility(seen ? View.VISIBLE : View.GONE);
ibBatchSnooze.setVisibility(snooze ? View.VISIBLE : View.GONE);
ibBatchHide.setVisibility(hide ? View.VISIBLE : View.GONE);
ibBatchFlag.setVisibility(flag ? View.VISIBLE : View.GONE);
ibLowImportance.setVisibility(importance_low ? View.VISIBLE : View.GONE);
ibHighImportance.setVisibility(importance_high ? View.VISIBLE : View.GONE);
@ -10195,6 +10210,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
final TextView tvHint = dview.findViewById(R.id.tvHint);
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
final CheckBox cbSnooze = dview.findViewById(R.id.cbSnooze);
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
final CheckBox cbFlag = dview.findViewById(R.id.cbFlag);
final CheckBox cbImportanceLow = dview.findViewById(R.id.cbImportanceLow);
final CheckBox cbImportanceHigh = dview.findViewById(R.id.cbImportanceHigh);
@ -10204,15 +10220,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
final CheckBox cbTrash = dview.findViewById(R.id.cbTrash);
tvHint.setText(getString(R.string.title_quick_actions_hint, MAX_QUICK_ACTIONS));
cbSeen.setChecked(prefs.getBoolean("more_seen", false));
cbSnooze.setChecked(prefs.getBoolean("more_snooze", true));
cbSeen.setChecked(prefs.getBoolean("more_seen", true));
cbSnooze.setChecked(prefs.getBoolean("more_snooze", false));
cbHide.setChecked(prefs.getBoolean("more_hide", false));
cbFlag.setChecked(prefs.getBoolean("more_flag", false));
cbImportanceLow.setChecked(prefs.getBoolean("more_importance_low", false));
cbImportanceHigh.setChecked(prefs.getBoolean("more_importance_high", false));
cbInbox.setChecked(prefs.getBoolean("more_inbox", true));
cbArchive.setChecked(prefs.getBoolean("more_archive", true));
cbJunk.setChecked(prefs.getBoolean("more_junk", true));
cbTrash.setChecked(prefs.getBoolean("more_trash", false));
cbTrash.setChecked(prefs.getBoolean("more_trash", true));
return new AlertDialog.Builder(getContext())
.setView(dview)
@ -10222,6 +10239,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("more_seen", cbSeen.isChecked());
editor.putBoolean("more_snooze", cbSnooze.isChecked());
editor.putBoolean("more_hide", cbHide.isChecked());
editor.putBoolean("more_flag", cbFlag.isChecked());
editor.putBoolean("more_importance_low", cbImportanceLow.isChecked());
editor.putBoolean("more_importance_high", cbImportanceHigh.isChecked());

@ -57,6 +57,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSeen" />
<CheckBox
android:id="@+id/cbHide"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_visibility_off_24"
android:drawablePadding="6dp"
android:text="@string/title_hide"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSnooze" />
<CheckBox
android:id="@+id/cbFlag"
android:layout_width="0dp"
@ -68,7 +81,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSnooze" />
app:layout_constraintTop_toBottomOf="@id/cbHide" />
<CheckBox
android:id="@+id/cbImportanceLow"

@ -526,7 +526,6 @@
android:scaleType="fitCenter"
android:tint="@color/action_foreground"
android:tooltipText="@string/title_toggle_seen"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_drafts_24" />
@ -546,6 +545,21 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_timelapse_24" />
<eu.faircode.email.FixedImageButton
android:id="@+id/ibBatchHide"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_hide"
android:padding="6dp"
android:scaleType="fitCenter"
android:tint="@color/action_foreground"
android:tooltipText="@string/title_hide"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/ibBatchSnooze"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_visibility_off_24" />
<eu.faircode.email.FixedImageButton
android:id="@+id/ibBatchFlag"
android:layout_width="48dp"
@ -557,7 +571,7 @@
android:tint="@color/action_foreground"
android:tooltipText="@string/title_flag"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/ibBatchSnooze"
app:layout_constraintEnd_toStartOf="@+id/ibBatchHide"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_star_24" />
@ -569,9 +583,9 @@
android:contentDescription="@string/title_importance_low"
android:padding="6dp"
android:scaleType="fitCenter"
android:visibility="gone"
android:tint="@color/action_foreground"
android:tooltipText="@string/title_importance_low"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@id/ibBatchFlag"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/baseline_arrow_downward_24" />

Loading…
Cancel
Save