mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-30 19:56:10 +00:00
Indentation depends on cards
This commit is contained in:
parent
421538abaf
commit
899ee65e7a
4 changed files with 29 additions and 27 deletions
|
@ -39,7 +39,7 @@ public class FragmentOptions extends FragmentBase {
|
|||
|
||||
static String[] OPTIONS_RESTART = new String[]{
|
||||
"subscriptions",
|
||||
"landscape", "startup", "cards", "date", "threading", "indentation", "highlight_unread",
|
||||
"landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread",
|
||||
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "subject_italic", "subject_ellipsize",
|
||||
|
|
|
@ -88,7 +88,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private SwitchCompat swActionbar;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"theme", "landscape", "startup", "cards", "date", "threading", "indentation", "highlight_unread",
|
||||
"theme", "landscape", "startup", "cards", "indentation", "date", "threading", "highlight_unread",
|
||||
"avatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
|
||||
"name_email", "distinguish_contacts", "authentication",
|
||||
"subject_top", "subject_italic", "subject_ellipsize",
|
||||
|
@ -111,9 +111,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
swLandscape = view.findViewById(R.id.swLandscape);
|
||||
spStartup = view.findViewById(R.id.spStartup);
|
||||
swCards = view.findViewById(R.id.swCards);
|
||||
swIndentation = view.findViewById(R.id.swIndentation);
|
||||
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);
|
||||
|
@ -182,6 +182,14 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("cards", checked).apply();
|
||||
swIndentation.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swIndentation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("indentation", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -200,13 +208,6 @@ 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) {
|
||||
|
@ -511,9 +512,10 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
|
||||
swCards.setChecked(prefs.getBoolean("cards", true));
|
||||
swIndentation.setChecked(prefs.getBoolean("indentation", false));
|
||||
swIndentation.setEnabled(swCards.isChecked());
|
||||
swDate.setChecked(prefs.getBoolean("date", true));
|
||||
swThreading.setChecked(prefs.getBoolean("threading", true));
|
||||
swIndentation.setChecked(prefs.getBoolean("indentation", false));
|
||||
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", false));
|
||||
swAvatars.setChecked(prefs.getBoolean("avatars", true));
|
||||
swGeneratedIcons.setChecked(prefs.getBoolean("generated_icons", true));
|
||||
|
|
|
@ -32,9 +32,9 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
public class ViewCardOptional extends CardView {
|
||||
private boolean cards;
|
||||
private boolean indentation;
|
||||
private boolean compact;
|
||||
private boolean threading;
|
||||
private boolean indentation;
|
||||
private int margin;
|
||||
private int ident;
|
||||
private Integer color = null;
|
||||
|
@ -57,9 +57,9 @@ public class ViewCardOptional extends CardView {
|
|||
private void init(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
cards = prefs.getBoolean("cards", true);
|
||||
indentation = prefs.getBoolean("indentation", false);
|
||||
compact = prefs.getBoolean("compact", false);
|
||||
threading = prefs.getBoolean("threading", true);
|
||||
indentation = prefs.getBoolean("indentation", false);
|
||||
|
||||
margin = Helper.dp2pixels(context, compact ? 3 : 6);
|
||||
ident = Helper.dp2pixels(context, 12 + (compact ? 3 : 6));
|
||||
|
|
|
@ -80,6 +80,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/spStartup"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<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/swCards"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swDate"
|
||||
android:layout_width="0dp"
|
||||
|
@ -89,7 +101,7 @@
|
|||
android:text="@string/title_advanced_date_header"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swCards"
|
||||
app:layout_constraintTop_toBottomOf="@id/swIndentation"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
@ -128,18 +140,6 @@
|
|||
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"
|
||||
|
@ -149,7 +149,7 @@
|
|||
android:text="@string/title_advanced_highlight_unread"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swIndentation"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
Loading…
Reference in a new issue