1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -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,39 +12,60 @@
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" />
<!-- Attachments area -->
<LinearLayout
android:id="@+id/attachments_container"
android:orientation="vertical"
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/attachments"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dip" />
<Button
android:id="@+id/show_hidden_attachments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/message_view_show_more_attachments_action" />
<!-- 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:id="@+id/hidden_attachments"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dip" />
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Content area -->
<com.fsck.k9.view.MessageWebView
android:id="@+id/message_content"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<!-- Attachments area -->
<LinearLayout
android:id="@+id/attachments_container"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/attachments"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dip" />
<Button
android:id="@+id/show_hidden_attachments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/message_view_show_more_attachments_action" />
<LinearLayout
android:id="@+id/hidden_attachments"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
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,151 +54,97 @@
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>
<View
android:id="@+id/result_signature_divider1"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="32dp"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/result_signature_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:clickable="true"
android:layout_marginLeft="32dp"
android:paddingRight="4dp"
android:orientation="horizontal">
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:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="4dp"
android:gravity="center_vertical"
android:orientation="vertical">
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/result_signature_name"
android:textAppearance="?android:attr/textAppearanceMedium"
<View
android:id="@+id/result_signature_divider1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Alice (set in-code)" />
android:layout_height="1dip"
android:layout_marginLeft="16dp"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/result_signature_email"
android:textAppearance="?android:attr/textAppearanceSmall"
<LinearLayout
android:id="@+id/result_signature_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="alice@example.com (set in-code)"
android:gravity="center_vertical" />
android:layout_height="?android:attr/listPreferredItemHeight"
android:clickable="true"
android:layout_marginLeft="16dp"
android:paddingRight="4dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingRight="4dp"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/result_signature_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Alice (set in-code)" />
<TextView
android:id="@+id/result_signature_email"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="alice@example.com (set in-code)"
android:gravity="center_vertical" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/result_signature_action"
android:paddingLeft="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Show"
android:drawablePadding="8dp"
android:gravity="center_vertical" />
</LinearLayout>
<View
android:id="@+id/result_signature_divider2"
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="match_parent"
android:gravity="right"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/result_signature_action"
android:paddingLeft="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Show"
android:drawablePadding="8dp"
android:gravity="center_vertical" />
</LinearLayout>
<View
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">-->
<!--<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" />
</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>