Merge pull request #4590 from k9mail/integrate_font_size_settings
Integrate font size settings into general_settings.xml
This commit is contained in:
commit
17967c1af9
11 changed files with 207 additions and 652 deletions
|
@ -64,11 +64,6 @@
|
|||
android:theme="@style/Theme.K9.Dialog.Translucent.DayNight"
|
||||
/>
|
||||
|
||||
<activity
|
||||
android:name="com.fsck.k9.activity.setup.FontSizeSettings"
|
||||
android:configChanges="locale"
|
||||
android:label="@string/font_size_settings_title"/>
|
||||
|
||||
<activity
|
||||
android:name="com.fsck.k9.activity.setup.AccountSetupBasics"
|
||||
android:configChanges="locale"
|
||||
|
|
|
@ -90,11 +90,6 @@
|
|||
android:theme="@style/Theme.K9.Dialog.Translucent.DayNight"
|
||||
/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.setup.FontSizeSettings"
|
||||
android:configChanges="locale"
|
||||
android:label="@string/font_size_settings_title"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupBasics"
|
||||
android:configChanges="locale"
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
package com.fsck.k9.activity.setup;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
|
||||
import com.fsck.k9.FontSizes;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.Preferences;
|
||||
import com.fsck.k9.activity.K9PreferenceActivity;
|
||||
import com.fsck.k9.preferences.StorageEditor;
|
||||
import com.fsck.k9.ui.R;
|
||||
|
||||
|
||||
/**
|
||||
* Activity to configure the font size of the information displayed in the
|
||||
* account list, folder list, message list and in the message view.
|
||||
*
|
||||
* @see FontSizes
|
||||
*/
|
||||
public class FontSizeSettings extends K9PreferenceActivity {
|
||||
/*
|
||||
* Keys of the preferences defined in res/xml/font_preferences.xml
|
||||
*/
|
||||
private static final String PREFERENCE_ACCOUNT_NAME_FONT = "account_name_font";
|
||||
private static final String PREFERENCE_ACCOUNT_DESCRIPTION_FONT = "account_description_font";
|
||||
private static final String PREFERENCE_FOLDER_NAME_FONT = "folder_name_font";
|
||||
private static final String PREFERENCE_FOLDER_STATUS_FONT = "folder_status_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_SUBJECT_FONT = "message_list_subject_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_SENDER_FONT = "message_list_sender_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_DATE_FONT = "message_list_date_font";
|
||||
private static final String PREFERENCE_MESSAGE_LIST_PREVIEW_FONT = "message_list_preview_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_SENDER_FONT = "message_view_sender_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_TO_FONT = "message_view_to_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_CC_FONT = "message_view_cc_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_BCC_FONT = "message_view_bcc_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_ADDITIONAL_HEADERS_FONT = "message_view_additional_headers_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_SUBJECT_FONT = "message_view_subject_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_DATE_FONT = "message_view_date_font";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_CONTENT_FONT_SLIDER = "message_view_content_font_slider";
|
||||
private static final String PREFERENCE_MESSAGE_COMPOSE_INPUT_FONT = "message_compose_input_font";
|
||||
|
||||
private ListPreference mAccountName;
|
||||
private ListPreference mAccountDescription;
|
||||
private ListPreference mFolderName;
|
||||
private ListPreference mFolderStatus;
|
||||
private ListPreference mMessageListSubject;
|
||||
private ListPreference mMessageListSender;
|
||||
private ListPreference mMessageListDate;
|
||||
private ListPreference mMessageListPreview;
|
||||
private ListPreference mMessageViewSender;
|
||||
private ListPreference mMessageViewTo;
|
||||
private ListPreference mMessageViewCC;
|
||||
private ListPreference mMessageViewBCC;
|
||||
private ListPreference mMessageViewAdditionalHeaders;
|
||||
private ListPreference mMessageViewSubject;
|
||||
private ListPreference mMessageViewDate;
|
||||
private SliderPreference mMessageViewContentSlider;
|
||||
private ListPreference mMessageComposeInput;
|
||||
|
||||
private static final int FONT_PERCENT_MIN = 40;
|
||||
private static final int FONT_PERCENT_MAX = 250;
|
||||
|
||||
/**
|
||||
* Start the FontSizeSettings activity.
|
||||
*
|
||||
* @param context The application context.
|
||||
*/
|
||||
public static void actionEditSettings(Context context) {
|
||||
Intent i = new Intent(context, FontSizeSettings.class);
|
||||
context.startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FontSizes fontSizes = K9.getFontSizes();
|
||||
addPreferencesFromResource(R.xml.font_preferences);
|
||||
|
||||
mAccountName = setupListPreference(
|
||||
PREFERENCE_ACCOUNT_NAME_FONT,
|
||||
Integer.toString(fontSizes.getAccountName()));
|
||||
mAccountDescription = setupListPreference(
|
||||
PREFERENCE_ACCOUNT_DESCRIPTION_FONT,
|
||||
Integer.toString(fontSizes.getAccountDescription()));
|
||||
|
||||
mFolderName = setupListPreference(
|
||||
PREFERENCE_FOLDER_NAME_FONT,
|
||||
Integer.toString(fontSizes.getFolderName()));
|
||||
mFolderStatus = setupListPreference(
|
||||
PREFERENCE_FOLDER_STATUS_FONT,
|
||||
Integer.toString(fontSizes.getFolderStatus()));
|
||||
|
||||
mMessageListSubject = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_SUBJECT_FONT,
|
||||
Integer.toString(fontSizes.getMessageListSubject()));
|
||||
mMessageListSender = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_SENDER_FONT,
|
||||
Integer.toString(fontSizes.getMessageListSender()));
|
||||
mMessageListDate = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_DATE_FONT,
|
||||
Integer.toString(fontSizes.getMessageListDate()));
|
||||
mMessageListPreview = setupListPreference(
|
||||
PREFERENCE_MESSAGE_LIST_PREVIEW_FONT,
|
||||
Integer.toString(fontSizes.getMessageListPreview()));
|
||||
|
||||
mMessageViewSender = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_SENDER_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewSender()));
|
||||
mMessageViewTo = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_TO_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewTo()));
|
||||
mMessageViewCC = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_CC_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewCC()));
|
||||
mMessageViewBCC = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_BCC_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewBCC()));
|
||||
mMessageViewAdditionalHeaders = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_ADDITIONAL_HEADERS_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewAdditionalHeaders()));
|
||||
mMessageViewSubject = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_SUBJECT_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewSubject()));
|
||||
mMessageViewDate = setupListPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_DATE_FONT,
|
||||
Integer.toString(fontSizes.getMessageViewDate()));
|
||||
|
||||
mMessageViewContentSlider = (SliderPreference) findPreference(
|
||||
PREFERENCE_MESSAGE_VIEW_CONTENT_FONT_SLIDER);
|
||||
|
||||
final String summaryFormat = getString(R.string.font_size_message_view_content_summary);
|
||||
final String titleFormat = getString(R.string.font_size_message_view_content_dialog_title);
|
||||
mMessageViewContentSlider.setValue(scaleFromInt(fontSizes.getMessageViewContentAsPercent()));
|
||||
mMessageViewContentSlider.setOnPreferenceChangeListener(
|
||||
new Preference.OnPreferenceChangeListener() {
|
||||
// Show the preference value in the preference summary field.
|
||||
@Override
|
||||
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
|
||||
final SliderPreference slider = (SliderPreference) preference;
|
||||
final Float value = (Float) newValue;
|
||||
slider.setSummary(String.format(summaryFormat, scaleToInt(value)));
|
||||
slider.setDialogTitle(
|
||||
String.format(titleFormat, slider.getTitle(), slider.getSummary()));
|
||||
if (slider.getDialog() != null) {
|
||||
slider.getDialog().setTitle(slider.getDialogTitle());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
mMessageViewContentSlider.getOnPreferenceChangeListener().onPreferenceChange(
|
||||
mMessageViewContentSlider, mMessageViewContentSlider.getValue());
|
||||
|
||||
mMessageComposeInput = setupListPreference(
|
||||
PREFERENCE_MESSAGE_COMPOSE_INPUT_FONT,
|
||||
Integer.toString(fontSizes.getMessageComposeInput()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the global FontSize object and permanently store the (possibly
|
||||
* changed) font size settings.
|
||||
*/
|
||||
private void saveSettings() {
|
||||
FontSizes fontSizes = K9.getFontSizes();
|
||||
|
||||
fontSizes.setAccountName(Integer.parseInt(mAccountName.getValue()));
|
||||
fontSizes.setAccountDescription(Integer.parseInt(mAccountDescription.getValue()));
|
||||
|
||||
fontSizes.setFolderName(Integer.parseInt(mFolderName.getValue()));
|
||||
fontSizes.setFolderStatus(Integer.parseInt(mFolderStatus.getValue()));
|
||||
|
||||
fontSizes.setMessageListSubject(Integer.parseInt(mMessageListSubject.getValue()));
|
||||
fontSizes.setMessageListSender(Integer.parseInt(mMessageListSender.getValue()));
|
||||
fontSizes.setMessageListDate(Integer.parseInt(mMessageListDate.getValue()));
|
||||
fontSizes.setMessageListPreview(Integer.parseInt(mMessageListPreview.getValue()));
|
||||
|
||||
fontSizes.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue()));
|
||||
fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue()));
|
||||
fontSizes.setMessageViewCC(Integer.parseInt(mMessageViewCC.getValue()));
|
||||
fontSizes.setMessageViewBCC(Integer.parseInt(mMessageViewBCC.getValue()));
|
||||
fontSizes.setMessageViewAdditionalHeaders(Integer.parseInt(mMessageViewAdditionalHeaders.getValue()));
|
||||
fontSizes.setMessageViewSubject(Integer.parseInt(mMessageViewSubject.getValue()));
|
||||
fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue()));
|
||||
fontSizes.setMessageViewContentAsPercent(scaleToInt(mMessageViewContentSlider.getValue()));
|
||||
|
||||
fontSizes.setMessageComposeInput(Integer.parseInt(mMessageComposeInput.getValue()));
|
||||
|
||||
StorageEditor editor = Preferences.getPreferences(this).createStorageEditor();
|
||||
fontSizes.save(editor);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
private int scaleToInt(float sliderValue) {
|
||||
return (int) (FONT_PERCENT_MIN + sliderValue * (FONT_PERCENT_MAX - FONT_PERCENT_MIN));
|
||||
}
|
||||
|
||||
private float scaleFromInt(int value) {
|
||||
return (float) (value - FONT_PERCENT_MIN) / (FONT_PERCENT_MAX - FONT_PERCENT_MIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
saveSettings();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 Jay Weisskopf
|
||||
*
|
||||
* Licensed under the MIT License (see LICENSE.txt)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies
|
||||
* or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
* FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Source: https://github.com/jayschwa/AndroidSliderPreference
|
||||
*/
|
||||
|
||||
package com.fsck.k9.activity.setup;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.preference.DialogPreference;
|
||||
import androidx.annotation.ArrayRes;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.fsck.k9.ui.R;
|
||||
|
||||
|
||||
/**
|
||||
* @author Jay Weisskopf
|
||||
*/
|
||||
public class SliderPreference extends DialogPreference {
|
||||
private static final String STATE_KEY_SUPER = "super";
|
||||
private static final String STATE_KEY_SEEK_BAR_VALUE = "seek_bar_value";
|
||||
|
||||
protected final static int SEEKBAR_RESOLUTION = 10000;
|
||||
|
||||
protected float mValue;
|
||||
protected int mSeekBarValue;
|
||||
protected CharSequence[] mSummaries;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public SliderPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup(context, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
* @param defStyle
|
||||
*/
|
||||
public SliderPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setup(context, attrs);
|
||||
}
|
||||
|
||||
private void setup(Context context, AttributeSet attrs) {
|
||||
setDialogLayoutResource(R.layout.slider_preference_dialog);
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SliderPreference);
|
||||
try {
|
||||
setSummary(a.getTextArray(R.styleable.SliderPreference_android_summary));
|
||||
} catch (Exception e) {
|
||||
// Do nothing
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object onGetDefaultValue(TypedArray a, int index) {
|
||||
return a.getFloat(index, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
|
||||
setValue(restoreValue ? getPersistedFloat(mValue) : (Float) defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
if (mSummaries != null && mSummaries.length > 0) {
|
||||
int index = (int) (mValue * mSummaries.length);
|
||||
index = Math.min(index, mSummaries.length - 1);
|
||||
return mSummaries[index];
|
||||
} else {
|
||||
return super.getSummary();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSummary(CharSequence[] summaries) {
|
||||
mSummaries = summaries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSummary(CharSequence summary) {
|
||||
super.setSummary(summary);
|
||||
mSummaries = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSummary(@ArrayRes int summaryResId) {
|
||||
try {
|
||||
setSummary(getContext().getResources().getStringArray(summaryResId));
|
||||
} catch (Exception e) {
|
||||
super.setSummary(summaryResId);
|
||||
}
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return mValue;
|
||||
}
|
||||
|
||||
public void setValue(float value) {
|
||||
value = Math.max(0, Math.min(value, 1)); // clamp to [0, 1]
|
||||
if (shouldPersist()) {
|
||||
persistFloat(value);
|
||||
}
|
||||
if (value != mValue) {
|
||||
mValue = value;
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
mSeekBarValue = (int) (mValue * SEEKBAR_RESOLUTION);
|
||||
View view = super.onCreateDialogView();
|
||||
SeekBar seekbar = view.findViewById(R.id.slider_preference_seekbar);
|
||||
seekbar.setMax(SEEKBAR_RESOLUTION);
|
||||
seekbar.setProgress(mSeekBarValue);
|
||||
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (fromUser) {
|
||||
SliderPreference.this.mSeekBarValue = progress;
|
||||
callChangeListener((float) SliderPreference.this.mSeekBarValue / SEEKBAR_RESOLUTION);
|
||||
}
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDialogClosed(boolean positiveResult) {
|
||||
final float newValue = (float) mSeekBarValue / SEEKBAR_RESOLUTION;
|
||||
if (positiveResult && callChangeListener(newValue)) {
|
||||
setValue(newValue);
|
||||
} else {
|
||||
callChangeListener(mValue);
|
||||
}
|
||||
super.onDialogClosed(positiveResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
Parcelable superState = super.onSaveInstanceState();
|
||||
Bundle state = new Bundle();
|
||||
state.putParcelable(STATE_KEY_SUPER, superState);
|
||||
state.putInt(STATE_KEY_SEEK_BAR_VALUE, mSeekBarValue);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Parcelable state) {
|
||||
Bundle bundle = (Bundle) state;
|
||||
super.onRestoreInstanceState(bundle.getParcelable(STATE_KEY_SUPER));
|
||||
mSeekBarValue = bundle.getInt(STATE_KEY_SEEK_BAR_VALUE);
|
||||
|
||||
callChangeListener((float) mSeekBarValue / SEEKBAR_RESOLUTION);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@ import com.bytehamster.lib.preferencesearch.SearchPreferenceActionView
|
|||
import com.bytehamster.lib.preferencesearch.SearchPreferenceResult
|
||||
import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener
|
||||
import com.fsck.k9.activity.K9Activity
|
||||
import com.fsck.k9.activity.setup.FontSizeSettings
|
||||
import com.fsck.k9.ui.R
|
||||
import com.fsck.k9.ui.fragmentTransaction
|
||||
import com.fsck.k9.ui.fragmentTransactionWithBackStack
|
||||
|
@ -58,18 +57,14 @@ class GeneralSettingsActivity : K9Activity(), OnPreferenceStartScreenCallback, S
|
|||
searchPreferenceActionView.cancelSearch()
|
||||
searchPreferenceMenuItem.collapseActionView()
|
||||
|
||||
if (result.resourceFile == R.xml.font_preferences) {
|
||||
startActivity(Intent(this, FontSizeSettings::class.java))
|
||||
} else {
|
||||
val fragment = GeneralSettingsFragment.create(result.screen)
|
||||
fragmentTransaction {
|
||||
addToBackStack("Search result")
|
||||
replace(R.id.generalSettingsContainer, fragment)
|
||||
}
|
||||
|
||||
val accentColor = theme.resolveAttribute(R.attr.colorAccent)
|
||||
result.highlight(fragment as PreferenceFragmentCompat, accentColor)
|
||||
val fragment = GeneralSettingsFragment.create(result.screen)
|
||||
fragmentTransaction {
|
||||
addToBackStack("Search result")
|
||||
replace(R.id.generalSettingsContainer, fragment)
|
||||
}
|
||||
|
||||
val accentColor = theme.resolveAttribute(R.attr.colorAccent)
|
||||
result.highlight(fragment as PreferenceFragmentCompat, accentColor)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -87,12 +82,6 @@ class GeneralSettingsActivity : K9Activity(), OnPreferenceStartScreenCallback, S
|
|||
textNoResults = getString(R.string.preference_search_no_results)
|
||||
|
||||
index(R.xml.general_settings)
|
||||
with(index(R.xml.font_preferences)) {
|
||||
addBreadcrumb(R.string.general_settings_title)
|
||||
addBreadcrumb(R.string.display_preferences)
|
||||
addBreadcrumb(R.string.global_preferences)
|
||||
addBreadcrumb(R.string.font_size_settings_title)
|
||||
}
|
||||
}
|
||||
|
||||
searchPreferenceMenuItem.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
|
||||
|
|
|
@ -81,6 +81,7 @@ class GeneralSettingsDataStore(
|
|||
override fun getInt(key: String?, defValue: Int): Int {
|
||||
return when (key) {
|
||||
"messagelist_contact_name_color" -> K9.contactNameColor
|
||||
"message_view_content_font_slider" -> K9.fontSizes.messageViewContentAsPercent
|
||||
else -> defValue
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +89,7 @@ class GeneralSettingsDataStore(
|
|||
override fun putInt(key: String?, value: Int) {
|
||||
when (key) {
|
||||
"messagelist_contact_name_color" -> K9.contactNameColor = value
|
||||
"message_view_content_font_slider" -> K9.fontSizes.messageViewContentAsPercent = value
|
||||
else -> return
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,22 @@ class GeneralSettingsDataStore(
|
|||
"notification_hide_subject" -> K9.notificationHideSubject.name
|
||||
"quiet_time_starts" -> K9.quietTimeStarts
|
||||
"quiet_time_ends" -> K9.quietTimeEnds
|
||||
"account_name_font" -> K9.fontSizes.accountName.toString()
|
||||
"account_description_font" -> K9.fontSizes.accountDescription.toString()
|
||||
"folder_name_font" -> K9.fontSizes.folderName.toString()
|
||||
"folder_status_font" -> K9.fontSizes.folderStatus.toString()
|
||||
"message_list_subject_font" -> K9.fontSizes.messageListSubject.toString()
|
||||
"message_list_sender_font" -> K9.fontSizes.messageListSender.toString()
|
||||
"message_list_date_font" -> K9.fontSizes.messageListDate.toString()
|
||||
"message_list_preview_font" -> K9.fontSizes.messageListPreview.toString()
|
||||
"message_view_sender_font" -> K9.fontSizes.messageViewSender.toString()
|
||||
"message_view_to_font" -> K9.fontSizes.messageViewTo.toString()
|
||||
"message_view_cc_font" -> K9.fontSizes.messageViewCC.toString()
|
||||
"message_view_bcc_font" -> K9.fontSizes.messageViewBCC.toString()
|
||||
"message_view_subject_font" -> K9.fontSizes.messageViewSubject.toString()
|
||||
"message_view_date_font" -> K9.fontSizes.messageViewDate.toString()
|
||||
"message_view_additional_headers_font" -> K9.fontSizes.messageViewAdditionalHeaders.toString()
|
||||
"message_compose_input_font" -> K9.fontSizes.messageComposeInput.toString()
|
||||
else -> defValue
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +150,22 @@ class GeneralSettingsDataStore(
|
|||
"notification_hide_subject" -> K9.notificationHideSubject = K9.NotificationHideSubject.valueOf(value)
|
||||
"quiet_time_starts" -> K9.quietTimeStarts = value
|
||||
"quiet_time_ends" -> K9.quietTimeEnds = value
|
||||
"account_name_font" -> K9.fontSizes.accountName = value.toInt()
|
||||
"account_description_font" -> K9.fontSizes.accountDescription = value.toInt()
|
||||
"folder_name_font" -> K9.fontSizes.folderName = value.toInt()
|
||||
"folder_status_font" -> K9.fontSizes.folderStatus = value.toInt()
|
||||
"message_list_subject_font" -> K9.fontSizes.messageListSubject = value.toInt()
|
||||
"message_list_sender_font" -> K9.fontSizes.messageListSender = value.toInt()
|
||||
"message_list_date_font" -> K9.fontSizes.messageListDate = value.toInt()
|
||||
"message_list_preview_font" -> K9.fontSizes.messageListPreview = value.toInt()
|
||||
"message_view_sender_font" -> K9.fontSizes.messageViewSender = value.toInt()
|
||||
"message_view_to_font" -> K9.fontSizes.messageViewTo = value.toInt()
|
||||
"message_view_cc_font" -> K9.fontSizes.messageViewCC = value.toInt()
|
||||
"message_view_bcc_font" -> K9.fontSizes.messageViewBCC = value.toInt()
|
||||
"message_view_subject_font" -> K9.fontSizes.messageViewSubject = value.toInt()
|
||||
"message_view_date_font" -> K9.fontSizes.messageViewDate = value.toInt()
|
||||
"message_view_additional_headers_font" -> K9.fontSizes.messageViewAdditionalHeaders = value.toInt()
|
||||
"message_compose_input_font" -> K9.fontSizes.messageComposeInput = value.toInt()
|
||||
else -> return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2012 Jay Weisskopf
|
||||
|
||||
Licensed under the MIT License (see LICENSE.txt)
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/slider_preference_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:paddingTop="8dip" >
|
||||
|
||||
<TextView
|
||||
android:id="@+android:id/message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/slider_preference_seekbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="12dip"
|
||||
android:paddingTop="12dip" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="application_id" translatable="false">com.fsck.k9</string>
|
||||
</resources>
|
|
@ -105,10 +105,6 @@
|
|||
<attr name="openpgp_dark_grey" format="reference|color" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="SliderPreference">
|
||||
<attr name="android:summary" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="FoldableLinearLayout">
|
||||
<attr name="foldedLabel" format="string" />
|
||||
<attr name="unFoldedLabel" format="string" />
|
||||
|
|
|
@ -1,175 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Make sure to add android:persistent="false" to all preferences to disable saving
|
||||
the preference values to SharedPreferences. We use our own storage mechanism for
|
||||
the preferences. See com.fsck.k9.preferences.Storage.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_account_list"
|
||||
android:key="account_list_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="account_name_font"
|
||||
android:title="@string/font_size_account_name"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_account_name" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="account_description_font"
|
||||
android:title="@string/font_size_account_description"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_account_description" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_folder_list"
|
||||
android:key="folder_list_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="folder_name_font"
|
||||
android:title="@string/font_size_folder_name"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_folder_name" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="folder_status_font"
|
||||
android:title="@string/font_size_folder_status"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_folder_status" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_list"
|
||||
android:key="message_list_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_list_subject_font"
|
||||
android:title="@string/font_size_message_list_subject"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_subject" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_list_sender_font"
|
||||
android:title="@string/font_size_message_list_sender"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_sender" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_list_date_font"
|
||||
android:title="@string/font_size_message_list_date"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_date" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_list_preview_font"
|
||||
android:title="@string/font_size_message_list_preview"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_preview" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_view"
|
||||
android:key="message_view_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_sender_font"
|
||||
android:title="@string/font_size_message_view_sender"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_sender" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_to_font"
|
||||
android:title="@string/font_size_message_view_to"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_to" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_cc_font"
|
||||
android:title="@string/font_size_message_view_cc"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_cc" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_bcc_font"
|
||||
android:title="@string/font_size_message_view_bcc"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_bcc" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_subject_font"
|
||||
android:title="@string/font_size_message_view_subject"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_subject" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_date_font"
|
||||
android:title="@string/font_size_message_view_date"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_date" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_additional_headers_font"
|
||||
android:title="@string/font_size_message_view_additional_headers"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_additional_headers" />
|
||||
|
||||
<com.fsck.k9.activity.setup.SliderPreference
|
||||
android:persistent="false"
|
||||
android:key="message_view_content_font_slider"
|
||||
android:title="@string/font_size_message_view_content"
|
||||
android:dialogTitle="@string/font_size_message_view_content" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_compose"
|
||||
android:key="message_compose_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="message_compose_input_font"
|
||||
android:title="@string/font_size_message_compose_input"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_compose_input" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -61,16 +61,177 @@
|
|||
search:summary=""
|
||||
android:title="@string/settings_compose_theme_label" />
|
||||
|
||||
<Preference
|
||||
<PreferenceScreen
|
||||
android:key="font_size"
|
||||
android:summary="@string/font_size_settings_description"
|
||||
android:title="@string/font_size_settings_title">
|
||||
|
||||
<intent
|
||||
android:targetClass="com.fsck.k9.activity.setup.FontSizeSettings"
|
||||
android:targetPackage="@string/application_id" />
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_account_list"
|
||||
android:key="account_list_fonts">
|
||||
|
||||
</Preference>
|
||||
<ListPreference
|
||||
android:key="account_name_font"
|
||||
android:title="@string/font_size_account_name"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_account_name" />
|
||||
|
||||
<ListPreference
|
||||
android:key="account_description_font"
|
||||
android:title="@string/font_size_account_description"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_account_description" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_folder_list"
|
||||
android:key="folder_list_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:key="folder_name_font"
|
||||
android:title="@string/font_size_folder_name"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_folder_name" />
|
||||
|
||||
<ListPreference
|
||||
android:key="folder_status_font"
|
||||
android:title="@string/font_size_folder_status"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_folder_status" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_list"
|
||||
android:key="message_list_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:key="message_list_subject_font"
|
||||
android:title="@string/font_size_message_list_subject"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_subject" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_list_sender_font"
|
||||
android:title="@string/font_size_message_list_sender"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_sender" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_list_date_font"
|
||||
android:title="@string/font_size_message_list_date"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_date" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_list_preview_font"
|
||||
android:title="@string/font_size_message_list_preview"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_list_preview" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_view"
|
||||
android:key="message_view_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_sender_font"
|
||||
android:title="@string/font_size_message_view_sender"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_sender" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_to_font"
|
||||
android:title="@string/font_size_message_view_to"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_to" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_cc_font"
|
||||
android:title="@string/font_size_message_view_cc"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_cc" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_bcc_font"
|
||||
android:title="@string/font_size_message_view_bcc"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_bcc" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_subject_font"
|
||||
android:title="@string/font_size_message_view_subject"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_subject" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_date_font"
|
||||
android:title="@string/font_size_message_view_date"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_date" />
|
||||
|
||||
<ListPreference
|
||||
android:key="message_view_additional_headers_font"
|
||||
android:title="@string/font_size_message_view_additional_headers"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_view_additional_headers" />
|
||||
|
||||
<SeekBarPreference
|
||||
android:key="message_view_content_font_slider"
|
||||
android:title="@string/font_size_message_view_content"
|
||||
app:showSeekBarValue="true"
|
||||
app:min="40"
|
||||
android:max="250" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/font_size_message_compose"
|
||||
android:key="message_compose_fonts">
|
||||
|
||||
<ListPreference
|
||||
android:key="message_compose_input_font"
|
||||
android:title="@string/font_size_message_compose_input"
|
||||
android:summary="%s"
|
||||
android:entries="@array/font_entries"
|
||||
android:entryValues="@array/font_values"
|
||||
android:dialogTitle="@string/font_size_message_compose_input" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="animations"
|
||||
|
|
Loading…
Reference in a new issue