Added setting to show keywords in header

pull/172/head
M66B 5 years ago
parent 594f6d85c6
commit 72baf4241b

@ -209,6 +209,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean subject_italic;
private String subject_ellipsize;
private boolean keywords_header;
private boolean flags;
private boolean flags_background;
private boolean preview;
@ -881,7 +882,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
keywords.add(keyword);
}
tvKeywords.setVisibility(keywords.size() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setVisibility(keywords_header && keywords.size() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setText(TextUtils.join(" ", keywords));
// Line 3
@ -4085,6 +4086,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.subject_italic = prefs.getBoolean("subject_italic", true);
this.subject_ellipsize = prefs.getString("subject_ellipsize", "middle");
this.keywords_header = prefs.getBoolean("keywords_header", false);
this.flags = prefs.getBoolean("flags", true);
this.flags_background = prefs.getBoolean("flags_background", false);
this.preview = prefs.getBoolean("preview", false);

@ -46,7 +46,7 @@ public class FragmentOptions extends FragmentBase {
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize", "keywords_header",
"flags", "flags_background", "preview", "preview_italic", "preview_lines",
"addresses", "attachments_alt",
"contrast", "monospaced", "text_color",

@ -82,6 +82,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private Spinner spFontSizeSubject;
private SwitchCompat swSubjectItalic;
private Spinner spSubjectEllipsize;
private SwitchCompat swKeywords;
private SwitchCompat swFlags;
private SwitchCompat swFlagsBackground;
private SwitchCompat swPreview;
@ -102,7 +103,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"theme", "landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize", "keywords_header",
"flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses", "attachments_alt",
"contrast", "monospaced", "text_color",
"inline_images", "collapse_quotes", "seekbar", "actionbar",
@ -148,6 +149,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spFontSizeSubject = view.findViewById(R.id.spFontSizeSubject);
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
swKeywords = view.findViewById(R.id.swKeywords);
swFlags = view.findViewById(R.id.swFlags);
swFlagsBackground = view.findViewById(R.id.swFlagsBackground);
swPreview = view.findViewById(R.id.swPreview);
@ -434,6 +436,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swKeywords.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("keywords_header", checked).apply();
}
});
swFlags.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -654,6 +663,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
break;
}
swKeywords.setChecked(prefs.getBoolean("keywords_header", false));
swFlags.setChecked(prefs.getBoolean("flags", true));
swFlagsBackground.setChecked(prefs.getBoolean("flags_background", false));
swPreview.setChecked(prefs.getBoolean("preview", false));

@ -496,6 +496,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEllipsize" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_keywords"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spSubjectEllipsize"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swFlags"
android:layout_width="0dp"
@ -505,7 +517,7 @@
android:text="@string/title_advanced_flags"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spSubjectEllipsize"
app:layout_constraintTop_toBottomOf="@id/swKeywords"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -306,6 +306,7 @@
<string name="title_advanced_subject_top">Show subject above sender</string>
<string name="title_advanced_subject_italic">Show subject in italics</string>
<string name="title_advanced_subject_elipsed">When needed, shorten the subject</string>
<string name="title_advanced_keywords">Show keywords in message header</string>
<string name="title_advanced_flags">Show stars</string>
<string name="title_advanced_flags_background">Show colored background instead of colored stars</string>
<string name="title_advanced_preview">Show message preview</string>

Loading…
Cancel
Save