From e513af95294f313afc67903ad9063517bf741c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Wed, 28 Jan 2015 12:26:34 +0100 Subject: [PATCH] Sidebar --- .../ui/messageview/MessageContainerView.java | 4 +- .../java/com/fsck/k9/view/MessageWebView.java | 23 -- .../src/main/res/layout/message_container.xml | 75 +++--- .../layout/message_view_openpgp_header.xml | 214 +++++++----------- k9mail/src/main/res/values/colors.xml | 2 + 5 files changed, 132 insertions(+), 186 deletions(-) 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 e93c48066..577c96e8d 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 @@ -83,6 +83,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene private static final int DISPLAY_NAME_INDEX = 1; private ViewStub mOpenPgpHeaderStub; + private View mSidebar; private MessageWebView mMessageContentView; private LinearLayout mAttachments; private Button mShowHiddenAttachments; @@ -107,6 +108,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene this.attachmentCallback = attachmentCallback; mOpenPgpHeaderStub = (ViewStub) findViewById(R.id.openpgp_header_stub); + mSidebar = findViewById(R.id.message_sidebar); Activity activity = fragment.getActivity(); mMessageContentView = (MessageWebView) findViewById(R.id.message_content); @@ -434,7 +436,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene // || messageViewContainer.encrypted); // if (mHasOpenPgpInfo) { renderOpenPgpHeader(messageViewContainer); - mMessageContentView.setSidebar(true, Color.parseColor("#ff444444")); + mSidebar.setVisibility(View.VISIBLE); // } // Save the text so we can reset the WebView when the user clicks the "Show pictures" button diff --git a/k9mail/src/main/java/com/fsck/k9/view/MessageWebView.java b/k9mail/src/main/java/com/fsck/k9/view/MessageWebView.java index 4fb3e5367..fdf6ff6d2 100644 --- a/k9mail/src/main/java/com/fsck/k9/view/MessageWebView.java +++ b/k9mail/src/main/java/com/fsck/k9/view/MessageWebView.java @@ -2,9 +2,6 @@ package com.fsck.k9.view; import android.content.Context; import android.content.pm.PackageManager; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -19,10 +16,6 @@ import com.fsck.k9.helper.HtmlSanitizer; public class MessageWebView extends RigidWebView { - private Paint sidebarPaint = new Paint(); - private boolean sidebarEnabled = false; - private int sidebarColor = 0; - public MessageWebView(Context context) { super(context); } @@ -35,22 +28,6 @@ public class MessageWebView extends RigidWebView { super(context, attrs, defStyle); } - public void setSidebar(boolean enable, int color) { - sidebarEnabled = enable; - sidebarColor = color; - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - if (sidebarEnabled) { - sidebarPaint.setColor(sidebarColor); - sidebarPaint.setStrokeWidth(40); - sidebarPaint.setStyle(Paint.Style.FILL); - canvas.drawLine(0, 0, 0, getHeight(), sidebarPaint); - } - } - /** * Configure a web view to load or not load network data. A true setting here means that * network data will be blocked. diff --git a/k9mail/src/main/res/layout/message_container.xml b/k9mail/src/main/res/layout/message_container.xml index 61064d9e7..3373e3a41 100644 --- a/k9mail/src/main/res/layout/message_container.xml +++ b/k9mail/src/main/res/layout/message_container.xml @@ -12,39 +12,60 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - - - - - - -