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.
This commit is contained in:
m0viefreak 2012-09-15 07:13:46 +02:00
parent b81fc8ea90
commit 771b5122d6
4 changed files with 12 additions and 7 deletions

View file

@ -164,8 +164,8 @@ http://k9mail.googlecode.com/
<string name="hide_full_header_action">Hide full header</string> <string name="hide_full_header_action">Hide full header</string>
<string name="select_text_action">Select text</string> <string name="select_text_action">Select text</string>
<string name="message_view_theme_action_dark">Change background to black</string> <string name="message_view_theme_action_dark">Switch to dark theme</string>
<string name="message_view_theme_action_light">Change background to white</string> <string name="message_view_theme_action_light">Switch to light theme</string>
<string name="mark_as_unread_action">Mark as unread</string> <string name="mark_as_unread_action">Mark as unread</string>
<string name="add_cc_bcc_action">Add Cc/Bcc</string> <string name="add_cc_bcc_action">Add Cc/Bcc</string>

View file

@ -303,6 +303,7 @@ public class MessageView extends K9Activity implements OnClickListener {
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
setTheme(K9.getK9ThemeResourceId(K9.getK9MessageViewTheme()));
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.message_view); setContentView(R.layout.message_view);
@ -623,7 +624,14 @@ public class MessageView extends K9Activity implements OnClickListener {
return null; return null;
} }
}.execute(); }.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) { private void startRefileActivity(int activity) {

View file

@ -98,9 +98,6 @@ public class MessageWebView extends TitleBarWebView {
// Black theme should get a black webview background // Black theme should get a black webview background
// we'll set the background of the messages on load // we'll set the background of the messages on load
this.setBackgroundColor(0xff000000); this.setBackgroundColor(0xff000000);
} else {
// multitoggle requires reset to white
this.setBackgroundColor(0xffffffff);
} }
final WebSettings webSettings = this.getSettings(); final WebSettings webSettings = this.getSettings();

View file

@ -720,7 +720,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
showShowPicturesAction(false); showShowPicturesAction(false);
mAttachments.removeAllViews(); mAttachments.removeAllViews();
mHiddenAttachments.removeAllViews(); mHiddenAttachments.removeAllViews();
mMessageContentView.configure();
/* /*
* Clear the WebView content * Clear the WebView content
* *