Improved display settings

This commit is contained in:
M66B 2020-03-11 09:25:45 +01:00
parent 4eadb534e7
commit f88a1c8064
3 changed files with 42 additions and 29 deletions

View File

@ -65,6 +65,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swThreading;
private SwitchCompat swIndentation;
private SwitchCompat swSeekbar;
private SwitchCompat swActionbar;
private SwitchCompat swHighlightUnread;
@ -105,18 +106,17 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swTextSize;
private SwitchCompat swCollapseQuotes;
private SwitchCompat swImagesInline;
private SwitchCompat swSeekbar;
private final static String[] RESET_OPTIONS = new String[]{
"theme", "startup", "cards", "date", "navbar_colorize", "landscape", "landscape3",
"threading", "indentation", "actionbar",
"threading", "indentation", "seekbar", "actionbar",
"highlight_unread", "color_stripe",
"avatars", "gravatars", "generated_icons", "identicons", "circular", "saturation", "brightness", "threshold",
"name_email", "prefer_contact", "distinguish_contacts", "authentication",
"subject_top", "font_size_sender", "font_size_subject", "subject_italic", "subject_ellipsize", "keywords_header",
"flags", "flags_background", "preview", "preview_italic", "preview_lines", "addresses", "attachments_alt",
"contrast", "monospaced", "text_color", "text_size",
"inline_images", "collapse_quotes", "seekbar"
"inline_images", "collapse_quotes"
};
@Override
@ -139,6 +139,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swThreading = view.findViewById(R.id.swThreading);
swIndentation = view.findViewById(R.id.swIndentation);
swSeekbar = view.findViewById(R.id.swSeekbar);
swActionbar = view.findViewById(R.id.swActionbar);
swHighlightUnread = view.findViewById(R.id.swHighlightUnread);
@ -178,7 +179,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextSize = view.findViewById(R.id.swTextSize);
swCollapseQuotes = view.findViewById(R.id.swCollapseQuotes);
swImagesInline = view.findViewById(R.id.swImagesInline);
swSeekbar = view.findViewById(R.id.swSeekbar);
setOptions();
@ -260,6 +260,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swSeekbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("seekbar", checked).apply();
}
});
swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -579,13 +586,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swSeekbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("seekbar", checked).apply();
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;
@ -657,6 +657,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swThreading.setChecked(prefs.getBoolean("threading", true));
swIndentation.setChecked(prefs.getBoolean("indentation", false));
swIndentation.setEnabled(swCards.isChecked());
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
swActionbar.setChecked(prefs.getBoolean("actionbar", true));
swHighlightUnread.setChecked(prefs.getBoolean("highlight_unread", true));
@ -724,7 +725,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swTextSize.setChecked(prefs.getBoolean("text_size", true));
swCollapseQuotes.setChecked(prefs.getBoolean("collapse_quotes", false));
swImagesInline.setChecked(prefs.getBoolean("inline_images", false));
swSeekbar.setChecked(prefs.getBoolean("seekbar", false));
updateColor();
}

View File

@ -219,6 +219,17 @@
app:layout_constraintTop_toBottomOf="@id/tvThreadingHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSeekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_seekbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swIndentation"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swActionbar"
android:layout_width="0dp"
@ -228,18 +239,18 @@
android:text="@string/title_advanced_actionbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swIndentation"
app:layout_constraintTop_toBottomOf="@id/swSeekbar"
app:switchPadding="12dp" />
<!-- message -->
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionMessage"
android:id="@+id/tvCaptionHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:text="@string/title_advanced_caption_message"
android:text="@string/title_advanced_caption_message_header"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -254,7 +265,7 @@
android:text="@string/title_advanced_highlight_unread"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionMessage"
app:layout_constraintTop_toBottomOf="@id/tvCaptionHeader"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -724,6 +735,18 @@
app:layout_constraintTop_toBottomOf="@id/swAddresses"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCaptionBody"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:text="@string/title_advanced_caption_message_body"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swAttachmentsAlt" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swContrast"
android:layout_width="0dp"
@ -732,7 +755,7 @@
android:text="@string/title_advanced_contrast"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAttachmentsAlt"
app:layout_constraintTop_toBottomOf="@id/tvCaptionBody"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
@ -803,16 +826,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swImagesInline" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSeekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_seekbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImagesInlineHint"
app:switchPadding="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -300,7 +300,8 @@
<string name="title_advanced_caption_general">General</string>
<string name="title_advanced_caption_conversation">Conversation</string>
<string name="title_advanced_caption_message">Message</string>
<string name="title_advanced_caption_message_header">Message header</string>
<string name="title_advanced_caption_message_body">Message body</string>
<string name="title_advanced_landscape">Use two columns in landscape mode</string>
<string name="title_advanced_landscape3">Allow fixed navigation menu in landscape mode</string>