Added option to highlight subject

This commit is contained in:
M66B 2020-03-22 18:43:22 +01:00
parent 7c6bdfac73
commit d0e366a336
5 changed files with 56 additions and 30 deletions

View File

@ -210,6 +210,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private int textColorSecondary;
private int colorUnread;
private int colorRead;
private int colorSubject;
private int colorSeparator;
private boolean hasWebView;
@ -493,7 +494,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibHelp = itemView.findViewById(R.id.ibHelp);
if (tvSubject != null) {
tvSubject.setTextColor(colorRead);
tvSubject.setTextColor(colorSubject);
if (compact)
if ("start".equals(subject_ellipsize))
@ -4429,9 +4430,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
boolean highlight_unread = prefs.getBoolean("highlight_unread", true);
boolean highlight_subject = prefs.getBoolean("highlight_subject", false);
this.colorUnread = Helper.resolveColor(context, highlight_unread ? R.attr.colorUnreadHighlight : R.attr.colorUnread);
this.colorRead = Helper.resolveColor(context, R.attr.colorRead);
this.colorSubject = Helper.resolveColor(context, highlight_subject ? R.attr.colorUnreadHighlight : R.attr.colorRead);
this.colorSeparator = Helper.resolveColor(context, R.attr.colorSeparator);

View File

@ -44,11 +44,12 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading", "highlight_unread", "color_stripe",
"landscape", "landscape3", "startup", "cards", "indentation", "date", "threading",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize", "keywords_header",
"flags", "flags_background", "preview", "preview_italic", "preview_lines",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"addresses", "attachments_alt",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes", "seekbar", "actionbar", "navbar_colorize",

View File

@ -90,6 +90,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private Spinner spFontSizeSender;
private Spinner spFontSizeSubject;
private SwitchCompat swSubjectItalic;
private SwitchCompat swHighlightSubject;
private Spinner spSubjectEllipsize;
private SwitchCompat swKeywords;
private SwitchCompat swFlags;
@ -98,7 +99,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swPreviewItalic;
private Spinner spPreviewLines;
private SwitchCompat swAddresses;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swContrast;
private SwitchCompat swMonospaced;
@ -106,6 +106,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swTextSize;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swImagesInline;
private SwitchCompat swAttachmentsAlt;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
@ -113,10 +114,10 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "authentication",
"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",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes"
"inline_images", "collapse_quotes", "attachments_alt"
};
@Override
@ -164,6 +165,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spFontSizeSender = view.findViewById(R.id.spFontSizeSender);
spFontSizeSubject = view.findViewById(R.id.spFontSizeSubject);
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
swHighlightSubject = view.findViewById(R.id.swHighlightSubject);
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
swKeywords = view.findViewById(R.id.swKeywords);
swFlags = view.findViewById(R.id.swFlags);
@ -172,13 +174,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
spPreviewLines = view.findViewById(R.id.spPreviewLines);
swAddresses = view.findViewById(R.id.swAddresses);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swContrast = view.findViewById(R.id.swContrast);
swMonospaced = view.findViewById(R.id.swMonospaced);
swTextColor = view.findViewById(R.id.swTextColor);
swTextSize = view.findViewById(R.id.swTextSize);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesInline = view.findViewById(R.id.swImagesInline);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
setOptions();
@ -468,6 +470,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swHighlightSubject.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("highlight_subject", checked).apply();
}
});
spSubjectEllipsize.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@ -537,13 +546,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("attachments_alt", checked).apply();
}
});
swContrast.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -586,6 +588,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swAttachmentsAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("attachments_alt", checked).apply();
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
@ -700,6 +709,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
swHighlightSubject.setChecked(prefs.getBoolean("highlight_subject", false));
String subject_ellipsize = prefs.getString("subject_ellipsize", "middle");
String[] ellipsizeValues = getResources().getStringArray(R.array.ellipsizeValues);
@ -718,13 +728,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
spPreviewLines.setSelection(prefs.getInt("preview_lines", 2) - 1);
spPreviewLines.setEnabled(swPreview.isChecked());
swAddresses.setChecked(prefs.getBoolean("addresses", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swContrast.setChecked(prefs.getBoolean("contrast", false));
swMonospaced.setChecked(prefs.getBoolean("monospaced", false));
swTextColor.setChecked(prefs.getBoolean("text_color", true));
swTextSize.setChecked(prefs.getBoolean("text_size", true));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
updateColor();
}

View File

@ -587,6 +587,17 @@
app:layout_constraintTop_toBottomOf="@id/spFontSizeSubject"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHighlightSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_highlight_subject"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSubjectItalic"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSubjectEllipsize"
android:layout_width="0dp"
@ -597,7 +608,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSubjectItalic" />
app:layout_constraintTop_toBottomOf="@id/swHighlightSubject" />
<Spinner
android:id="@+id/spSubjectEllipsize"
@ -722,17 +733,6 @@
app:layout_constraintTop_toBottomOf="@id/tvPreviewIssue"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAttachmentsAlt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_attachments_alt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionBody"
android:layout_width="0dp"
@ -743,7 +743,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swAttachmentsAlt" />
app:layout_constraintTop_toBottomOf="@+id/swAddresses" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swContrast"
@ -824,5 +824,16 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesInline" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAttachmentsAlt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_attachments_alt"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -315,6 +315,7 @@
<string name="title_advanced_threading">Conversation threading</string>
<string name="title_advanced_indentation">Left/right indent received/sent messages in conversations</string>
<string name="title_advanced_highlight_unread">Highlight unread messages</string>
<string name="title_advanced_highlight_subject">Highlight subject</string>
<string name="title_advanced_color_stripe">Show color stripe</string>
<string name="title_advanced_avatars">Show contact photos</string>
<string name="title_advanced_gravatars">Show Gravatars</string>