Highlight color improvements

pull/187/head
M66B 4 years ago
parent 136663d042
commit 21d1e6d58f

@ -5100,7 +5100,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.colorUnread = (highlight_unread ? colorHighlight : Helper.resolveColor(context, R.attr.colorUnread));
this.colorRead = Helper.resolveColor(context, R.attr.colorRead);
this.colorSubject = (highlight_subject ? colorHighlight : Helper.resolveColor(context, R.attr.colorRead));
this.colorSubject = Helper.resolveColor(context, highlight_subject ? R.attr.colorUnreadHighlight : R.attr.colorRead);
this.colorEncrypt = Helper.resolveColor(context, R.attr.colorEncrypt);
this.colorSeparator = Helper.resolveColor(context, R.attr.colorSeparator);

@ -79,10 +79,10 @@ public class FragmentOptions extends FragmentBase {
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"portrait2", "landscape", "landscape3", "startup", "cards", "beige", "indentation", "date", "threading", "threading_unread",
"highlight_unread", "color_stripe",
"highlight_unread", "highlight_color", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize", "highlight_color",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"message_zoom", "overview_mode", "addresses", "attachments_alt", "thumbnails",
"contrast", "monospaced",

@ -80,6 +80,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swActionbarColor;
private SwitchCompat swHighlightUnread;
private ViewButtonColor btnHighlightColor;
private SwitchCompat swColorStripe;
private SwitchCompat swAvatars;
private TextView tvGravatarsHint;
@ -104,7 +105,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swSubjectItalic;
private SwitchCompat swHighlightSubject;
private Spinner spSubjectEllipsize;
private ViewButtonColor btnHighlightColor;
private SwitchCompat swKeywords;
private SwitchCompat swLabels;
private SwitchCompat swFlags;
@ -135,10 +135,10 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "beige", "date", "navbar_colorize", "portrait2", "landscape", "landscape3",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_color",
"highlight_unread", "color_stripe",
"highlight_unread", "highlight_color", "color_stripe",
"avatars", "gravatars", "favicons", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "show_recipients",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize", "highlight_color",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background",
"preview", "preview_italic", "preview_lines",
"addresses",
@ -176,6 +176,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swActionbarColor = view.findViewById(R.id.swActionbarColor);
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
btnHighlightColor = view.findViewById(R.id.btnHighlightColor);
swColorStripe = view.findViewById(R.id.swColorStripe);
swAvatars = view.findViewById(R.id.swAvatars);
swGravatars = view.findViewById(R.id.swGravatars);
@ -200,7 +201,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
swHighlightSubject = view.findViewById(R.id.swHighlightSubject);
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
btnHighlightColor = view.findViewById(R.id.btnHighlightColor);
swKeywords = view.findViewById(R.id.swKeywords);
swLabels = view.findViewById(R.id.swLabels);
swFlags = view.findViewById(R.id.swFlags);
@ -356,6 +356,41 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
btnHighlightColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = getContext();
int editTextColor = Helper.resolveColor(context, android.R.attr.editTextColor);
int highlightColor = prefs.getInt("highlight_color", Helper.resolveColor(context, R.attr.colorAccent));
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
.with(context)
.setTitle(R.string.title_advanced_highlight_color)
.initialColor(highlightColor)
.showColorEdit(true)
.setColorEditTextColor(editTextColor)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(6)
.lightnessSliderOnly()
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
prefs.edit().putInt("highlight_color", selectedColor).apply();
btnHighlightColor.setColor(selectedColor);
}
})
.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
prefs.edit().remove("highlight_color").apply();
btnHighlightColor.setColor(Helper.resolveColor(context, R.attr.colorAccent));
}
});
builder.build().show();
}
});
swColorStripe.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -572,39 +607,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
btnHighlightColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Context context = getContext();
int editTextColor = Helper.resolveColor(context, android.R.attr.editTextColor);
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
.with(context)
.setTitle(R.string.title_advanced_highlight_color)
.showColorEdit(true)
.setColorEditTextColor(editTextColor)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(6)
.lightnessSliderOnly()
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
prefs.edit().putInt("highlight_color", selectedColor).apply();
btnHighlightColor.setColor(selectedColor);
}
})
.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
prefs.edit().remove("highlight_color").apply();
btnHighlightColor.setColor(Helper.resolveColor(context, R.attr.colorAccent));
}
});
builder.build().show();
}
});
swKeywords.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -879,6 +881,10 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swActionbarColor.setEnabled(swActionbar.isChecked());
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", true));
btnHighlightColor.setColor(prefs.getInt("highlight_color",
Helper.resolveColor(getContext(), R.attr.colorUnreadHighlight)));
swColorStripe.setChecked(prefs.getBoolean("color_stripe", true));
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swGravatars.setChecked(prefs.getBoolean("gravatars", false));
@ -928,9 +934,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
break;
}
btnHighlightColor.setColor(prefs.getInt("highlight_color",
Helper.resolveColor(getContext(), R.attr.colorUnreadHighlight)));
swKeywords.setChecked(prefs.getBoolean("keywords_header", false));
swLabels.setChecked(prefs.getBoolean("labels_header", true));
swFlags.setChecked(prefs.getBoolean("flags", true));

@ -325,6 +325,17 @@
app:layout_constraintTop_toBottomOf="@id/tvCaptionHeader"
app:switchPadding="12dp" />
<eu.faircode.email.ViewButtonColor
android:id="@+id/btnHighlightColor"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingHorizontal="6dp"
android:text="@string/title_advanced_highlight_color"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightUnread" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swColorStripe"
android:layout_width="0dp"
@ -335,7 +346,7 @@
android:text="@string/title_advanced_color_stripe"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightUnread"
app:layout_constraintTop_toBottomOf="@id/btnHighlightColor"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -664,6 +675,18 @@
app:layout_constraintTop_toBottomOf="@id/swSubjectItalic"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvHighlightSubjectHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_highlight_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightSubject" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSubjectEllipsize"
android:layout_width="0dp"
@ -674,7 +697,7 @@
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHighlightSubject" />
app:layout_constraintTop_toBottomOf="@id/tvHighlightSubjectHint" />
<Spinner
android:id="@+id/spSubjectEllipsize"
@ -685,29 +708,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEllipsize" />
<eu.faircode.email.ViewButtonColor
android:id="@+id/btnHighlightColor"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:paddingHorizontal="6dp"
android:text="@string/title_advanced_highlight_color"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spSubjectEllipsize" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvHighlightColorHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_highlight_color_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnHighlightColor" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swKeywords"
android:layout_width="0dp"
@ -716,7 +716,7 @@
android:text="@string/title_advanced_keywords"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHighlightColorHint"
app:layout_constraintTop_toBottomOf="@id/spSubjectEllipsize"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -552,9 +552,9 @@
<string name="title_advanced_date_hint">Messages are only grouped by date if they are sorted by time</string>
<string name="title_advanced_navbar_colorize_hint">Whether this works depends on the Android version and variant</string>
<string name="title_advanced_threading_hint">Group messages related to each other</string>
<string name="title_advanced_highlight_hint">The accent color of the theme will be used for highlighting</string>
<string name="title_advanced_gravatars_hint">There might be a privacy risk</string>
<string name="title_advanced_name_email_hint">When disabled only names will be shown when available</string>
<string name="title_advanced_highlight_color_hint">The highlight color for unread messages (sender, subject, etc)</string>
<string name="title_advanced_preview_hint">Only available when message text has been downloaded</string>
<string name="title_advanced_preview_issue">Scrolling can be slow due to a bug in some Android versions when the number of lines is more than one</string>
<string name="title_advanced_overview_mode_hint">This can result in very small fonts</string>

Loading…
Cancel
Save