1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00
This commit is contained in:
Dominik Schürmann 2015-01-28 12:26:34 +01:00
parent b781ace4fa
commit e513af9529
5 changed files with 132 additions and 186 deletions

View File

@ -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

View File

@ -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 <b>true</b> setting here means that
* network data will be blocked.

View File

@ -12,10 +12,29 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- sidebar -->
<View
android:id="@+id/message_sidebar"
android:layout_width="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_height="match_parent"
android:background="@color/openpgp_sidebar"
android:visibility="gone"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Content area -->
<com.fsck.k9.view.MessageWebView
android:id="@+id/message_content"
android:layout_below="@+id/openpgp_header"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
@ -47,4 +66,6 @@
android:padding="4dip" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.fsck.k9.ui.messageview.MessageContainerView>

View File

@ -10,9 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
android:paddingRight="8dp">
<LinearLayout
android:orientation="horizontal"
@ -33,8 +31,8 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Not Encrypted (set in-code)"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" />
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" />
</LinearLayout>
<LinearLayout
@ -56,15 +54,31 @@
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Signed by (set in-code)"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" />
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="8dp"
android:layout_marginLeft="8dp"
android:layout_height="match_parent"
android:background="@color/openpgp_sidebar" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="@+id/result_signature_divider1"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="32dp"
android:layout_marginLeft="16dp"
android:background="?android:attr/listDivider" />
<LinearLayout
@ -72,7 +86,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:clickable="true"
android:layout_marginLeft="32dp"
android:layout_marginLeft="16dp"
android:paddingRight="4dp"
android:orientation="horizontal">
@ -125,82 +139,12 @@
android:id="@+id/result_signature_divider2"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="32dp"
android:background="?android:attr/listDivider" />
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_weight="1"-->
<!--android:orientation="vertical"-->
<!--android:padding="2dp">-->
</LinearLayout>
<!--<TextView-->
<!--android:id="@+id/openpgp_text"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_gravity="center_vertical"-->
<!--android:ellipsize="end"-->
<!--android:gravity="center"-->
<!--android:maxLines="1"-->
<!--android:padding="2dp"-->
<!--android:singleLine="true"-->
<!--android:textAppearance="?android:attr/textAppearanceSmall"-->
<!--android:textColor="?android:textColorPrimaryInverse"-->
<!--android:textIsSelectable="false" />-->
<!--<RelativeLayout-->
<!--android:id="@+id/openpgp_signature_layout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:gravity="center_vertical"-->
<!--android:orientation="horizontal"-->
<!--android:padding="2dp"-->
<!--android:visibility="gone">-->
<!--<RelativeLayout-->
<!--android:id="@+id/openpgp_signature_layout_image"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!--<ImageView-->
<!--android:id="@+id/openpgp_signature"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="@drawable/signed_large" />-->
<!--<ImageView-->
<!--android:id="@+id/openpgp_signature_status"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="@drawable/overlay_error" />-->
<!--</RelativeLayout>-->
<!--<TextView-->
<!--android:id="@+id/openpgp_user_id"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_centerVertical="true"-->
<!--android:layout_toRightOf="@+id/openpgp_signature_layout_image"-->
<!--android:ellipsize="end"-->
<!--android:paddingLeft="5dip"-->
<!--android:text="@string/openpgp_user_id"-->
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
<!--android:textColor="?android:textColorPrimaryInverse" />-->
<!--</RelativeLayout>-->
<!--</LinearLayout>-->
<Button
android:id="@+id/openpgp_get_key"
style="?android:attr/buttonStyleSmall"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/openpgp_signature_layout_image"
android:layout_gravity="center_vertical"
android:text="@string/openpgp_get_key"
android:visibility="gone" />
</LinearLayout>
</com.fsck.k9.ui.messageview.OpenPgpHeaderView>

View File

@ -6,4 +6,6 @@
<color name="openpgp_orange">#FF8800</color>
<color name="openpgp_green">#669900</color>
<color name="openpgp_blue">#336699</color>
<color name="openpgp_sidebar">#ff444444</color>
</resources>