Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo downloadButton.setEnabled(false); } public void setAttachment(AttachmentViewInfo attachment) throws MessagingException { public void setAttachment(AttachmentViewInfo attachment) { this.attachment = attachment; displayAttachmentInformation(); Loading k9mail/src/main/java/com/fsck/k9/ui/messageview/LockedAttachmentView.java 0 → 100644 +76 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.messageview; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewStub; import com.fsck.k9.R; import com.fsck.k9.mailstore.AttachmentViewInfo; import com.fsck.k9.view.ToolableViewAnimator; public class LockedAttachmentView extends ToolableViewAnimator implements OnClickListener { private ViewStub attachmentViewStub; private AttachmentViewInfo attachment; private AttachmentViewCallback attachmentCallback; public LockedAttachmentView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public LockedAttachmentView(Context context, AttributeSet attrs) { super(context, attrs); } public LockedAttachmentView(Context context) { super(context); } @Override protected void onFinishInflate() { super.onFinishInflate(); if (isInEditMode()) { return; } View unlockButton = findViewById(R.id.locked_button); unlockButton.setOnClickListener(this); attachmentViewStub = (ViewStub) findViewById(R.id.attachment_stub); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.locked_button: { showUnlockedView(); break; } } } private void showUnlockedView() { if (attachmentViewStub == null) { throw new IllegalStateException("Cannot display unlocked attachment!"); } AttachmentView attachmentView = (AttachmentView) attachmentViewStub.inflate(); attachmentView.setAttachment(attachment); attachmentView.setCallback(attachmentCallback); attachmentViewStub = null; setDisplayedChild(1); } public void setAttachment(AttachmentViewInfo attachment) { this.attachment = attachment; } public void setCallback(AttachmentViewCallback attachmentCallback) { this.attachmentCallback = attachmentCallback; } } k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java +29 −14 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene private View mAttachmentsContainer; private SavedState mSavedState; private ClipboardManager mClipboardManager; private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<AttachmentViewInfo, AttachmentView>(); private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<>(); private String currentHtmlText; private AttachmentResolver currentAttachmentResolver; Loading @@ -80,7 +80,9 @@ public class MessageContainerView extends LinearLayout implements OnClickListene super.onFinishInflate(); mMessageContentView = (MessageWebView) findViewById(R.id.message_content); if (!isInEditMode()) { mMessageContentView.configure(); } mMessageContentView.setOnCreateContextMenuListener(this); mMessageContentView.setVisibility(View.VISIBLE); Loading Loading @@ -398,10 +400,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene resetView(); boolean hasAttachments = !messageViewInfo.attachments.isEmpty(); if (hasAttachments) { renderAttachments(messageViewInfo); } mHiddenAttachments.setVisibility(View.GONE); Loading Loading @@ -456,9 +455,11 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } public void renderAttachments(MessageViewInfo messageViewInfo) throws MessagingException { if (messageViewInfo.attachments != null) { for (AttachmentViewInfo attachment : messageViewInfo.attachments) { ViewGroup parent = attachment.firstClassAttachment ? mAttachments : mHiddenAttachments; AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false); AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false); view.setCallback(attachmentCallback); view.setAttachment(attachment); Loading @@ -467,6 +468,20 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } } if (messageViewInfo.extraAttachments != null) { for (AttachmentViewInfo attachment : messageViewInfo.extraAttachments) { ViewGroup parent = attachment.firstClassAttachment ? mAttachments : mHiddenAttachments; LockedAttachmentView view = (LockedAttachmentView) mInflater .inflate(R.layout.message_view_attachment_locked, parent, false); view.setCallback(attachmentCallback); view.setAttachment(attachment); // attachments.put(attachment, view); parent.addView(view); } } } public void zoom(KeyEvent event) { if (event.isShiftPressed()) { mMessageContentView.zoomIn(); Loading k9mail/src/main/res/layout/message_container.xml +3 −3 Original line number Diff line number Diff line Loading @@ -14,19 +14,19 @@ <LinearLayout android:id="@+id/attachments_container" android:orientation="vertical" android:layout_width="fill_parent" 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_width="match_parent" android:layout_height="wrap_content" android:padding="4dip" /> <Button android:id="@+id/show_hidden_attachments" android:layout_width="fill_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/message_view_show_more_attachments_action" /> Loading k9mail/src/main/res/layout/message_view_attachment.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="4dip"> android:paddingBottom="4dip" android:id="@+id/attachment"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" Loading Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo downloadButton.setEnabled(false); } public void setAttachment(AttachmentViewInfo attachment) throws MessagingException { public void setAttachment(AttachmentViewInfo attachment) { this.attachment = attachment; displayAttachmentInformation(); Loading
k9mail/src/main/java/com/fsck/k9/ui/messageview/LockedAttachmentView.java 0 → 100644 +76 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.messageview; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewStub; import com.fsck.k9.R; import com.fsck.k9.mailstore.AttachmentViewInfo; import com.fsck.k9.view.ToolableViewAnimator; public class LockedAttachmentView extends ToolableViewAnimator implements OnClickListener { private ViewStub attachmentViewStub; private AttachmentViewInfo attachment; private AttachmentViewCallback attachmentCallback; public LockedAttachmentView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public LockedAttachmentView(Context context, AttributeSet attrs) { super(context, attrs); } public LockedAttachmentView(Context context) { super(context); } @Override protected void onFinishInflate() { super.onFinishInflate(); if (isInEditMode()) { return; } View unlockButton = findViewById(R.id.locked_button); unlockButton.setOnClickListener(this); attachmentViewStub = (ViewStub) findViewById(R.id.attachment_stub); } @Override public void onClick(View view) { switch (view.getId()) { case R.id.locked_button: { showUnlockedView(); break; } } } private void showUnlockedView() { if (attachmentViewStub == null) { throw new IllegalStateException("Cannot display unlocked attachment!"); } AttachmentView attachmentView = (AttachmentView) attachmentViewStub.inflate(); attachmentView.setAttachment(attachment); attachmentView.setCallback(attachmentCallback); attachmentViewStub = null; setDisplayedChild(1); } public void setAttachment(AttachmentViewInfo attachment) { this.attachment = attachment; } public void setCallback(AttachmentViewCallback attachmentCallback) { this.attachmentCallback = attachmentCallback; } }
k9mail/src/main/java/com/fsck/k9/ui/messageview/MessageContainerView.java +29 −14 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene private View mAttachmentsContainer; private SavedState mSavedState; private ClipboardManager mClipboardManager; private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<AttachmentViewInfo, AttachmentView>(); private Map<AttachmentViewInfo, AttachmentView> attachments = new HashMap<>(); private String currentHtmlText; private AttachmentResolver currentAttachmentResolver; Loading @@ -80,7 +80,9 @@ public class MessageContainerView extends LinearLayout implements OnClickListene super.onFinishInflate(); mMessageContentView = (MessageWebView) findViewById(R.id.message_content); if (!isInEditMode()) { mMessageContentView.configure(); } mMessageContentView.setOnCreateContextMenuListener(this); mMessageContentView.setVisibility(View.VISIBLE); Loading Loading @@ -398,10 +400,7 @@ public class MessageContainerView extends LinearLayout implements OnClickListene resetView(); boolean hasAttachments = !messageViewInfo.attachments.isEmpty(); if (hasAttachments) { renderAttachments(messageViewInfo); } mHiddenAttachments.setVisibility(View.GONE); Loading Loading @@ -456,9 +455,11 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } public void renderAttachments(MessageViewInfo messageViewInfo) throws MessagingException { if (messageViewInfo.attachments != null) { for (AttachmentViewInfo attachment : messageViewInfo.attachments) { ViewGroup parent = attachment.firstClassAttachment ? mAttachments : mHiddenAttachments; AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false); AttachmentView view = (AttachmentView) mInflater.inflate(R.layout.message_view_attachment, parent, false); view.setCallback(attachmentCallback); view.setAttachment(attachment); Loading @@ -467,6 +468,20 @@ public class MessageContainerView extends LinearLayout implements OnClickListene } } if (messageViewInfo.extraAttachments != null) { for (AttachmentViewInfo attachment : messageViewInfo.extraAttachments) { ViewGroup parent = attachment.firstClassAttachment ? mAttachments : mHiddenAttachments; LockedAttachmentView view = (LockedAttachmentView) mInflater .inflate(R.layout.message_view_attachment_locked, parent, false); view.setCallback(attachmentCallback); view.setAttachment(attachment); // attachments.put(attachment, view); parent.addView(view); } } } public void zoom(KeyEvent event) { if (event.isShiftPressed()) { mMessageContentView.zoomIn(); Loading
k9mail/src/main/res/layout/message_container.xml +3 −3 Original line number Diff line number Diff line Loading @@ -14,19 +14,19 @@ <LinearLayout android:id="@+id/attachments_container" android:orientation="vertical" android:layout_width="fill_parent" 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_width="match_parent" android:layout_height="wrap_content" android:padding="4dip" /> <Button android:id="@+id/show_hidden_attachments" android:layout_width="fill_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/message_view_show_more_attachments_action" /> Loading
k9mail/src/main/res/layout/message_view_attachment.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="4dip"> android:paddingBottom="4dip" android:id="@+id/attachment"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" Loading