mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Sidebar
This commit is contained in:
parent
b781ace4fa
commit
e513af9529
@ -83,6 +83,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
private static final int DISPLAY_NAME_INDEX = 1;
|
private static final int DISPLAY_NAME_INDEX = 1;
|
||||||
|
|
||||||
private ViewStub mOpenPgpHeaderStub;
|
private ViewStub mOpenPgpHeaderStub;
|
||||||
|
private View mSidebar;
|
||||||
private MessageWebView mMessageContentView;
|
private MessageWebView mMessageContentView;
|
||||||
private LinearLayout mAttachments;
|
private LinearLayout mAttachments;
|
||||||
private Button mShowHiddenAttachments;
|
private Button mShowHiddenAttachments;
|
||||||
@ -107,6 +108,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
this.attachmentCallback = attachmentCallback;
|
this.attachmentCallback = attachmentCallback;
|
||||||
|
|
||||||
mOpenPgpHeaderStub = (ViewStub) findViewById(R.id.openpgp_header_stub);
|
mOpenPgpHeaderStub = (ViewStub) findViewById(R.id.openpgp_header_stub);
|
||||||
|
mSidebar = findViewById(R.id.message_sidebar);
|
||||||
|
|
||||||
Activity activity = fragment.getActivity();
|
Activity activity = fragment.getActivity();
|
||||||
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
|
mMessageContentView = (MessageWebView) findViewById(R.id.message_content);
|
||||||
@ -434,7 +436,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene
|
|||||||
// || messageViewContainer.encrypted);
|
// || messageViewContainer.encrypted);
|
||||||
// if (mHasOpenPgpInfo) {
|
// if (mHasOpenPgpInfo) {
|
||||||
renderOpenPgpHeader(messageViewContainer);
|
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
|
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
|
||||||
|
@ -2,9 +2,6 @@ package com.fsck.k9.view;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@ -19,10 +16,6 @@ import com.fsck.k9.helper.HtmlSanitizer;
|
|||||||
|
|
||||||
public class MessageWebView extends RigidWebView {
|
public class MessageWebView extends RigidWebView {
|
||||||
|
|
||||||
private Paint sidebarPaint = new Paint();
|
|
||||||
private boolean sidebarEnabled = false;
|
|
||||||
private int sidebarColor = 0;
|
|
||||||
|
|
||||||
public MessageWebView(Context context) {
|
public MessageWebView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
@ -35,22 +28,6 @@ public class MessageWebView extends RigidWebView {
|
|||||||
super(context, attrs, defStyle);
|
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
|
* Configure a web view to load or not load network data. A <b>true</b> setting here means that
|
||||||
* network data will be blocked.
|
* network data will be blocked.
|
||||||
|
@ -12,39 +12,60 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
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
|
<LinearLayout
|
||||||
android:id="@+id/attachments_container"
|
android:orientation="horizontal"
|
||||||
android:orientation="vertical"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<!-- sidebar -->
|
||||||
android:id="@+id/attachments"
|
<View
|
||||||
android:orientation="vertical"
|
android:id="@+id/message_sidebar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="8dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginLeft="16dp"
|
||||||
android:padding="4dip" />
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
<Button
|
android:background="@color/openpgp_sidebar"
|
||||||
android:id="@+id/show_hidden_attachments"
|
android:visibility="gone"/>
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/message_view_show_more_attachments_action" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/hidden_attachments"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:padding="4dip" />
|
|
||||||
|
|
||||||
|
<!-- 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>
|
</LinearLayout>
|
||||||
</com.fsck.k9.ui.messageview.MessageContainerView>
|
</com.fsck.k9.ui.messageview.MessageContainerView>
|
@ -10,9 +10,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp">
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:paddingBottom="4dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@ -33,8 +31,8 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:text="Not Encrypted (set in-code)"
|
android:text="Not Encrypted (set in-code)"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginBottom="8dp" />
|
android:layout_marginBottom="4dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -56,151 +54,97 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:text="Signed by (set in-code)"
|
android:text="Signed by (set in-code)"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginBottom="8dp" />
|
android:layout_marginBottom="4dp" />
|
||||||
</LinearLayout>
|
</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
|
<LinearLayout
|
||||||
android:id="@+id/result_signature_layout"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
android:layout_height="wrap_content">
|
||||||
android:clickable="true"
|
|
||||||
android:layout_marginLeft="32dp"
|
<View
|
||||||
android:paddingRight="4dp"
|
android:layout_width="8dp"
|
||||||
android:orientation="horizontal">
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/openpgp_sidebar" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:orientation="vertical"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_height="wrap_content">
|
||||||
android:paddingRight="4dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
android:id="@+id/result_signature_name"
|
android:id="@+id/result_signature_divider1"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="1dip"
|
||||||
android:text="Alice (set in-code)" />
|
android:layout_marginLeft="16dp"
|
||||||
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/result_signature_email"
|
android:id="@+id/result_signature_layout"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||||
android:text="alice@example.com (set in-code)"
|
android:clickable="true"
|
||||||
android:gravity="center_vertical" />
|
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>
|
</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>
|
</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>
|
||||||
|
|
||||||
<!--<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>
|
</com.fsck.k9.ui.messageview.OpenPgpHeaderView>
|
||||||
|
@ -6,4 +6,6 @@
|
|||||||
<color name="openpgp_orange">#FF8800</color>
|
<color name="openpgp_orange">#FF8800</color>
|
||||||
<color name="openpgp_green">#669900</color>
|
<color name="openpgp_green">#669900</color>
|
||||||
<color name="openpgp_blue">#336699</color>
|
<color name="openpgp_blue">#336699</color>
|
||||||
|
<color name="openpgp_sidebar">#ff444444</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user