Added batch manage keywords button

pull/217/head
M66B 11 months ago
parent 88791994c1
commit ab8ae3761e

@ -63,6 +63,7 @@ public class FragmentDialogQuickActions extends FragmentDialogBase {
final CheckBox cbDelete = dview.findViewById(R.id.cbDelete); final CheckBox cbDelete = dview.findViewById(R.id.cbDelete);
final CheckBox cbJunk = dview.findViewById(R.id.cbJunk); final CheckBox cbJunk = dview.findViewById(R.id.cbJunk);
final CheckBox cbInbox = dview.findViewById(R.id.cbInbox); final CheckBox cbInbox = dview.findViewById(R.id.cbInbox);
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
final CheckBox cbClear = dview.findViewById(R.id.cbClear); final CheckBox cbClear = dview.findViewById(R.id.cbClear);
cbSummarize.setVisibility(AI.isAvailable(context) ? View.VISIBLE : View.GONE); cbSummarize.setVisibility(AI.isAvailable(context) ? View.VISIBLE : View.GONE);
@ -86,6 +87,7 @@ public class FragmentDialogQuickActions extends FragmentDialogBase {
cbDelete.setChecked(prefs.getBoolean("more_delete", false)); cbDelete.setChecked(prefs.getBoolean("more_delete", false));
cbJunk.setChecked(prefs.getBoolean("more_junk", true)); cbJunk.setChecked(prefs.getBoolean("more_junk", true));
cbInbox.setChecked(prefs.getBoolean("more_inbox", true)); cbInbox.setChecked(prefs.getBoolean("more_inbox", true));
cbKeywords.setChecked(prefs.getBoolean("more_keywords", false));
cbClear.setChecked(prefs.getBoolean("more_clear", true)); cbClear.setChecked(prefs.getBoolean("more_clear", true));
return new AlertDialog.Builder(getContext()) return new AlertDialog.Builder(getContext())
@ -111,6 +113,7 @@ public class FragmentDialogQuickActions extends FragmentDialogBase {
editor.putBoolean("more_delete", cbDelete.isChecked()); editor.putBoolean("more_delete", cbDelete.isChecked());
editor.putBoolean("more_junk", cbJunk.isChecked()); editor.putBoolean("more_junk", cbJunk.isChecked());
editor.putBoolean("more_inbox", cbInbox.isChecked()); editor.putBoolean("more_inbox", cbInbox.isChecked());
editor.putBoolean("more_keywords", cbKeywords.isChecked());
editor.putBoolean("more_clear", cbClear.isChecked()); editor.putBoolean("more_clear", cbClear.isChecked());
editor.apply(); editor.apply();
sendResult(Activity.RESULT_OK); sendResult(Activity.RESULT_OK);

@ -315,6 +315,7 @@ public class FragmentMessages extends FragmentBase
private ImageButton ibDelete; private ImageButton ibDelete;
private ImageButton ibJunk; private ImageButton ibJunk;
private ImageButton ibInbox; private ImageButton ibInbox;
private ImageButton ibKeywords;
private ImageButton ibMoreSettings; private ImageButton ibMoreSettings;
private FloatingActionButton fabSearch; private FloatingActionButton fabSearch;
private FloatingActionButton fabError; private FloatingActionButton fabError;
@ -666,6 +667,7 @@ public class FragmentMessages extends FragmentBase
ibDelete = view.findViewById(R.id.ibDelete); ibDelete = view.findViewById(R.id.ibDelete);
ibJunk = view.findViewById(R.id.ibJunk); ibJunk = view.findViewById(R.id.ibJunk);
ibInbox = view.findViewById(R.id.ibInbox); ibInbox = view.findViewById(R.id.ibInbox);
ibKeywords = view.findViewById(R.id.ibKeywords);
ibMoreSettings = view.findViewById(R.id.ibMoreSettings); ibMoreSettings = view.findViewById(R.id.ibMoreSettings);
fabSearch = view.findViewById(R.id.fabSearch); fabSearch = view.findViewById(R.id.fabSearch);
fabError = view.findViewById(R.id.fabError); fabError = view.findViewById(R.id.fabError);
@ -1831,6 +1833,14 @@ public class FragmentMessages extends FragmentBase
} }
}); });
ibKeywords.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean more_clear = prefs.getBoolean("more_clear", true);
onActionManageKeywords(more_clear);
}
});
ibMoreSettings.setOnClickListener(new View.OnClickListener() { ibMoreSettings.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -4686,7 +4696,7 @@ public class FragmentMessages extends FragmentBase
onActionMoveSelectionAccount(result.copyto.id, true, result.folders); onActionMoveSelectionAccount(result.copyto.id, true, result.folders);
return true; return true;
} else if (itemId == R.string.title_manage_keywords) { } else if (itemId == R.string.title_manage_keywords) {
onActionManageKeywords(); onActionManageKeywords(false);
return true; return true;
} else if (itemId == R.string.title_search_sender) { } else if (itemId == R.string.title_search_sender) {
long[] ids = getSelection(); long[] ids = getSelection();
@ -5188,7 +5198,7 @@ public class FragmentMessages extends FragmentBase
fragment.show(getParentFragmentManager(), "messages:move"); fragment.show(getParentFragmentManager(), "messages:move");
} }
private void onActionManageKeywords() { private void onActionManageKeywords(boolean clear) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLongArray("ids", getSelection()); args.putLongArray("ids", getSelection());
@ -5282,6 +5292,14 @@ public class FragmentMessages extends FragmentBase
fragment.show(getParentFragmentManager(), "keywords:add"); fragment.show(getParentFragmentManager(), "keywords:add");
} }
}) })
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (clear && selectionTracker != null)
selectionTracker.clearSelection();
}
})
.show(); .show();
} }
@ -7390,6 +7408,7 @@ public class FragmentMessages extends FragmentBase
boolean more_trash = prefs.getBoolean("more_trash", true); boolean more_trash = prefs.getBoolean("more_trash", true);
boolean more_delete = prefs.getBoolean("more_delete", false); boolean more_delete = prefs.getBoolean("more_delete", false);
boolean more_move = prefs.getBoolean("more_move", true); boolean more_move = prefs.getBoolean("more_move", true);
boolean more_keywords = prefs.getBoolean("more_keywords", false);
boolean inTrash = EntityFolder.TRASH.equals(type); boolean inTrash = EntityFolder.TRASH.equals(type);
boolean inJunk = EntityFolder.JUNK.equals(type); boolean inJunk = EntityFolder.JUNK.equals(type);
@ -7426,6 +7445,10 @@ public class FragmentMessages extends FragmentBase
if (inbox) if (inbox)
count++; count++;
boolean keywords = (more_keywords && count < FragmentDialogQuickActions.MAX_QUICK_ACTIONS && !result.hasPop && result.hasImap);
if (keywords)
count++;
boolean importance_high = (more_importance_high && count < FragmentDialogQuickActions.MAX_QUICK_ACTIONS && boolean importance_high = (more_importance_high && count < FragmentDialogQuickActions.MAX_QUICK_ACTIONS &&
!EntityMessage.PRIORITIY_HIGH.equals(result.importance)); !EntityMessage.PRIORITIY_HIGH.equals(result.importance));
if (importance_high) if (importance_high)
@ -7497,6 +7520,7 @@ public class FragmentMessages extends FragmentBase
ibDelete.setVisibility(delete ? View.VISIBLE : View.GONE); ibDelete.setVisibility(delete ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE); ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(inbox ? View.VISIBLE : View.GONE); ibInbox.setVisibility(inbox ? View.VISIBLE : View.GONE);
ibKeywords.setVisibility(keywords ? View.VISIBLE : View.GONE);
cardMore.setTag(fabMore.isOrWillBeShown() ? result : null); cardMore.setTag(fabMore.isOrWillBeShown() ? result : null);
cardMore.setVisibility(fabMore.isOrWillBeShown() ? View.VISIBLE : View.GONE); cardMore.setVisibility(fabMore.isOrWillBeShown() ? View.VISIBLE : View.GONE);
} }

@ -252,6 +252,19 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbJunk" /> app:layout_constraintTop_toBottomOf="@id/cbJunk" />
<CheckBox
android:id="@+id/cbKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_label_important_24"
android:drawablePadding="6dp"
android:text="@string/title_manage_keywords"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbInbox" />
<View <View
android:id="@+id/vSeparator" android:id="@+id/vSeparator"
android:layout_width="0dp" android:layout_width="0dp"
@ -260,7 +273,7 @@
android:background="?attr/colorSeparator" android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbInbox" /> app:layout_constraintTop_toBottomOf="@id/cbKeywords" />
<CheckBox <CheckBox
android:id="@+id/cbClear" android:id="@+id/cbClear"

@ -972,6 +972,20 @@
app:srcCompat="@drawable/twotone_inbox_24" app:srcCompat="@drawable/twotone_inbox_24"
app:tint="@color/action_foreground" /> app:tint="@color/action_foreground" />
<ImageButton
android:id="@+id/ibKeywords"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_manage_keywords"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_manage_keywords"
app:layout_constraintEnd_toStartOf="@id/ibInbox"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_label_important_24"
app:tint="@color/action_foreground" />
<ImageButton <ImageButton
android:id="@+id/ibMoreSettings" android:id="@+id/ibMoreSettings"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -981,7 +995,7 @@
android:padding="3dp" android:padding="3dp"
android:paddingVertical="6dp" android:paddingVertical="6dp"
android:tooltipText="@string/title_setup" android:tooltipText="@string/title_setup"
app:layout_constraintEnd_toStartOf="@id/ibInbox" app:layout_constraintEnd_toStartOf="@id/ibKeywords"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_settings_24" app:srcCompat="@drawable/twotone_settings_24"
app:tint="@color/action_foreground" /> app:tint="@color/action_foreground" />

Loading…
Cancel
Save