1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Reorganized display settings

This commit is contained in:
M66B 2020-03-23 15:48:13 +01:00
parent 038cf12264
commit b6d5aeb1c0
2 changed files with 65 additions and 51 deletions

View file

@ -85,7 +85,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swNameEmail;
private SwitchCompat swPreferContact;
private SwitchCompat swDistinguishContacts;
private SwitchCompat swAuthentication;
private SwitchCompat swSubjectTop;
private Spinner spFontSizeSender;
private Spinner spFontSizeSubject;
@ -108,16 +107,19 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swImagesInline;
private SwitchCompat swAttachmentsAlt;
private SwitchCompat swAuthentication;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
"threading", "indentation", "seekbar", "actionbar",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "authentication",
"name_email", "prefer_contact", "distinguish_contacts",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "highlight_subject", "subject_ellipsize",
"keywords_header", "flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes", "attachments_alt"
"inline_images", "collapse_quotes", "attachments_alt",
"authentication"
};
@Override
@ -160,7 +162,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNameEmail = view.findViewById(R.id.swNameEmail);
swPreferContact = view.findViewById(R.id.swPreferContact);
swDistinguishContacts = view.findViewById(R.id.swDistinguishContacts);
swAuthentication = view.findViewById(R.id.swAuthentication);
swSubjectTop = view.findViewById(R.id.swSubjectTop);
spFontSizeSender = view.findViewById(R.id.spFontSizeSender);
spFontSizeSubject = view.findViewById(R.id.spFontSizeSubject);
@ -181,6 +182,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesInline = view.findViewById(R.id.swImagesInline);
swAttachmentsAlt = view.findViewById(R.id.swAttachmentsAlt);
swAuthentication = view.findViewById(R.id.swAuthentication);
setOptions();
@ -421,13 +423,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("authentication", checked).apply();
}
});
swSubjectTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -595,6 +590,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("authentication", checked).apply();
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
@ -688,8 +690,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swNameEmail.setChecked(prefs.getBoolean("name_email", false));
swPreferContact.setChecked(prefs.getBoolean("prefer_contact", false));
swDistinguishContacts.setChecked(prefs.getBoolean("distinguish_contacts", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swSubjectTop.setChecked(prefs.getBoolean("subject_top", false));
int[] fontSizeValues = getResources().getIntArray(R.array.fontSizeValues);
@ -736,6 +736,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swAttachmentsAlt.setChecked(prefs.getBoolean("attachments_alt", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
updateColor();
}

View file

@ -495,30 +495,6 @@
app:layout_constraintTop_toBottomOf="@id/swPreferContact"
app:switchPadding="12dp" />
<ImageView
android:id="@+id/ivAuth"
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@string/title_legend_auth"
android:tint="?attr/colorWarning"
app:layout_constraintBottom_toBottomOf="@+id/swAuthentication"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/swAuthentication"
app:srcCompat="@drawable/baseline_flag_24" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthentication"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_authentication"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivAuth"
app:layout_constraintTop_toBottomOf="@id/swDistinguishContacts"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSubjectTop"
android:layout_width="0dp"
@ -528,7 +504,7 @@
android:text="@string/title_advanced_subject_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthentication"
app:layout_constraintTop_toBottomOf="@id/swDistinguishContacts"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
@ -722,17 +698,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spPreviewLines" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAddresses"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_addresses"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPreviewIssue"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionBody"
android:layout_width="0dp"
@ -743,7 +708,18 @@
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swAddresses" />
app:layout_constraintTop_toBottomOf="@+id/tvPreviewIssue" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAddresses"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_addresses"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swContrast"
@ -753,7 +729,7 @@
android:text="@string/title_advanced_contrast"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -835,5 +811,41 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAdvanced"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:text="@string/title_advanced_advanced"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt" />
<ImageView
android:id="@+id/ivAuth"
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@string/title_legend_auth"
android:tint="?attr/colorWarning"
app:layout_constraintBottom_toBottomOf="@+id/swAuthentication"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/swAuthentication"
app:srcCompat="@drawable/baseline_flag_24" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthentication"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_authentication"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivAuth"
app:layout_constraintTop_toBottomOf="@id/tvAdvanced"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>