Added optional set importance button

pull/194/merge
M66B 3 years ago
parent 8a1b9cfdfe
commit 897649584b

@ -435,6 +435,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibSearch;
private ImageButton ibTranslate;
private ImageButton ibForceLight;
private ImageButton ibImportance;
private ImageButton ibHide;
private ImageButton ibSeen;
private ImageButton ibAnswer;
@ -814,6 +815,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibSearch = vsBody.findViewById(R.id.ibSearch);
ibTranslate = vsBody.findViewById(R.id.ibTranslate);
ibForceLight = vsBody.findViewById(R.id.ibForceLight);
ibImportance = vsBody.findViewById(R.id.ibImportance);
ibHide = vsBody.findViewById(R.id.ibHide);
ibSeen = vsBody.findViewById(R.id.ibSeen);
ibAnswer = vsBody.findViewById(R.id.ibAnswer);
@ -934,6 +936,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTranslate.setOnClickListener(this);
ibTranslate.setOnLongClickListener(this);
ibForceLight.setOnClickListener(this);
ibImportance.setOnClickListener(this);
ibHide.setOnClickListener(this);
ibSeen.setOnClickListener(this);
ibAnswer.setOnClickListener(this);
@ -1032,6 +1035,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTranslate.setOnClickListener(null);
ibTranslate.setOnLongClickListener(null);
ibForceLight.setOnClickListener(null);
ibImportance.setOnClickListener(null);
ibHide.setOnClickListener(null);
ibSeen.setOnClickListener(null);
ibAnswer.setOnClickListener(null);
@ -1556,6 +1560,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibSearch.setVisibility(View.GONE);
ibTranslate.setVisibility(View.GONE);
ibForceLight.setVisibility(View.GONE);
ibImportance.setVisibility(View.GONE);
ibHide.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE);
@ -1792,6 +1797,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibSearch.setVisibility(View.GONE);
ibTranslate.setVisibility(View.GONE);
ibForceLight.setVisibility(View.GONE);
ibImportance.setVisibility(View.GONE);
ibHide.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE);
@ -1979,6 +1985,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_notes = prefs.getBoolean("button_notes", false);
boolean button_seen = prefs.getBoolean("button_seen", false);
boolean button_hide = prefs.getBoolean("button_hide", false);
boolean button_importance = prefs.getBoolean("button_importance", false);
boolean button_translate = prefs.getBoolean("button_translate", true);
boolean button_force_light = prefs.getBoolean("button_force_light", false);
boolean button_search = prefs.getBoolean("button_search", false);
@ -1992,6 +1999,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_rule = prefs.getBoolean("button_rule", false);
boolean swipe_reply = prefs.getBoolean("swipe_reply", false);
int importance = (((message.ui_importance == null ? 1 : message.ui_importance) + 1) % 3);
ibImportance.setImageLevel(importance);
ibHide.setImageResource(message.ui_snoozed == null ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
ibSeen.setImageResource(message.ui_seen ? R.drawable.twotone_mail_24 : R.drawable.twotone_drafts_24);
ibTrash.setTag(delete);
@ -2012,6 +2022,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTranslate.setVisibility(tools && !outbox && button_translate && DeepL.isAvailable(context) && message.content ? View.VISIBLE : View.GONE);
ibForceLight.setVisibility(tools && full && dark && button_force_light && message.content ? View.VISIBLE : View.GONE);
ibForceLight.setImageLevel(force_light ? 1 : 0);
ibImportance.setVisibility(tools && button_importance && !outbox ? View.VISIBLE : View.GONE);
ibHide.setVisibility(tools && button_hide && !outbox ? View.VISIBLE : View.GONE);
ibSeen.setVisibility(tools && button_seen && !outbox && seen ? View.VISIBLE : View.GONE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) || !threading || swipe_reply ? View.GONE : View.VISIBLE);
@ -3491,6 +3502,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onMenuUnseen(message);
} else if (id == R.id.ibHide) {
onMenuHide(message);
} else if (id == R.id.ibImportance) {
int importance = (((message.ui_importance == null ? 1 : message.ui_importance) + 1) % 3);
onMenuSetImportance(message, importance);
} else if (id == R.id.btnCalendarAccept || id == R.id.btnCalendarDecline || id == R.id.btnCalendarMaybe || id == R.id.ibCalendar) {
onActionCalendar(message, view.getId(), false);
} else {
@ -7597,6 +7611,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_buttons, null);
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
final CheckBox cbImportance = dview.findViewById(R.id.cbImportance);
final CheckBox cbJunk = dview.findViewById(R.id.cbJunk);
final CheckBox cbTrash = dview.findViewById(R.id.cbTrash);
final CheckBox cbArchive = dview.findViewById(R.id.cbArchive);
@ -7621,6 +7636,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
cbSeen.setChecked(prefs.getBoolean("button_seen", false));
cbHide.setChecked(prefs.getBoolean("button_hide", false));
cbImportance.setChecked(prefs.getBoolean("button_importance", false));
cbJunk.setChecked(prefs.getBoolean("button_junk", true));
cbTrash.setChecked(prefs.getBoolean("button_trash", true));
cbArchive.setChecked(prefs.getBoolean("button_archive", true));
@ -7648,6 +7664,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("button_seen", cbSeen.isChecked());
editor.putBoolean("button_hide", cbHide.isChecked());
editor.putBoolean("button_importance", cbImportance.isChecked());
editor.putBoolean("button_junk", cbJunk.isChecked());
editor.putBoolean("button_trash", cbTrash.isChecked());
editor.putBoolean("button_archive", cbArchive.isChecked());

@ -57,6 +57,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSeen" />
<CheckBox
android:id="@+id/cbImportance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/baseline_arrow_upward_24"
android:drawablePadding="6dp"
android:text="@string/title_set_importance"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbHide" />
<CheckBox
android:id="@+id/cbJunk"
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/cbHide" />
app:layout_constraintTop_toBottomOf="@id/cbImportance" />
<CheckBox
android:id="@+id/cbTrash"

@ -50,7 +50,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
app:constraint_referenced_ids="vwEmpty,ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibNotes,ibAnswer,ibSeen,ibHide,ibTranslate,ibForceLight,ibSearch,ibSearchText,ibEvent,ibShare,ibPin,ibPrint,ibHeaders,ibUnsubscribe,ibRule,ibUndo"
app:constraint_referenced_ids="vwEmpty,ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibNotes,ibAnswer,ibSeen,ibHide,ibImportance,ibTranslate,ibForceLight,ibSearch,ibSearchText,ibEvent,ibShare,ibPin,ibPrint,ibHeaders,ibUnsubscribe,ibRule,ibUndo"
app:flow_horizontalBias="0"
app:flow_horizontalGap="3dp"
app:flow_horizontalStyle="packed"
@ -227,6 +227,18 @@
app:srcCompat="@drawable/twotone_visibility_off_24"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibImportance"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_set_importance"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_set_importance"
app:srcCompat="@drawable/importance"
tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibSearch"
android:layout_width="36dp"

Loading…
Cancel
Save