mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Allow changing the message composer theme (background and text color).
This commit is contained in:
parent
728c1bdabe
commit
bd154c4c0f
@ -823,6 +823,7 @@ Um Fehler zu melden, neue Funktionen vorzuschlagen oder Fragen zu stellen, besuc
|
||||
<string name="folderlist_preferences">Ordnerliste</string>
|
||||
<string name="settings_theme_label">Design</string>
|
||||
<string name="settings_message_theme_label">Nachrichten-Design</string>
|
||||
<string name="settings_compose_theme_label">Editor-Design</string>
|
||||
<string name="settings_language_label">Sprache</string>
|
||||
|
||||
<string name="settings_message_theme_selection_label">Festes Nachrichten-Design</string>
|
||||
|
@ -52,6 +52,8 @@
|
||||
<attr name="messageListDividerColor" format="reference|color"/>
|
||||
<attr name="messageViewHeaderBackgroundColor" format="reference|color"/>
|
||||
<attr name="messageViewAttachmentBackground" format="reference"/>
|
||||
<attr name="composerBackgroundColor" format="color"/>
|
||||
<attr name="composerTextColor" format="color"/>
|
||||
|
||||
</declare-styleable>
|
||||
|
||||
|
@ -832,6 +832,7 @@ Please submit bug reports, contribute new features and ask questions at
|
||||
<string name="folderlist_preferences">Folder lists</string>
|
||||
<string name="settings_theme_label">Theme</string>
|
||||
<string name="settings_message_theme_label">Message view theme</string>
|
||||
<string name="settings_compose_theme_label">Composer theme</string>
|
||||
<string name="settings_language_label">Language</string>
|
||||
|
||||
<string name="settings_message_theme_selection_label">Fixed message theme</string>
|
||||
|
@ -51,6 +51,8 @@
|
||||
<item name="messageListDividerColor">#ffcccccc</item>
|
||||
<item name="messageViewHeaderBackgroundColor">#ffffffff</item>
|
||||
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_light</item>
|
||||
<item name="composerBackgroundColor">@android:color/white</item>
|
||||
<item name="composerTextColor">@android:color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.K9.Dark.Base" parent="Theme.Sherlock">
|
||||
@ -104,6 +106,8 @@
|
||||
<item name="messageListDividerColor">#ff333333</item>
|
||||
<item name="messageViewHeaderBackgroundColor">#000000</item>
|
||||
<item name="messageViewAttachmentBackground">@drawable/attachment_text_box_dark</item>
|
||||
<item name="composerBackgroundColor">@android:color/black</item>
|
||||
<item name="composerTextColor">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.K9.Light" parent="Theme.K9.Light.Base">
|
||||
|
@ -65,6 +65,14 @@
|
||||
android:entryValues="@array/settings_message_theme_values"
|
||||
android:dialogTitle="@string/settings_message_theme_label" />
|
||||
|
||||
<ListPreference
|
||||
android:persistent="false"
|
||||
android:key="messageComposeTheme"
|
||||
android:title="@string/settings_compose_theme_label"
|
||||
android:entries="@array/settings_message_theme_entries"
|
||||
android:entryValues="@array/settings_message_theme_values"
|
||||
android:dialogTitle="@string/settings_compose_theme_label" />
|
||||
|
||||
<Preference
|
||||
android:persistent="false"
|
||||
android:key="font_size"
|
||||
|
@ -101,6 +101,7 @@ public class K9 extends Application {
|
||||
private static String language = "";
|
||||
private static int theme = THEME_LIGHT;
|
||||
private static int messageViewTheme = THEME_GLOBAL;
|
||||
private static int composerTheme = THEME_GLOBAL;
|
||||
private static boolean useFixedMessageTheme = true;
|
||||
|
||||
private static final FontSizes fontSizes = new FontSizes();
|
||||
@ -526,6 +527,7 @@ public class K9 extends Application {
|
||||
editor.putString("language", language);
|
||||
editor.putInt("theme", theme);
|
||||
editor.putInt("messageViewTheme", messageViewTheme);
|
||||
editor.putInt("messageComposeTheme", composerTheme);
|
||||
editor.putBoolean("fixedMessageViewTheme", useFixedMessageTheme);
|
||||
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
|
||||
|
||||
@ -782,6 +784,7 @@ public class K9 extends Application {
|
||||
|
||||
K9.setK9MessageViewThemeSetting(sprefs.getInt("messageViewTheme", THEME_GLOBAL));
|
||||
K9.setUseFixedMessageViewTheme(sprefs.getBoolean("fixedMessageViewTheme", true));
|
||||
K9.setK9ComposerThemeSetting(sprefs.getInt("messageComposeTheme", THEME_GLOBAL));
|
||||
}
|
||||
|
||||
private void maybeSetupStrictMode() {
|
||||
@ -856,6 +859,14 @@ public class K9 extends Application {
|
||||
return messageViewTheme;
|
||||
}
|
||||
|
||||
public static int getK9ComposerTheme() {
|
||||
return composerTheme == THEME_GLOBAL ? theme : composerTheme;
|
||||
}
|
||||
|
||||
public static int getK9ComposerThemeSetting() {
|
||||
return composerTheme;
|
||||
}
|
||||
|
||||
public static int getK9Theme() {
|
||||
return theme;
|
||||
}
|
||||
@ -873,6 +884,10 @@ public class K9 extends Application {
|
||||
return useFixedMessageTheme;
|
||||
}
|
||||
|
||||
public static void setK9ComposerThemeSetting(int compTheme) {
|
||||
composerTheme = compTheme;
|
||||
}
|
||||
|
||||
public static void setUseFixedMessageViewTheme(boolean useFixed) {
|
||||
useFixedMessageTheme = useFixed;
|
||||
if (!useFixedMessageTheme && messageViewTheme == THEME_GLOBAL) {
|
||||
|
@ -479,6 +479,7 @@ public class MessageCompose extends K9Activity implements OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) {
|
||||
@ -552,6 +553,19 @@ public class MessageCompose extends K9Activity implements OnClickListener {
|
||||
|
||||
mMessageContentView = (EditText)findViewById(R.id.message_content);
|
||||
mMessageContentView.getInputExtras(true).putBoolean("allowEmoji", true);
|
||||
|
||||
if (K9.getK9ComposerThemeSetting() != K9.THEME_GLOBAL) {
|
||||
ContextThemeWrapper wrapper = new ContextThemeWrapper(this,
|
||||
K9.getK9ThemeResourceId(K9.getK9ComposerTheme()));
|
||||
TypedValue outValue = new TypedValue();
|
||||
EditText[] editors = new EditText[] { mMessageContentView, upperSignature, lowerSignature };
|
||||
|
||||
wrapper.getTheme().resolveAttribute(R.attr.composerBackgroundColor, outValue, true);
|
||||
for (EditText edit : editors) edit.setBackgroundColor(outValue.data);
|
||||
wrapper.getTheme().resolveAttribute(R.attr.composerTextColor, outValue, true);
|
||||
for (EditText edit : editors) edit.setTextColor(outValue.data);
|
||||
}
|
||||
|
||||
mAttachments = (LinearLayout)findViewById(R.id.attachments);
|
||||
mQuotedTextShow = (Button)findViewById(R.id.quoted_text_show);
|
||||
mQuotedTextBar = findViewById(R.id.quoted_text_bar);
|
||||
|
@ -55,6 +55,7 @@ public class Prefs extends K9PreferenceActivity {
|
||||
private static final String PREFERENCE_THEME = "theme";
|
||||
private static final String PREFERENCE_MESSAGE_VIEW_THEME = "messageViewTheme";
|
||||
private static final String PREFERENCE_FIXED_MESSAGE_THEME = "fixedMessageViewTheme";
|
||||
private static final String PREFERENCE_COMPOSER_THEME = "messageComposeTheme";
|
||||
private static final String PREFERENCE_FONT_SIZE = "font_size";
|
||||
private static final String PREFERENCE_DATE_FORMAT = "dateFormat";
|
||||
private static final String PREFERENCE_ANIMATIONS = "animations";
|
||||
@ -106,6 +107,7 @@ public class Prefs extends K9PreferenceActivity {
|
||||
private ListPreference mTheme;
|
||||
private CheckBoxPreference mFixedMessageTheme;
|
||||
private ListPreference mMessageTheme;
|
||||
private ListPreference mComposerTheme;
|
||||
private ListPreference mDateFormat;
|
||||
private CheckBoxPreference mAnimations;
|
||||
private CheckBoxPreference mGestures;
|
||||
@ -180,6 +182,8 @@ public class Prefs extends K9PreferenceActivity {
|
||||
mFixedMessageTheme.setChecked(K9.useFixedMessageViewTheme());
|
||||
mMessageTheme = setupListPreference(PREFERENCE_MESSAGE_VIEW_THEME,
|
||||
themeIdToName(K9.getK9MessageViewThemeSetting()));
|
||||
mComposerTheme = setupListPreference(PREFERENCE_COMPOSER_THEME,
|
||||
themeIdToName(K9.getK9ComposerThemeSetting()));
|
||||
|
||||
findPreference(PREFERENCE_FONT_SIZE).setOnPreferenceClickListener(
|
||||
new Preference.OnPreferenceClickListener() {
|
||||
@ -468,6 +472,7 @@ public class Prefs extends K9PreferenceActivity {
|
||||
K9.setK9Theme(themeNameToId(mTheme.getValue()));
|
||||
K9.setUseFixedMessageViewTheme(mFixedMessageTheme.isChecked());
|
||||
K9.setK9MessageViewThemeSetting(themeNameToId(mMessageTheme.getValue()));
|
||||
K9.setK9ComposerThemeSetting(themeNameToId(mComposerTheme.getValue()));
|
||||
|
||||
K9.setAnimations(mAnimations.isChecked());
|
||||
K9.setGesturesEnabled(mGestures.isChecked());
|
||||
|
Loading…
Reference in New Issue
Block a user