Loading src/com/fsck/k9/view/AttachmentView.java +22 −16 Original line number Diff line number Diff line package com.fsck.k9.view; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; Loading Loading @@ -42,6 +43,7 @@ import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBodyPart; import com.fsck.k9.provider.AttachmentProvider; public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener { private Context mContext; public Button viewButton; Loading @@ -61,10 +63,12 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo super(context, attrs, defStyle); mContext = context; } public AttachmentView(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; } public AttachmentView(Context context) { super(context); mContext = context; Loading @@ -79,6 +83,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo * and save the reference to the attachment view for later. * in his onActivityResult he can get the saved reference and * call the saveFile method of AttachmentView * * @param view */ public void showFileBrowser(AttachmentView caller); Loading @@ -86,7 +91,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo /** * Populates this view with information about the attachment. * * <p> * This method also decides which attachments are displayed when the "show attachments" button * is pressed, and which attachments are only displayed after the "show more attachments" Loading Loading @@ -243,7 +247,9 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo /** * Writes the attachment onto the given path * @param directory: the base dir where the file should be saved. * * @param directory * the base dir where the file should be saved. */ public void writeFile(File directory) { try { Loading Loading @@ -303,7 +309,8 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo mContext.startActivity(intent); } catch (Exception e) { Log.e(K9.LOG_TAG, "Could not display attachment of type " + contentType, e); Toast toast = Toast.makeText(mContext, mContext.getString(R.string.message_view_no_viewer, contentType), Toast.LENGTH_LONG); Toast toast = Toast.makeText(mContext, mContext.getString(R.string.message_view_no_viewer, contentType), Toast.LENGTH_LONG); toast.show(); } } Loading @@ -323,5 +330,4 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo public void setCallback(AttachmentFileDownloadCallback callback) { this.callback = callback; } } Loading
src/com/fsck/k9/view/AttachmentView.java +22 −16 Original line number Diff line number Diff line package com.fsck.k9.view; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; Loading Loading @@ -42,6 +43,7 @@ import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBodyPart; import com.fsck.k9.provider.AttachmentProvider; public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener { private Context mContext; public Button viewButton; Loading @@ -61,10 +63,12 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo super(context, attrs, defStyle); mContext = context; } public AttachmentView(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; } public AttachmentView(Context context) { super(context); mContext = context; Loading @@ -79,6 +83,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo * and save the reference to the attachment view for later. * in his onActivityResult he can get the saved reference and * call the saveFile method of AttachmentView * * @param view */ public void showFileBrowser(AttachmentView caller); Loading @@ -86,7 +91,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo /** * Populates this view with information about the attachment. * * <p> * This method also decides which attachments are displayed when the "show attachments" button * is pressed, and which attachments are only displayed after the "show more attachments" Loading Loading @@ -243,7 +247,9 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo /** * Writes the attachment onto the given path * @param directory: the base dir where the file should be saved. * * @param directory * the base dir where the file should be saved. */ public void writeFile(File directory) { try { Loading Loading @@ -303,7 +309,8 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo mContext.startActivity(intent); } catch (Exception e) { Log.e(K9.LOG_TAG, "Could not display attachment of type " + contentType, e); Toast toast = Toast.makeText(mContext, mContext.getString(R.string.message_view_no_viewer, contentType), Toast.LENGTH_LONG); Toast toast = Toast.makeText(mContext, mContext.getString(R.string.message_view_no_viewer, contentType), Toast.LENGTH_LONG); toast.show(); } } Loading @@ -323,5 +330,4 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo public void setCallback(AttachmentFileDownloadCallback callback) { this.callback = callback; } }