1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Added font size setting for text input fields in MessageCompose

This commit is contained in:
cketti 2012-01-12 01:05:01 +01:00
parent e7f29d429c
commit edf0361aab
7 changed files with 64 additions and 1 deletions

View File

@ -986,6 +986,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="font_size_message_view_date">Date</string>
<string name="font_size_message_view_content">Message body</string>
<string name="font_size_message_compose">Message composition</string>
<string name="font_size_message_compose_input">Text input fields</string>
<string name="font_size_tiniest">Tiniest</string>
<string name="font_size_tiny">Tiny</string>
<string name="font_size_smaller">Smaller</string>

View File

@ -160,4 +160,18 @@
</PreferenceScreen>
<PreferenceScreen
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" />
</PreferenceScreen>
</PreferenceScreen>

View File

@ -27,6 +27,7 @@ public class FontSizes {
private static final String MESSAGE_VIEW_TIME = "fontSizeMessageViewTime";
private static final String MESSAGE_VIEW_DATE = "fontSizeMessageViewDate";
private static final String MESSAGE_VIEW_CONTENT = "fontSizeMessageViewContent";
private static final String MESSAGE_COMPOSE_INPUT = "fontSizeMessageComposeInput";
/*
* Values for the font sizes in DIP (device independent pixel)
@ -122,6 +123,12 @@ public class FontSizes {
*/
private TextSize messageViewContent = TextSize.NORMAL;
/**
* Font size for the input fields in the message compose activity.
*/
private int messageComposeInput;
/**
* Create a <code>FontSizes</code> object with default values.
*/
@ -144,6 +151,8 @@ public class FontSizes {
messageViewSubject = FONT_12DIP;
messageViewTime = FONT_10DIP;
messageViewDate = FONT_10DIP;
messageComposeInput = MEDIUM;
}
/**
@ -171,6 +180,8 @@ public class FontSizes {
editor.putInt(MESSAGE_VIEW_TIME, messageViewTime);
editor.putInt(MESSAGE_VIEW_DATE, messageViewDate);
editor.putInt(MESSAGE_VIEW_CONTENT, getMessageViewContentAsInt());
editor.putInt(MESSAGE_COMPOSE_INPUT, messageComposeInput);
}
/**
@ -198,6 +209,8 @@ public class FontSizes {
messageViewTime = prefs.getInt(MESSAGE_VIEW_TIME, messageViewTime);
messageViewDate = prefs.getInt(MESSAGE_VIEW_DATE, messageViewDate);
setMessageViewContent(prefs.getInt(MESSAGE_VIEW_CONTENT, 3));
messageComposeInput = prefs.getInt(MESSAGE_COMPOSE_INPUT, messageComposeInput);
}
public int getAccountName() {
@ -359,4 +372,12 @@ public class FontSizes {
break;
}
}
public int getMessageComposeInput() {
return messageComposeInput;
}
public void setMessageComposeInput(int messageComposeInput) {
this.messageComposeInput = messageComposeInput;
}
}

View File

@ -30,6 +30,7 @@ import android.os.Parcelable;
import android.provider.OpenableColumns;
import android.text.util.Rfc822Tokenizer;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -57,6 +58,7 @@ import com.fsck.k9.Account.QuoteStyle;
import com.fsck.k9.Account.MessageFormat;
import com.fsck.k9.EmailAddressAdapter;
import com.fsck.k9.EmailAddressValidator;
import com.fsck.k9.FontSizes;
import com.fsck.k9.Identity;
import com.fsck.k9.K9;
import com.fsck.k9.Preferences;
@ -273,6 +275,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
private EmailAddressAdapter mAddressAdapter;
private Validator mAddressValidator;
private FontSizes mFontSizes = K9.getFontSizes();
static class Attachment implements Serializable {
private static final long serialVersionUID = 3642382876618963734L;
@ -690,6 +694,16 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
}
mDraftNeedsSaving = false;
// Set font size of input controls
int fontSize = mFontSizes.getMessageComposeInput();
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mBccView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
}
/**

View File

@ -36,6 +36,7 @@ public class FontSizeSettings extends K9PreferenceActivity {
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 static final String PREFERENCE_MESSAGE_COMPOSE_INPUT_FONT = "message_compose_input_font";
private ListPreference mAccountName;
private ListPreference mAccountDescription;
@ -53,6 +54,7 @@ public class FontSizeSettings extends K9PreferenceActivity {
private ListPreference mMessageViewTime;
private ListPreference mMessageViewDate;
private ListPreference mMessageViewContent;
private ListPreference mMessageComposeInput;
/**
@ -123,6 +125,10 @@ public class FontSizeSettings extends K9PreferenceActivity {
mMessageViewContent = setupListPreference(
PREFERENCE_MESSAGE_VIEW_CONTENT_FONT,
Integer.toString(fontSizes.getMessageViewContentAsInt()));
mMessageComposeInput = setupListPreference(
PREFERENCE_MESSAGE_COMPOSE_INPUT_FONT,
Integer.toString(fontSizes.getMessageComposeInput()));
}
/**
@ -152,6 +158,8 @@ public class FontSizeSettings extends K9PreferenceActivity {
fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue()));
fontSizes.setMessageViewContent(Integer.parseInt(mMessageViewContent.getValue()));
fontSizes.setMessageComposeInput(Integer.parseInt(mMessageComposeInput.getValue()));
SharedPreferences preferences = Preferences.getPreferences(this).getPreferences();
Editor editor = preferences.edit();
fontSizes.save(editor);

View File

@ -77,6 +77,9 @@ public class GlobalSettings {
s.put("fontSizeFolderStatus", Settings.versions(
new V(1, new FontSizeSetting(FontSizes.SMALL))
));
s.put("fontSizeMessageComposeInput", Settings.versions(
new V(5, new FontSizeSetting(FontSizes.MEDIUM))
));
s.put("fontSizeMessageListDate", Settings.versions(
new V(1, new FontSizeSetting(FontSizes.SMALL))
));

View File

@ -35,7 +35,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 4;
public static final int VERSION = 5;
public static Map<String, Object> validate(int version, Map<String,
TreeMap<Integer, SettingsDescription>> settings,