From 771b5122d6b850b855bdf218f3428f4bd097a07d Mon Sep 17 00:00:00 2001 From: m0viefreak Date: Sat, 15 Sep 2012 07:13:46 +0200 Subject: [PATCH] MessageView theme toggle: change the theme of the whole activity and not just the background of the WebView Using dark theme with white WebView background looks very ugly, especially when a "download complete message" or a "show images" button is present. This change applies the theme to the whole activity. Also changed the text for the toggle menu. It's also shorter now, and isn't cut off anymore on hdpi/480px wide devices. --- res/values/strings.xml | 4 ++-- src/com/fsck/k9/activity/MessageView.java | 10 +++++++++- src/com/fsck/k9/view/MessageWebView.java | 3 --- src/com/fsck/k9/view/SingleMessageView.java | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b609fed61..6b78eb0c1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -164,8 +164,8 @@ http://k9mail.googlecode.com/ Hide full header Select text - Change background to black - Change background to white + Switch to dark theme + Switch to light theme Mark as unread Add Cc/Bcc diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 7b0be8de3..4fd8d94f8 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -303,6 +303,7 @@ public class MessageView extends K9Activity implements OnClickListener { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); + setTheme(K9.getK9ThemeResourceId(K9.getK9MessageViewTheme())); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.message_view); @@ -623,7 +624,14 @@ public class MessageView extends K9Activity implements OnClickListener { return null; } }.execute(); - displayMessage(mMessageReference); + + // restart the current activity, so that the theme change can be applied + Intent intent = getIntent(); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + finish(); + overridePendingTransition(0, 0); // disable animations to speed up the switch + startActivity(intent); + overridePendingTransition(0, 0); } private void startRefileActivity(int activity) { diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index 44c8559e7..1e82554ec 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -98,9 +98,6 @@ public class MessageWebView extends TitleBarWebView { // Black theme should get a black webview background // we'll set the background of the messages on load this.setBackgroundColor(0xff000000); - } else { - // multitoggle requires reset to white - this.setBackgroundColor(0xffffffff); } final WebSettings webSettings = this.getSettings(); diff --git a/src/com/fsck/k9/view/SingleMessageView.java b/src/com/fsck/k9/view/SingleMessageView.java index 829c26408..4e32a6c71 100644 --- a/src/com/fsck/k9/view/SingleMessageView.java +++ b/src/com/fsck/k9/view/SingleMessageView.java @@ -720,7 +720,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener, showShowPicturesAction(false); mAttachments.removeAllViews(); mHiddenAttachments.removeAllViews(); - mMessageContentView.configure(); + /* * Clear the WebView content *