Moved option

This commit is contained in:
M66B 2019-09-11 22:00:21 +02:00
parent fbc8a983a7
commit 4d72f1771d
6 changed files with 41 additions and 40 deletions

View File

@ -40,7 +40,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"subscriptions",
"startup", "cards", "date", "threading", "highlight_unread", "avatars", "generated_icons", "identicons", "circular",
"name_email", "subject_top", "subject_italic", "subject_ellipsize", "flags", "preview", "preview_italic",
"name_email", "authentication", "subject_top", "subject_italic", "subject_ellipsize", "flags", "preview", "preview_italic",
"addresses", "attachments_alt", "contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "seekbar", "actionbar",
"autoscroll", "swipenav", "autoexpand", "autoclose", "onclose",
"experiments", "debug",

View File

@ -52,12 +52,11 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoRead;
private SwitchCompat swAutoMove;
private SwitchCompat swDiscardDelete;
private SwitchCompat swAuthentication;
private SwitchCompat swDisableTracking;
private final static String[] RESET_OPTIONS = new String[]{
"pull", "autoscroll", "swipenav", "doubletap", "expand_read", "autoexpand", "autoclose", "onclose",
"collapse", "autoread", "automove", "discard_delete", "authentication", "disable_tracking"
"collapse", "autoread", "automove", "discard_delete", "disable_tracking"
};
@Override
@ -82,7 +81,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoRead = view.findViewById(R.id.swAutoRead);
swAutoMove = view.findViewById(R.id.swAutoMove);
swDiscardDelete = view.findViewById(R.id.swDiscardDelete);
swAuthentication = view.findViewById(R.id.swAuthentication);
swDisableTracking = view.findViewById(R.id.swDisableTracking);
setOptions();
@ -186,13 +184,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swAuthentication.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("authentication", checked).apply();
}
});
swDisableTracking.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -268,7 +259,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoRead.setChecked(prefs.getBoolean("autoread", false));
swAutoMove.setChecked(!prefs.getBoolean("automove", false));
swDiscardDelete.setChecked(prefs.getBoolean("discard_delete", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swDisableTracking.setChecked(prefs.getBoolean("disable_tracking", true));
}
}

View File

@ -54,6 +54,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swIdenticons;
private SwitchCompat swCircular;
private SwitchCompat swNameEmail;
private SwitchCompat swAuthentication;
private SwitchCompat swSubjectTop;
private SwitchCompat swSubjectItalic;
private Spinner spSubjectEllipsize;
@ -73,7 +74,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "threading", "highlight_unread",
"avatars", "generated_icons", "identicons", "circular", "name_email", "subject_top", "subject_italic", "subject_ellipsize",
"avatars", "generated_icons", "identicons", "circular", "name_email",
"authentication", "subject_top", "subject_italic", "subject_ellipsize",
"flags", "preview", "preview_italic", "addresses", "attachments_alt",
"contrast", "monospaced", "inline_images", "collapse_quotes", "autocontent", "seekbar", "actionbar",
};
@ -99,6 +101,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);
swAuthentication = view.findViewById(R.id.swAuthentication);
swSubjectTop = view.findViewById(R.id.swSubjectTop);
swSubjectItalic = view.findViewById(R.id.swSubjectItalic);
spSubjectEllipsize = view.findViewById(R.id.spSubjectEllipsize);
@ -209,6 +212,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();
}
});
swSubjectTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -385,6 +395,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swIdenticons.setEnabled(swGeneratedIcons.isChecked());
swCircular.setChecked(prefs.getBoolean("circular", true));
swNameEmail.setChecked(prefs.getBoolean("name_email", false));
swAuthentication.setChecked(prefs.getBoolean("authentication", true));
swSubjectTop.setChecked(prefs.getBoolean("subject_top", false));
swSubjectItalic.setChecked(prefs.getBoolean("subject_italic", true));

View File

@ -202,30 +202,6 @@
app:layout_constraintTop_toBottomOf="@id/swAutoMove"
app:switchPadding="12dp" />
<ImageView
android:id="@+id/ivAuth"
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@string/title_legend_auth"
android:tint="@color/colorError"
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/swDiscardDelete"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDisableTracking"
android:layout_width="0dp"
@ -235,7 +211,7 @@
android:text="@string/title_advanced_tracking"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthentication"
app:layout_constraintTop_toBottomOf="@id/swDiscardDelete"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -181,6 +181,30 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNameEmail" />
<ImageView
android:id="@+id/ivAuth"
android:layout_width="21dp"
android:layout_height="21dp"
android:contentDescription="@string/title_legend_auth"
android:tint="@color/colorError"
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/tvNameEmailHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSubjectTop"
android:layout_width="0dp"
@ -190,7 +214,7 @@
android:text="@string/title_advanced_subject_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNameEmailHint"
app:layout_constraintTop_toBottomOf="@id/swAuthentication"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -241,6 +241,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_authentication">Show a warning when the receiving server could not authenticate the message</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_subject_elipsed">When needed, shorten the subject</string>
@ -269,7 +270,6 @@
<string name="title_advanced_autoread">Automatically mark messages read on moving messages</string>
<string name="title_advanced_automove">Confirm moving messages</string>
<string name="title_advanced_discard_delete">On discard draft permanently delete draft</string>
<string name="title_advanced_authentication">Show a warning when the receiving server could not authenticate the message</string>
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>
<string name="title_advanced_badge">Show launcher icon with number of new messages</string>