From f887348953fcefad1280260115f9d0734aad28a9 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 17 Feb 2015 04:15:10 +0100 Subject: [PATCH] Set background color of message view in one place --- .../main/java/com/fsck/k9/activity/MessageCompose.java | 2 +- .../com/fsck/k9/ui/messageview/MessageContainerView.java | 8 -------- .../java/com/fsck/k9/ui/messageview/MessageTopView.java | 5 ----- k9mail/src/main/res/layout/message.xml | 3 ++- k9mail/src/main/res/values/attrs.xml | 2 +- k9mail/src/main/res/values/themes.xml | 4 ++-- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java index f49a085d0..35ee62aa0 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -517,7 +517,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, View v = LayoutInflater.from(mThemeContext).inflate(R.layout.message_compose, null); TypedValue outValue = new TypedValue(); // background color needs to be forced - mThemeContext.getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true); + mThemeContext.getTheme().resolveAttribute(R.attr.messageViewBackgroundColor, outValue, true); v.setBackgroundColor(outValue.data); setContentView(v); } else { diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java index 91feb9f28..cc2bd16b5 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java @@ -10,7 +10,6 @@ import android.net.Uri; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; -import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; @@ -114,13 +113,6 @@ public class MessageContainerView extends LinearLayout implements OnClickListene openPgpHeaderView = (OpenPgpHeaderView) openPgpHeaderStub.inflate(); } - // the HTC version of WebView tries to force the background of the - // titlebar, which is really unfair. - TypedValue outValue = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true); - // also set background of the whole view (including the attachments view) - setBackgroundColor(outValue.data); - mShowHiddenAttachments.setOnClickListener(this); mClipboardManager = ClipboardManager.getInstance(context); diff --git a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java index 8c427b351..45e32f896 100644 --- a/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java +++ b/k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.java @@ -7,7 +7,6 @@ import android.app.Fragment; import android.content.Context; import android.util.AttributeSet; import android.util.Log; -import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; @@ -54,10 +53,6 @@ public class MessageTopView extends LinearLayout implements ShowPicturesControll // mHeaderContainer.setOnLayoutChangedListener(this); mInflater = ((MessageViewFragment) fragment).getFragmentLayoutInflater(); - TypedValue outValue = new TypedValue(); - getContext().getTheme().resolveAttribute(R.attr.messageViewHeaderBackgroundColor, outValue, true); - mHeaderContainer.setBackgroundColor(outValue.data); - mDownloadRemainder = (Button) findViewById(R.id.download_remainder); mDownloadRemainder.setVisibility(View.GONE); diff --git a/k9mail/src/main/res/layout/message.xml b/k9mail/src/main/res/layout/message.xml index 3d54e37fc..13c3f0420 100644 --- a/k9mail/src/main/res/layout/message.xml +++ b/k9mail/src/main/res/layout/message.xml @@ -6,7 +6,8 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:layout_weight="1"> + android:layout_weight="1" + android:background="?attr/messageViewBackgroundColor"> - + diff --git a/k9mail/src/main/res/values/themes.xml b/k9mail/src/main/res/values/themes.xml index 2b22bf849..fcf8bb253 100644 --- a/k9mail/src/main/res/values/themes.xml +++ b/k9mail/src/main/res/values/themes.xml @@ -51,7 +51,7 @@ #ff2ea7d1 #ffcccccc @drawable/btn_check_message_list_light - #ffffffff + #ffffffff @drawable/attachment_text_box_light @drawable/ic_button_add_contact_light ?attr/messageListDividerColor @@ -105,7 +105,7 @@ #ff33b5e5 #ff333333 @drawable/btn_check_message_list_dark - #000000 + #000000 @drawable/attachment_text_box_dark @drawable/ic_button_add_contact_dark ?attr/messageListDividerColor