Added option to swap sender and subject

This commit is contained in:
M66B 2019-08-22 12:50:13 +02:00
parent 426a3cfb07
commit 7430b63444
5 changed files with 34 additions and 6 deletions

View File

@ -182,6 +182,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean date;
private boolean threading;
private boolean name_email;
private boolean subject_top;
private boolean subject_italic;
private boolean flags;
private boolean preview;
@ -341,7 +342,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivExpander = itemView.findViewById(R.id.ivExpander);
ivFlagged = itemView.findViewById(R.id.ivFlagged);
ivAvatar = itemView.findViewById(R.id.ivAvatar);
tvFrom = itemView.findViewById(R.id.tvFrom);
tvFrom = itemView.findViewById(subject_top ? R.id.tvSubject : R.id.tvFrom);
tvSize = itemView.findViewById(R.id.tvSize);
tvTime = itemView.findViewById(R.id.tvTime);
ivType = itemView.findViewById(R.id.ivType);
@ -352,7 +353,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivPlain = itemView.findViewById(R.id.ivPlain);
ivReceipt = itemView.findViewById(R.id.ivReceipt);
ivAttachments = itemView.findViewById(R.id.ivAttachments);
tvSubject = itemView.findViewById(R.id.tvSubject);
tvSubject = itemView.findViewById(subject_top ? R.id.tvFrom : R.id.tvSubject);
tvPreview = itemView.findViewById(R.id.tvPreview);
tvFolder = itemView.findViewById(R.id.tvFolder);
tvCount = itemView.findViewById(R.id.tvCount);
@ -3010,6 +3011,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.date = prefs.getBoolean("date", true);
this.threading = prefs.getBoolean("threading", true);
this.name_email = prefs.getBoolean("name_email", !compact);
this.subject_top = prefs.getBoolean("subject_top", false);
this.subject_italic = prefs.getBoolean("subject_italic", true);
this.flags = prefs.getBoolean("flags", true);
this.preview = prefs.getBoolean("preview", false);

View File

@ -38,8 +38,10 @@ public class FragmentOptions extends FragmentBase {
private PagerAdapter adapter;
static String[] OPTIONS_RESTART = new String[]{
"startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular",
"name_email", "subject_top", "subject_italic", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images",
"contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"subscriptions", "debug",
"biometrics"

View File

@ -53,6 +53,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swIdenticons;
private SwitchCompat swCircular;
private SwitchCompat swNameEmail;
private SwitchCompat swSubjectTop;
private SwitchCompat swSubjectItalic;
private SwitchCompat swFlags;
private SwitchCompat swPreview;
@ -70,7 +71,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swActionbar;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular", "name_email", "subject_italic",
"theme", "startup", "cards", "date", "threading", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular", "name_email", "subject_top", "subject_italic",
"flags", "preview", "preview_italic", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "contact_images", "all_images", "collapse_quotes", "autocontent", "actionbar",
};
@ -96,6 +98,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swIdenticons = view.findViewById(R.id.swIdenticons);
swCircular = view.findViewById(R.id.swCircular);
swNameEmail = view.findViewById(R.id.swNameEmail);
swSubjectTop = view.findViewById(R.id.swSubjectTop);
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
swFlags = view.findViewById(R.id.swFlags);
swPreview = view.findViewById(R.id.swPreview);
@ -205,6 +208,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swSubjectTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("subject_top", checked).apply();
}
});
swSubjectItalic.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -369,6 +379,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swIdenticons.setEnabled(swGeneratedIcons.isChecked());
swCircular.setChecked(prefs.getBoolean("circular", true));
swNameEmail.setChecked(prefs.getBoolean("name_email", !compact));
swSubjectTop.setChecked(prefs.getBoolean("subject_top", false));
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));
swFlags.setChecked(prefs.getBoolean("flags", true));
swPreview.setChecked(prefs.getBoolean("preview", false));

View File

@ -181,6 +181,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNameEmail" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSubjectTop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_subject_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNameEmailHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSubjectItalic"
android:layout_width="0dp"
@ -190,7 +202,7 @@
android:text="@string/title_advanced_subject_italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNameEmailHint"
app:layout_constraintTop_toBottomOf="@id/swSubjectTop"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -235,6 +235,7 @@
<string name="title_advanced_identicons">Show identicons</string>
<string name="title_advanced_circular">Show round icons</string>
<string name="title_advanced_name_email">Show names and email addresses</string>
<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_flags">Show stars</string>
<string name="title_advanced_preview">Show message preview</string>