Added option to disable indentation

pull/163/head
M66B 5 years ago
parent a71f18b020
commit c2dcb86dfb

@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"subscriptions",
"startup", "cards", "date", "threading", "highlight_unread",
"startup", "cards", "date", "threading", "indentation", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular",
"name_email", "distinguish_contacts", "authentication",
"subject_top", "subject_italic", "subject_ellipsize",

@ -48,6 +48,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swCards;
private SwitchCompat swDate;
private SwitchCompat swThreading;
private SwitchCompat swIndentation;
private SwitchCompat swHighlightUnread;
private SwitchCompat swAvatars;
private SwitchCompat swGeneratedIcons;
@ -75,7 +76,7 @@ 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",
"theme", "startup", "cards", "date", "threading", "indentation", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular", "name_email", "distinguish_contacts", "authentication",
"subject_top", "subject_italic", "subject_ellipsize",
"flags", "flags_background", "preview", "preview_italic", "addresses", "attachments_alt",
@ -98,6 +99,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCards = view.findViewById(R.id.swCards);
swDate = view.findViewById(R.id.swDate);
swThreading = view.findViewById(R.id.swThreading);
swIndentation = view.findViewById(R.id.swIndentation);
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
swAvatars = view.findViewById(R.id.swAvatars);
swGeneratedIcons = view.findViewById(R.id.swGeneratedIcons);
@ -171,6 +173,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("indentation", checked).apply();
}
});
swHighlightUnread.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -410,6 +419,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCards.setChecked(prefs.getBoolean("cards", true));
swDate.setChecked(prefs.getBoolean("date", true));
swThreading.setChecked(prefs.getBoolean("threading", true));
swIndentation.setChecked(prefs.getBoolean("indentation", true));
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false));
swAvatars.setChecked(prefs.getBoolean("avatars", true));
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));

@ -34,6 +34,7 @@ public class ViewCardOptional extends CardView {
private boolean cards;
private boolean compact;
private boolean threading;
private boolean indentation;
private int margin;
private int ident;
private Integer color = null;
@ -58,6 +59,7 @@ public class ViewCardOptional extends CardView {
cards = prefs.getBoolean("cards", true);
compact = prefs.getBoolean("compact", false);
threading = prefs.getBoolean("threading", true);
indentation = prefs.getBoolean("indentation", true);
margin = Helper.dp2pixels(context, compact ? 3 : 6);
ident = Helper.dp2pixels(context, 12 + (compact ? 3 : 6));
@ -94,7 +96,7 @@ public class ViewCardOptional extends CardView {
}
public void setOutgoing(boolean outgoing) {
if (cards && threading) {
if (cards && threading && indentation) {
ViewGroup.MarginLayoutParams lparam = (ViewGroup.MarginLayoutParams) getLayoutParams();
lparam.setMarginStart(outgoing ? margin : ident);
lparam.setMarginEnd(outgoing ? ident : margin);

@ -116,6 +116,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swThreading" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swIndentation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_indentation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHighlightUnread"
android:layout_width="0dp"
@ -125,7 +137,7 @@
android:text="@string/title_advanced_highlight_unread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:layout_constraintTop_toBottomOf="@id/swIndentation"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -243,6 +243,7 @@
<string name="title_advanced_cards">Show cards</string>
<string name="title_advanced_date_header">Group by date</string>
<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_distinguish_contacts">Distinguish messages from known and unknown contacts</string>
<string name="title_advanced_avatars">Show contact photos</string>

Loading…
Cancel
Save