mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Added preference screen to pick font sizes for all important information in account list, folder list, message list and message view.
Fixes issue 7
This commit is contained in:
parent
cb4504cc33
commit
f8695f9a61
@ -56,6 +56,11 @@
|
|||||||
android:label="@string/prefs_title"
|
android:label="@string/prefs_title"
|
||||||
>
|
>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="com.fsck.k9.activity.setup.FontSizeSettings"
|
||||||
|
android:label="@string/font_size_settings_title"
|
||||||
|
>
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.setup.AccountSetupBasics"
|
android:name="com.fsck.k9.activity.setup.AccountSetupBasics"
|
||||||
android:label="@string/account_setup_basics_title"
|
android:label="@string/account_setup_basics_title"
|
||||||
|
@ -263,4 +263,45 @@
|
|||||||
<item>@string/date_format_iso8601</item>
|
<item>@string/date_format_iso8601</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
|
<string-array name="font_entries">
|
||||||
|
<item>@string/font_size_tiniest</item>
|
||||||
|
<item>@string/font_size_tiny</item>
|
||||||
|
<item>@string/font_size_smaller</item>
|
||||||
|
<item>@string/font_size_small</item>
|
||||||
|
<item>@string/font_size_medium</item>
|
||||||
|
<item>@string/font_size_large</item>
|
||||||
|
<item>@string/font_size_larger</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="font_values">
|
||||||
|
<item>10</item>
|
||||||
|
<item>12</item>
|
||||||
|
<item>14</item>
|
||||||
|
<item>16</item>
|
||||||
|
<item>18</item>
|
||||||
|
<item>20</item>
|
||||||
|
<item>22</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="font_entries_webview">
|
||||||
|
<item>@string/font_size_webview_smaller</item>
|
||||||
|
<item>@string/font_size_webview_small</item>
|
||||||
|
<item>@string/font_size_webview_normal</item>
|
||||||
|
<item>@string/font_size_webview_large</item>
|
||||||
|
<item>@string/font_size_webview_larger</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Be sure to also change FontSizes.getMessageViewContentAsInt() and
|
||||||
|
FontSizes.setMessageViewContent() if you change this.
|
||||||
|
-->
|
||||||
|
<string-array name="font_values_webview">
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -712,4 +712,44 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
|
|
||||||
<string name="remote_control_label">K-9 Mail remote control</string>
|
<string name="remote_control_label">K-9 Mail remote control</string>
|
||||||
<string name="remote_control_desc">Allows this application to control K-9 Mail activities and settings.</string>
|
<string name="remote_control_desc">Allows this application to control K-9 Mail activities and settings.</string>
|
||||||
|
|
||||||
|
<string name="font_size_settings_title">Font size</string>
|
||||||
|
<string name="font_size_settings_description">Configure font size</string>
|
||||||
|
|
||||||
|
<string name="font_size_account_list">Account list</string>
|
||||||
|
<string name="font_size_account_name">Account name</string>
|
||||||
|
<string name="font_size_account_description">Account description</string>
|
||||||
|
|
||||||
|
<string name="font_size_folder_list">Folder list</string>
|
||||||
|
<string name="font_size_folder_name">Folder name</string>
|
||||||
|
<string name="font_size_folder_status">Folder status</string>
|
||||||
|
|
||||||
|
<string name="font_size_message_list">Message list</string>
|
||||||
|
<string name="font_size_message_list_subject">Message subject</string>
|
||||||
|
<string name="font_size_message_list_sender">Message sender</string>
|
||||||
|
<string name="font_size_message_list_date">Message date</string>
|
||||||
|
|
||||||
|
<string name="font_size_message_view">Message view</string>
|
||||||
|
<string name="font_size_message_view_sender">Message sender</string>
|
||||||
|
<string name="font_size_message_view_to">Message receiver (To)</string>
|
||||||
|
<string name="font_size_message_view_cc">Message receiver (CC)</string>
|
||||||
|
<string name="font_size_message_view_subject">Message subject</string>
|
||||||
|
<string name="font_size_message_view_time">Message time</string>
|
||||||
|
<string name="font_size_message_view_date">Message date</string>
|
||||||
|
<string name="font_size_message_view_content">Message content</string>
|
||||||
|
|
||||||
|
<string name="font_size_tiniest">Tiniest</string>
|
||||||
|
<string name="font_size_tiny">Tiny</string>
|
||||||
|
<string name="font_size_smaller">Smaller</string>
|
||||||
|
<string name="font_size_small">Small</string>
|
||||||
|
<string name="font_size_medium">Medium</string>
|
||||||
|
<string name="font_size_large">Large</string>
|
||||||
|
<string name="font_size_larger">Larger</string>
|
||||||
|
|
||||||
|
<string name="font_size_webview_smaller">Smallest</string>
|
||||||
|
<string name="font_size_webview_small">Smaller</string>
|
||||||
|
<string name="font_size_webview_normal">Normal</string>
|
||||||
|
<string name="font_size_webview_large">Larger</string>
|
||||||
|
<string name="font_size_webview_larger">Largest</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
119
res/xml/font_preferences.xml
Normal file
119
res/xml/font_preferences.xml
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<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: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: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: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: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: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: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: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" />
|
||||||
|
|
||||||
|
</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: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: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:entries="@array/font_entries"
|
||||||
|
android:entryValues="@array/font_values"
|
||||||
|
android:dialogTitle="@string/font_size_message_view_cc" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
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:key="message_view_time_font"
|
||||||
|
android:title="@string/font_size_message_view_time"
|
||||||
|
android:entries="@array/font_entries"
|
||||||
|
android:entryValues="@array/font_values"
|
||||||
|
android:dialogTitle="@string/font_size_message_view_time" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
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:key="message_view_content_font"
|
||||||
|
android:title="@string/font_size_message_view_content"
|
||||||
|
android:entries="@array/font_entries_webview"
|
||||||
|
android:entryValues="@array/font_values_webview"
|
||||||
|
android:dialogTitle="@string/font_size_message_view_content" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@ -25,6 +25,12 @@
|
|||||||
android:entryValues="@array/settings_theme_values"
|
android:entryValues="@array/settings_theme_values"
|
||||||
android:dialogTitle="@string/settings_theme_label" />
|
android:dialogTitle="@string/settings_theme_label" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="font_size"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/font_size_settings_title"
|
||||||
|
android:summary="@string/font_size_settings_description" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="dateFormat"
|
android:key="dateFormat"
|
||||||
android:title="@string/date_format_label"
|
android:title="@string/date_format_label"
|
||||||
@ -35,25 +41,31 @@
|
|||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="animations"
|
android:key="animations"
|
||||||
android:title="@string/animations_title"
|
android:title="@string/animations_title"
|
||||||
android:summary="@string/animations_summary"
|
android:summary="@string/animations_summary" />
|
||||||
/>
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="gestures"
|
android:key="gestures"
|
||||||
android:title="@string/gestures_title"
|
android:title="@string/gestures_title"
|
||||||
android:summary="@string/gestures_summary"
|
android:summary="@string/gestures_summary" />
|
||||||
/>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/accountlist_preferences" android:key="accountlist_preferences">
|
<PreferenceCategory android:title="@string/accountlist_preferences" android:key="accountlist_preferences">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="measure_accounts"
|
android:key="measure_accounts"
|
||||||
android:title="@string/measure_accounts_title"
|
android:title="@string/measure_accounts_title"
|
||||||
android:summary="@string/measure_accounts_summary" />
|
android:summary="@string/measure_accounts_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="count_search"
|
android:key="count_search"
|
||||||
android:title="@string/count_search_title"
|
android:title="@string/count_search_title"
|
||||||
android:summary="@string/count_search_summary" />
|
android:summary="@string/count_search_summary" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/messagelist_preferences" android:key="messagelist_preferences">
|
<PreferenceCategory android:title="@string/messagelist_preferences" android:key="messagelist_preferences">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="messagelist_touchable"
|
android:key="messagelist_touchable"
|
||||||
android:title="@string/global_settings_touchable_label" />
|
android:title="@string/global_settings_touchable_label" />
|
||||||
@ -61,23 +73,24 @@
|
|||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="messagelist_stars"
|
android:key="messagelist_stars"
|
||||||
android:title="@string/global_settings_flag_label"
|
android:title="@string/global_settings_flag_label"
|
||||||
android:summary="@string/global_settings_flag_summary"
|
android:summary="@string/global_settings_flag_summary" />
|
||||||
/>
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="messagelist_checkboxes"
|
android:key="messagelist_checkboxes"
|
||||||
android:title="@string/global_settings_checkbox_label"
|
android:title="@string/global_settings_checkbox_label"
|
||||||
android:summary="@string/global_settings_checkbox_summary"
|
android:summary="@string/global_settings_checkbox_summary" />
|
||||||
/>
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences">
|
<PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="background_ops"
|
android:key="background_ops"
|
||||||
android:title="@string/background_ops_label"
|
android:title="@string/background_ops_label"
|
||||||
android:entries="@array/background_ops_entries"
|
android:entries="@array/background_ops_entries"
|
||||||
android:entryValues="@array/background_ops_values"
|
android:entryValues="@array/background_ops_values"
|
||||||
android:dialogTitle="@string/background_ops_label" />
|
android:dialogTitle="@string/background_ops_label" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/debug_preferences" android:key="debug_preferences">
|
<PreferenceCategory android:title="@string/debug_preferences" android:key="debug_preferences">
|
||||||
@ -85,12 +98,13 @@
|
|||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="debug_logging"
|
android:key="debug_logging"
|
||||||
android:title="@string/debug_enable_debug_logging_title"
|
android:title="@string/debug_enable_debug_logging_title"
|
||||||
android:summary="@string/debug_enable_debug_logging_summary"
|
android:summary="@string/debug_enable_debug_logging_summary" />
|
||||||
/>
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="sensitive_logging"
|
android:key="sensitive_logging"
|
||||||
android:title="@string/debug_enable_sensitive_logging_title"
|
android:title="@string/debug_enable_sensitive_logging_title"
|
||||||
android:summary="@string/debug_enable_sensitive_logging_summary"
|
android:summary="@string/debug_enable_sensitive_logging_summary" />
|
||||||
/>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
348
src/com/fsck/k9/FontSizes.java
Normal file
348
src/com/fsck/k9/FontSizes.java
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
package com.fsck.k9;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.webkit.WebSettings.TextSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage font size of the information displayed in the account list, folder
|
||||||
|
* list, message list and in the message view.
|
||||||
|
*/
|
||||||
|
public class FontSizes
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Keys for the preference storage.
|
||||||
|
*/
|
||||||
|
private static final String ACCOUNT_NAME = "fontSizeAccountName";
|
||||||
|
private static final String ACCOUNT_DESCRIPTION = "fontSizeAccountDescription";
|
||||||
|
private static final String FOLDER_NAME = "fontSizeFolderName";
|
||||||
|
private static final String FOLDER_STATUS = "fontSizeFolderStatus";
|
||||||
|
private static final String MESSAGE_LIST_SUBJECT = "fontSizeMessageListSubject";
|
||||||
|
private static final String MESSAGE_LIST_SENDER = "fontSizeMessageListSender";
|
||||||
|
private static final String MESSAGE_LIST_DATE = "fontSizeMessageListDate";
|
||||||
|
private static final String MESSAGE_VIEW_SENDER = "fontSizeMessageViewSender";
|
||||||
|
private static final String MESSAGE_VIEW_TO = "fontSizeMessageViewTo";
|
||||||
|
private static final String MESSAGE_VIEW_CC = "fontSizeMessageViewCC";
|
||||||
|
private static final String MESSAGE_VIEW_SUBJECT = "fontSizeMessageViewSubject";
|
||||||
|
private static final String MESSAGE_VIEW_TIME = "fontSizeMessageViewTime";
|
||||||
|
private static final String MESSAGE_VIEW_DATE = "fontSizeMessageViewDate";
|
||||||
|
private static final String MESSAGE_VIEW_CONTENT = "fontSizeMessageViewContent";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Values for the font sizes in DIP (device independent pixel)
|
||||||
|
*/
|
||||||
|
public static final int FONT_10DIP = 10;
|
||||||
|
public static final int FONT_12DIP = 12;
|
||||||
|
public static final int SMALL = 14; // ?android:attr/textAppearanceSmall
|
||||||
|
public static final int FONT_16DIP = 16;
|
||||||
|
public static final int MEDIUM = 18; // ?android:attr/textAppearanceMedium
|
||||||
|
public static final int FONT_20DIP = 20;
|
||||||
|
public static final int LARGE = 22; // ?android:attr/textAppearanceLarge
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of account names in the account list activity.
|
||||||
|
*/
|
||||||
|
private int accountName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of account descriptions in the account list activity.
|
||||||
|
*/
|
||||||
|
private int accountDescription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of folder names in the folder list activity.
|
||||||
|
*/
|
||||||
|
private int folderName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the folder status in the folder list activity.
|
||||||
|
*/
|
||||||
|
private int folderStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of message subjects in the message list activity.
|
||||||
|
*/
|
||||||
|
private int messageListSubject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of message senders in the message list activity.
|
||||||
|
*/
|
||||||
|
private int messageListSender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of message dates in the message list activity.
|
||||||
|
*/
|
||||||
|
private int messageListDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message sender in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewSender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message receiver(s) (To) in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message receiver(s) (CC) in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewCC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message subject in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewSubject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message time in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message date in the message view activity.
|
||||||
|
*/
|
||||||
|
private int messageViewDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Font size of the message content in the message view activity.
|
||||||
|
*
|
||||||
|
* Note: The unit is WebSettings.TextSize
|
||||||
|
*/
|
||||||
|
private TextSize messageViewContent = TextSize.NORMAL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a <code>FontSizes</code> object with default values.
|
||||||
|
*/
|
||||||
|
public FontSizes()
|
||||||
|
{
|
||||||
|
accountName = MEDIUM;
|
||||||
|
accountDescription = SMALL;
|
||||||
|
|
||||||
|
folderName = LARGE;
|
||||||
|
folderStatus = SMALL;
|
||||||
|
|
||||||
|
messageListSubject = SMALL;
|
||||||
|
messageListSender = SMALL;
|
||||||
|
messageListDate = SMALL;
|
||||||
|
|
||||||
|
messageViewSender = SMALL;
|
||||||
|
messageViewTo = FONT_12DIP;
|
||||||
|
messageViewCC = FONT_12DIP;
|
||||||
|
messageViewSubject = FONT_12DIP;
|
||||||
|
messageViewTime = FONT_10DIP;
|
||||||
|
messageViewDate = FONT_10DIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permanently save the font size settings.
|
||||||
|
*
|
||||||
|
* @param editor Used to save the font size settings.
|
||||||
|
*/
|
||||||
|
public void save(SharedPreferences.Editor editor)
|
||||||
|
{
|
||||||
|
editor.putInt(ACCOUNT_NAME, accountName);
|
||||||
|
editor.putInt(ACCOUNT_DESCRIPTION, accountDescription);
|
||||||
|
|
||||||
|
editor.putInt(FOLDER_NAME, folderName);
|
||||||
|
editor.putInt(FOLDER_STATUS, folderStatus);
|
||||||
|
|
||||||
|
editor.putInt(MESSAGE_LIST_SUBJECT, messageListSubject);
|
||||||
|
editor.putInt(MESSAGE_LIST_SENDER, messageListSender);
|
||||||
|
editor.putInt(MESSAGE_LIST_DATE, messageListDate);
|
||||||
|
|
||||||
|
editor.putInt(MESSAGE_VIEW_SUBJECT, messageViewSubject);
|
||||||
|
editor.putInt(MESSAGE_VIEW_TO, messageViewTo);
|
||||||
|
editor.putInt(MESSAGE_VIEW_CC, messageViewCC);
|
||||||
|
editor.putInt(MESSAGE_VIEW_SENDER, messageViewSender);
|
||||||
|
editor.putInt(MESSAGE_VIEW_TIME, messageViewTime);
|
||||||
|
editor.putInt(MESSAGE_VIEW_DATE, messageViewDate);
|
||||||
|
editor.putInt(MESSAGE_VIEW_CONTENT, getMessageViewContentAsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the font size settings from permanent storage.
|
||||||
|
*
|
||||||
|
* @param prefs Used to load the font size settings.
|
||||||
|
*/
|
||||||
|
public void load(SharedPreferences prefs)
|
||||||
|
{
|
||||||
|
accountName = prefs.getInt(ACCOUNT_NAME, accountName);
|
||||||
|
accountDescription = prefs.getInt(ACCOUNT_DESCRIPTION, accountDescription);
|
||||||
|
|
||||||
|
folderName = prefs.getInt(FOLDER_NAME, folderName);
|
||||||
|
folderStatus = prefs.getInt(FOLDER_STATUS, folderStatus);
|
||||||
|
|
||||||
|
messageListSubject = prefs.getInt(MESSAGE_LIST_SUBJECT, messageListSubject);
|
||||||
|
messageListSender = prefs.getInt(MESSAGE_LIST_SENDER, messageListSender);
|
||||||
|
messageListDate = prefs.getInt(MESSAGE_LIST_DATE, messageListDate);
|
||||||
|
|
||||||
|
messageViewSubject = prefs.getInt(MESSAGE_VIEW_SENDER, FONT_12DIP);
|
||||||
|
messageViewTo = prefs.getInt(MESSAGE_VIEW_TO, messageViewTo);
|
||||||
|
messageViewCC = prefs.getInt(MESSAGE_VIEW_CC, messageViewCC);
|
||||||
|
messageViewSender = prefs.getInt(MESSAGE_VIEW_SUBJECT, messageViewSender);
|
||||||
|
messageViewTime = prefs.getInt(MESSAGE_VIEW_TIME, messageViewTime);
|
||||||
|
messageViewDate = prefs.getInt(MESSAGE_VIEW_DATE, messageViewDate);
|
||||||
|
setMessageViewContent(prefs.getInt(MESSAGE_VIEW_CONTENT, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAccountName()
|
||||||
|
{
|
||||||
|
return accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountName(int accountName)
|
||||||
|
{
|
||||||
|
this.accountName = accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAccountDescription()
|
||||||
|
{
|
||||||
|
return accountDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountDescription(int accountDescription)
|
||||||
|
{
|
||||||
|
this.accountDescription = accountDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFolderName()
|
||||||
|
{
|
||||||
|
return folderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolderName(int folderName)
|
||||||
|
{
|
||||||
|
this.folderName = folderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFolderStatus()
|
||||||
|
{
|
||||||
|
return folderStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolderStatus(int folderStatus)
|
||||||
|
{
|
||||||
|
this.folderStatus = folderStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageListSubject()
|
||||||
|
{
|
||||||
|
return messageListSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageListSubject(int messageListSubject)
|
||||||
|
{
|
||||||
|
this.messageListSubject = messageListSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageListSender()
|
||||||
|
{
|
||||||
|
return messageListSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageListSender(int messageListSender)
|
||||||
|
{
|
||||||
|
this.messageListSender = messageListSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageListDate()
|
||||||
|
{
|
||||||
|
return messageListDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageListDate(int messageListDate)
|
||||||
|
{
|
||||||
|
this.messageListDate = messageListDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewSender()
|
||||||
|
{
|
||||||
|
return messageViewSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewSender(int messageViewSender)
|
||||||
|
{
|
||||||
|
this.messageViewSender = messageViewSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewTo()
|
||||||
|
{
|
||||||
|
return messageViewTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewTo(int messageViewTo)
|
||||||
|
{
|
||||||
|
this.messageViewTo = messageViewTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewCC()
|
||||||
|
{
|
||||||
|
return messageViewCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewCC(int messageViewCC)
|
||||||
|
{
|
||||||
|
this.messageViewCC = messageViewCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewSubject()
|
||||||
|
{
|
||||||
|
return messageViewSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewSubject(int messageViewSubject)
|
||||||
|
{
|
||||||
|
this.messageViewSubject = messageViewSubject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewTime()
|
||||||
|
{
|
||||||
|
return messageViewTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewTime(int messageViewTime)
|
||||||
|
{
|
||||||
|
this.messageViewTime = messageViewTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewDate()
|
||||||
|
{
|
||||||
|
return messageViewDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewDate(int messageViewDate)
|
||||||
|
{
|
||||||
|
this.messageViewDate = messageViewDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextSize getMessageViewContent()
|
||||||
|
{
|
||||||
|
return messageViewContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMessageViewContentAsInt()
|
||||||
|
{
|
||||||
|
switch (messageViewContent)
|
||||||
|
{
|
||||||
|
case SMALLEST: return 1;
|
||||||
|
case SMALLER: return 2;
|
||||||
|
default:
|
||||||
|
case NORMAL: return 3;
|
||||||
|
case LARGER: return 4;
|
||||||
|
case LARGEST: return 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageViewContent(int size)
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case 1: messageViewContent = TextSize.SMALLEST; break;
|
||||||
|
case 2: messageViewContent = TextSize.SMALLER; break;
|
||||||
|
case 3: messageViewContent = TextSize.NORMAL; break;
|
||||||
|
case 4: messageViewContent = TextSize.LARGER; break;
|
||||||
|
case 5: messageViewContent = TextSize.LARGEST; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,8 @@ public class K9 extends Application
|
|||||||
|
|
||||||
private static int theme = android.R.style.Theme_Light;
|
private static int theme = android.R.style.Theme_Light;
|
||||||
|
|
||||||
|
private static final FontSizes fontSizes = new FontSizes();
|
||||||
|
|
||||||
private static BACKGROUND_OPS backgroundOps = BACKGROUND_OPS.WHEN_CHECKED;
|
private static BACKGROUND_OPS backgroundOps = BACKGROUND_OPS.WHEN_CHECKED;
|
||||||
/**
|
/**
|
||||||
* Some log messages can be sent to a file, so that the logs
|
* Some log messages can be sent to a file, so that the logs
|
||||||
@ -327,6 +329,8 @@ public class K9 extends Application
|
|||||||
editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes);
|
editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes);
|
||||||
editor.putBoolean("messageListTouchable",mMessageListTouchable);
|
editor.putBoolean("messageListTouchable",mMessageListTouchable);
|
||||||
editor.putInt("theme", theme);
|
editor.putInt("theme", theme);
|
||||||
|
|
||||||
|
fontSizes.save(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -346,6 +350,7 @@ public class K9 extends Application
|
|||||||
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false);
|
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false);
|
||||||
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
|
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
|
||||||
|
|
||||||
|
fontSizes.load(sprefs);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -542,6 +547,11 @@ public class K9 extends Application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FontSizes getFontSizes()
|
||||||
|
{
|
||||||
|
return fontSizes;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean measureAccounts()
|
public static boolean measureAccounts()
|
||||||
{
|
{
|
||||||
return mMeasureAccounts;
|
return mMeasureAccounts;
|
||||||
|
@ -11,6 +11,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@ -45,7 +46,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
private SearchAccount flaggedAccount = null;
|
private SearchAccount flaggedAccount = null;
|
||||||
private SearchAccount integratedInboxAccount = null;
|
private SearchAccount integratedInboxAccount = null;
|
||||||
private SearchAccount integratedInboxStarredAccount = null;
|
private SearchAccount integratedInboxStarredAccount = null;
|
||||||
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
class AccountsHandler extends Handler
|
class AccountsHandler extends Handler
|
||||||
{
|
{
|
||||||
@ -853,6 +854,9 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
holder.chip.getBackground().setAlpha(0);
|
holder.chip.getBackground().setAlpha(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
||||||
|
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import android.os.PowerManager;
|
|||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.util.Config;
|
import android.util.Config;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
@ -65,6 +66,8 @@ public class FolderList extends K9ListActivity
|
|||||||
private int mUnreadMessageCount;
|
private int mUnreadMessageCount;
|
||||||
private int mFlaggedMessageCount;
|
private int mFlaggedMessageCount;
|
||||||
|
|
||||||
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
class FolderListHandler extends Handler
|
class FolderListHandler extends Handler
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1259,6 +1262,10 @@ public class FolderList extends K9ListActivity
|
|||||||
|
|
||||||
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
||||||
|
|
||||||
|
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
||||||
|
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import android.text.Spannable;
|
|||||||
import android.text.style.TextAppearanceSpan;
|
import android.text.style.TextAppearanceSpan;
|
||||||
import android.util.Config;
|
import android.util.Config;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@ -116,6 +117,8 @@ public class MessageList
|
|||||||
private Button mBatchFlagButton;
|
private Button mBatchFlagButton;
|
||||||
private Button mBatchDoneButton;
|
private Button mBatchDoneButton;
|
||||||
|
|
||||||
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
class MessageListHandler extends Handler
|
class MessageListHandler extends Handler
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2028,6 +2031,11 @@ public class MessageList
|
|||||||
holder.selected.setVisibility(View.GONE);
|
holder.selected.setVisibility(View.GONE);
|
||||||
holder.flagged.setChecked(false);
|
holder.flagged.setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSubject());
|
||||||
|
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
|
||||||
|
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListDate());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,12 +17,14 @@ import android.provider.Contacts;
|
|||||||
import android.provider.Contacts.Intents;
|
import android.provider.Contacts.Intents;
|
||||||
import android.util.Config;
|
import android.util.Config;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.*;
|
import android.view.*;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.TranslateAnimation;
|
import android.view.animation.TranslateAnimation;
|
||||||
import android.webkit.*;
|
import android.webkit.*;
|
||||||
|
import android.webkit.WebSettings.TextSize;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
import com.fsck.k9.*;
|
import com.fsck.k9.*;
|
||||||
import com.fsck.k9.mail.*;
|
import com.fsck.k9.mail.*;
|
||||||
@ -90,6 +92,8 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
private Listener mListener = new Listener();
|
private Listener mListener = new Listener();
|
||||||
private MessageViewHandler mHandler = new MessageViewHandler();
|
private MessageViewHandler mHandler = new MessageViewHandler();
|
||||||
|
|
||||||
|
private FontSizes mFontSizes = K9.getFontSizes();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchKeyEvent(KeyEvent event)
|
public boolean dispatchKeyEvent(KeyEvent event)
|
||||||
@ -443,7 +447,6 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
mSubjectView = (TextView)findViewById(R.id.subject);
|
mSubjectView = (TextView)findViewById(R.id.subject);
|
||||||
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
||||||
|
|
||||||
|
|
||||||
mDateView = (TextView)findViewById(R.id.date);
|
mDateView = (TextView)findViewById(R.id.date);
|
||||||
mTimeView = (TextView)findViewById(R.id.time);
|
mTimeView = (TextView)findViewById(R.id.time);
|
||||||
mTopView = (ScrollView)findViewById(R.id.top_view);
|
mTopView = (ScrollView)findViewById(R.id.top_view);
|
||||||
@ -475,6 +478,17 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
//webSettings.setBuiltInZoomControls(true);
|
//webSettings.setBuiltInZoomControls(true);
|
||||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
|
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
|
||||||
|
|
||||||
|
webSettings.setTextSize(mFontSizes.getMessageViewContent());
|
||||||
|
|
||||||
|
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender());
|
||||||
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
||||||
|
((TextView)findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
||||||
|
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
||||||
|
((TextView)findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
||||||
|
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject());
|
||||||
|
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
||||||
|
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
||||||
|
|
||||||
mAttachments.setVisibility(View.GONE);
|
mAttachments.setVisibility(View.GONE);
|
||||||
mAttachmentIcon.setVisibility(View.GONE);
|
mAttachmentIcon.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
176
src/com/fsck/k9/activity/setup/FontSizeSettings.java
Normal file
176
src/com/fsck/k9/activity/setup/FontSizeSettings.java
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
|
||||||
|
package com.fsck.k9.activity.setup;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.SharedPreferences.Editor;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.*;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import com.fsck.k9.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_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_SUBJECT_FONT = "message_view_subject_font";
|
||||||
|
private static final String PREFERENCE_MESSAGE_VIEW_TIME_FONT = "message_view_time_font";
|
||||||
|
private static final String PREFERENCE_MESSAGE_VIEW_DATE_FONT = "message_view_date_font";
|
||||||
|
private static final String PREFERENCE_MESSAGE_VIEW_CONTENT_FONT = "message_view_content_font";
|
||||||
|
|
||||||
|
private ListPreference mAccountName;
|
||||||
|
private ListPreference mAccountDescription;
|
||||||
|
private ListPreference mFolderName;
|
||||||
|
private ListPreference mFolderStatus;
|
||||||
|
private ListPreference mMessageListSubject;
|
||||||
|
private ListPreference mMessageListSender;
|
||||||
|
private ListPreference mMessageListDate;
|
||||||
|
private ListPreference mMessageViewSender;
|
||||||
|
private ListPreference mMessageViewTo;
|
||||||
|
private ListPreference mMessageViewCC;
|
||||||
|
private ListPreference mMessageViewSubject;
|
||||||
|
private ListPreference mMessageViewTime;
|
||||||
|
private ListPreference mMessageViewDate;
|
||||||
|
private ListPreference mMessageViewContent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = initializeListPreference(PREFERENCE_ACCOUNT_NAME_FONT, fontSizes.getAccountName());
|
||||||
|
mAccountDescription = initializeListPreference(PREFERENCE_ACCOUNT_DESCRIPTION_FONT, fontSizes.getAccountDescription());
|
||||||
|
|
||||||
|
mFolderName = initializeListPreference(PREFERENCE_FOLDER_NAME_FONT, fontSizes.getFolderName());
|
||||||
|
mFolderStatus = initializeListPreference(PREFERENCE_FOLDER_STATUS_FONT, fontSizes.getFolderStatus());
|
||||||
|
|
||||||
|
mMessageListSubject = initializeListPreference(PREFERENCE_MESSAGE_LIST_SUBJECT_FONT, fontSizes.getMessageListSubject());
|
||||||
|
mMessageListSender = initializeListPreference(PREFERENCE_MESSAGE_LIST_SENDER_FONT, fontSizes.getMessageListSender());
|
||||||
|
mMessageListDate = initializeListPreference(PREFERENCE_MESSAGE_LIST_DATE_FONT, fontSizes.getMessageListDate());
|
||||||
|
|
||||||
|
mMessageViewSender = initializeListPreference(PREFERENCE_MESSAGE_VIEW_SENDER_FONT, fontSizes.getMessageViewSender());
|
||||||
|
mMessageViewTo = initializeListPreference(PREFERENCE_MESSAGE_VIEW_TO_FONT, fontSizes.getMessageViewTo());
|
||||||
|
mMessageViewCC = initializeListPreference(PREFERENCE_MESSAGE_VIEW_CC_FONT, fontSizes.getMessageViewCC());
|
||||||
|
mMessageViewSubject = initializeListPreference(PREFERENCE_MESSAGE_VIEW_SUBJECT_FONT, fontSizes.getMessageViewSubject());
|
||||||
|
mMessageViewTime = initializeListPreference(PREFERENCE_MESSAGE_VIEW_TIME_FONT, fontSizes.getMessageViewTime());
|
||||||
|
mMessageViewDate = initializeListPreference(PREFERENCE_MESSAGE_VIEW_DATE_FONT, fontSizes.getMessageViewDate());
|
||||||
|
mMessageViewContent = initializeListPreference(PREFERENCE_MESSAGE_VIEW_CONTENT_FONT, fontSizes.getMessageViewContentAsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue()));
|
||||||
|
fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue()));
|
||||||
|
fontSizes.setMessageViewCC(Integer.parseInt(mMessageViewCC.getValue()));
|
||||||
|
fontSizes.setMessageViewSubject(Integer.parseInt(mMessageViewSubject.getValue()));
|
||||||
|
fontSizes.setMessageViewTime(Integer.parseInt(mMessageViewTime.getValue()));
|
||||||
|
fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue()));
|
||||||
|
fontSizes.setMessageViewContent(Integer.parseInt(mMessageViewContent.getValue()));
|
||||||
|
|
||||||
|
SharedPreferences preferences = Preferences.getPreferences(this).getPreferences();
|
||||||
|
Editor editor = preferences.edit();
|
||||||
|
fontSizes.save(editor);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||||
|
{
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK)
|
||||||
|
{
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the ListPreference instance identified by <code>key</code>.
|
||||||
|
*
|
||||||
|
* @param key The key of the ListPreference object.
|
||||||
|
* @param value Initial value for the ListPreference object.
|
||||||
|
* @return The ListPreference instance identified by <code>key</code>.
|
||||||
|
*/
|
||||||
|
private ListPreference initializeListPreference(String key, int value)
|
||||||
|
{
|
||||||
|
ListPreference prefView = (ListPreference) findPreference(key);
|
||||||
|
prefView.setValue(Integer.toString(value));
|
||||||
|
prefView.setSummary(prefView.getEntry());
|
||||||
|
prefView.setOnPreferenceChangeListener(new PreferenceChangeListener(prefView));
|
||||||
|
return prefView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class handles value changes of the ListPreference objects.
|
||||||
|
*/
|
||||||
|
private class PreferenceChangeListener implements Preference.OnPreferenceChangeListener
|
||||||
|
{
|
||||||
|
private ListPreference mPrefView;
|
||||||
|
|
||||||
|
private PreferenceChangeListener(ListPreference prefView)
|
||||||
|
{
|
||||||
|
this.mPrefView = prefView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the preference value in the preference summary field.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue)
|
||||||
|
{
|
||||||
|
final String summary = newValue.toString();
|
||||||
|
int index = mPrefView.findIndexOfValue(summary);
|
||||||
|
mPrefView.setSummary(mPrefView.getEntries()[index]);
|
||||||
|
mPrefView.setValue(summary);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ public class Prefs extends K9PreferenceActivity
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final String PREFERENCE_THEME = "theme";
|
private static final String PREFERENCE_THEME = "theme";
|
||||||
|
private static final String PREFERENCE_FONT_SIZE = "font_size";
|
||||||
private static final String PREFERENCE_DATE_FORMAT = "dateFormat";
|
private static final String PREFERENCE_DATE_FORMAT = "dateFormat";
|
||||||
private static final String PREFERENCE_BACKGROUND_OPS = "background_ops";
|
private static final String PREFERENCE_BACKGROUND_OPS = "background_ops";
|
||||||
private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging";
|
private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging";
|
||||||
@ -79,6 +80,16 @@ public class Prefs extends K9PreferenceActivity
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener(
|
||||||
|
new Preference.OnPreferenceClickListener()
|
||||||
|
{
|
||||||
|
public boolean onPreferenceClick(Preference preference)
|
||||||
|
{
|
||||||
|
onFontSizeSettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
|
mDateFormat = (ListPreference) findPreference(PREFERENCE_DATE_FORMAT);
|
||||||
String[] formats = DateFormatter.getFormats(this);
|
String[] formats = DateFormatter.getFormats(this);
|
||||||
CharSequence[] entries = new CharSequence[formats.length];
|
CharSequence[] entries = new CharSequence[formats.length];
|
||||||
@ -193,4 +204,9 @@ public class Prefs extends K9PreferenceActivity
|
|||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onFontSizeSettings()
|
||||||
|
{
|
||||||
|
FontSizeSettings.actionEditSettings(this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user