Added option to vertically align keywords, preview, and notes

pull/212/head
M66B 2 years ago
parent 3f409b46e3
commit 43f60d880b

@ -298,6 +298,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean preview;
private boolean preview_italic;
private int preview_lines;
private boolean align_header;
private boolean large_buttons;
private int message_zoom;
private boolean attachments_alt;
@ -7546,6 +7547,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.preview = prefs.getBoolean("preview", false);
this.preview_italic = prefs.getBoolean("preview_italic", true);
this.preview_lines = prefs.getInt("preview_lines", 1);
this.align_header = prefs.getBoolean("align_header", false);
this.message_zoom = prefs.getInt("message_zoom", 100);
this.attachments_alt = prefs.getBoolean("attachments_alt", false);
this.thumbnails = prefs.getBoolean("thumbnails", true);
@ -8283,7 +8285,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(viewType, parent, false), viewType);
View view = inflater.inflate(viewType, parent, false);
if (align_header) {
View v = view.findViewById(R.id.ibAvatar);
ConstraintLayout.LayoutParams lparam = (ConstraintLayout.LayoutParams) v.getLayoutParams();
lparam.bottomToBottom = R.id.tvNotes; // tvFolder
for (int id : new int[]{R.id.tvLabels, R.id.tvExpand, R.id.tvPreview, R.id.tvNotes}) {
v = view.findViewById(id);
lparam = (ConstraintLayout.LayoutParams) v.getLayoutParams();
lparam.startToEnd = R.id.ibAvatar;
}
}
return new ViewHolder(view, viewType);
}
@Override

@ -143,7 +143,7 @@ public class FragmentOptions extends FragmentBase {
"email_format", "prefer_contact", "only_contact", "distinguish_contacts", "show_recipients",
"font_size_sender", "sender_ellipsize",
"subject_top", "subject_italic", "highlight_subject", "font_size_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines",
"keywords_header", "labels_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "align_header",
"message_zoom", "overview_mode", "override_width", "addresses", "button_extra", "attachments_alt", "thumbnails",
"contrast", "hyphenation", "display_font", "monospaced_pre",
"list_count", "bundled_fonts", "parse_classes",

@ -155,6 +155,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swPreviewItalic;
private Spinner spPreviewLines;
private TextView tvPreviewLinesHint;
private SwitchCompat swAlignHeader;
private SwitchCompat swAddresses;
private TextView tvMessageZoom;
@ -208,7 +209,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"font_size_sender", "sender_ellipsize",
"subject_top", "subject_italic", "highlight_subject", "font_size_subject", "subject_ellipsize",
"keywords_header", "labels_header", "flags", "flags_background",
"preview", "preview_italic", "preview_lines",
"preview", "preview_italic", "preview_lines", "align_header",
"addresses",
"message_zoom", "overview_mode", "override_width",
"hyphenation", "display_font", "contrast", "monospaced_pre",
@ -321,6 +322,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swPreviewItalic = view.findViewById(R.id.swPreviewItalic);
spPreviewLines = view.findViewById(R.id.spPreviewLines);
tvPreviewLinesHint = view.findViewById(R.id.tvPreviewLinesHint);
swAlignHeader = view.findViewById(R.id.swAlignHeader);
swAddresses = view.findViewById(R.id.swAddresses);
tvMessageZoom = view.findViewById(R.id.tvMessageZoom);
sbMessageZoom = view.findViewById(R.id.sbMessageZoom);
@ -1112,6 +1114,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swAlignHeader.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("align_header", checked).apply();
}
});
swAddresses.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1537,6 +1546,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swPreviewItalic.setEnabled(swPreview.isChecked());
spPreviewLines.setSelection(prefs.getInt("preview_lines", 1) - 1);
spPreviewLines.setEnabled(swPreview.isChecked());
swAlignHeader.setChecked(prefs.getBoolean("align_header", false));
swAddresses.setChecked(prefs.getBoolean("addresses", false));

@ -1611,6 +1611,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewLinesHint" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAlignHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_align_header"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewIssue"
app:switchPadding="12dp" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAvatar"
android:layout_width="0dp"

@ -587,6 +587,7 @@
<string name="title_advanced_preview">Show message preview</string>
<string name="title_advanced_preview_italic">Show message preview in italics</string>
<string name="title_advanced_preview_lines">Number of preview lines</string>
<string name="title_advanced_align_header">Vertically align keywords, preview text, and notes</string>
<string name="title_advanced_addresses">Expand address details by default</string>
<string name="title_advanced_unzip">Show contents of compressed attachments</string>
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>

Loading…
Cancel
Save