diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index e81016df4..5783d1974 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -146,15 +146,9 @@ public class MessageWebView extends WebView { } } - public void wrapSetTitleBar(final View title) { - try { - Class webViewClass = Class.forName("android.webkit.WebView"); - Method setEmbeddedTitleBar = webViewClass.getMethod("setEmbeddedTitleBar", View.class); - setEmbeddedTitleBar.invoke(this, title); - } - - catch (Exception e) { - Log.v(K9.LOG_TAG, "failed to find the setEmbeddedTitleBar method",e); - } + public void wrapSetTitleBar(final View title) throws Exception { + Class webViewClass = Class.forName("android.webkit.WebView"); + Method setEmbeddedTitleBar = webViewClass.getMethod("setEmbeddedTitleBar", View.class); + setEmbeddedTitleBar.invoke(this, title); } } diff --git a/src/com/fsck/k9/view/SingleMessageView.java b/src/com/fsck/k9/view/SingleMessageView.java index 019f866db..09fab78e4 100644 --- a/src/com/fsck/k9/view/SingleMessageView.java +++ b/src/com/fsck/k9/view/SingleMessageView.java @@ -159,7 +159,19 @@ public class SingleMessageView extends LinearLayout implements OnClickListener, mTitleBarHeaderContainer = new LinearLayout(activity); mTitleBarHeaderContainer.addView(mHeaderContainer); - mMessageContentView.wrapSetTitleBar(mTitleBarHeaderContainer); + try { + mMessageContentView.wrapSetTitleBar(mTitleBarHeaderContainer); + } catch (Exception e) { + // If wrapSetTitleBar() fails we put the header back. This isn't a very good + // fall-back but better than not displaying the message header at all. + + // FIXME: Get rid of the setEmbeddedTitleBar-method and come up with something that + // feels just like it but doesn't use undocumented methods. + + mTitleBarHeaderContainer.removeView(mHeaderContainer); + mHeaderPlaceHolder.addView(mHeaderContainer); + mTitleBarHeaderContainer = null; + } } mShowHiddenAttachments.setOnClickListener(this);