1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Compose: Don't just theme the editboxes, but the whole content (but not the actionbar)

This way also the From: selection, To:, Cc, and Bcc: are themed correctly.
It looks more homogeneous and is consistent with the looks of the MessageView.
This commit is contained in:
m0viefreak 2013-02-06 21:43:49 +01:00 committed by cketti
parent 8f3e61feab
commit c59d70b8c6
3 changed files with 15 additions and 17 deletions

View File

@ -53,7 +53,6 @@
<attr name="messageViewHeaderBackgroundColor" format="reference|color"/>
<attr name="messageViewAttachmentBackground" format="reference"/>
<attr name="composerBackgroundColor" format="color"/>
<attr name="composerTextColor" format="color"/>
</declare-styleable>

View File

@ -52,7 +52,6 @@
<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">
@ -107,7 +106,6 @@
<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">

View File

@ -486,9 +486,22 @@ public class MessageCompose extends K9Activity implements OnClickListener {
finish();
return;
}
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.message_compose);
if (K9.getK9ComposerThemeSetting() != K9.Theme.USE_GLOBAL) {
// theme the whole content according to the theme (except the action bar)
ContextThemeWrapper wrapper = new ContextThemeWrapper(this,
K9.getK9ThemeResourceId(K9.getK9ComposerTheme()));
View v = ((LayoutInflater) wrapper.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).
inflate(R.layout.message_compose, null);
TypedValue outValue = new TypedValue();
// background color needs to be forced
wrapper.getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true);
v.setBackgroundColor(outValue.data);
setContentView(v);
} else {
setContentView(R.layout.message_compose);
}
final Intent intent = getIntent();
@ -554,18 +567,6 @@ 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.USE_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);