From 4299eb9771d63b53a94a7829f13c7c3855f243b5 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 20 Oct 2014 20:28:38 -0400 Subject: [PATCH] Rename method and improve documentation --- .../fsck/k9/fragment/MessageViewFragment.java | 2 +- src/com/fsck/k9/view/AttachmentView.java | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/com/fsck/k9/fragment/MessageViewFragment.java b/src/com/fsck/k9/fragment/MessageViewFragment.java index c267797b1..b66ebc618 100644 --- a/src/com/fsck/k9/fragment/MessageViewFragment.java +++ b/src/com/fsck/k9/fragment/MessageViewFragment.java @@ -207,7 +207,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener, mMessageView.setAttachmentCallback(new AttachmentFileDownloadCallback() { @Override - public void showFileBrowser(final AttachmentView caller) { + public void pickDirectoryToSaveAttachmentTo(final AttachmentView caller) { FileBrowserHelper.getInstance() .showFileBrowserActivity(MessageViewFragment.this, null, diff --git a/src/com/fsck/k9/view/AttachmentView.java b/src/com/fsck/k9/view/AttachmentView.java index 27ab0e657..9a9fbf05e 100644 --- a/src/com/fsck/k9/view/AttachmentView.java +++ b/src/com/fsck/k9/view/AttachmentView.java @@ -7,8 +7,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.commons.io.IOUtils; - import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; @@ -42,6 +40,7 @@ import com.fsck.k9.mail.internet.MimeHeader; import com.fsck.k9.mail.internet.MimeUtility; import com.fsck.k9.mail.store.LocalStore.LocalAttachmentBodyPart; import com.fsck.k9.provider.AttachmentProvider; +import org.apache.commons.io.IOUtils; public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener { @@ -77,16 +76,12 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo public interface AttachmentFileDownloadCallback { /** - * this method i called by the attachmentview when - * he wants to show a filebrowser - * the provider should show the filebrowser activity - * 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 + * This method is called to ask the user to pick a directory to save the attachment to. + *

+ * After the user has selected a directory, the implementation of this interface has to call + * {@link #writeFile(File)} on the object supplied as argument in order for the attachment to be saved. */ - public void showFileBrowser(AttachmentView caller); + public void pickDirectoryToSaveAttachmentTo(AttachmentView caller); } public void setButtonsEnabled(boolean enabled) { @@ -214,7 +209,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo @Override public boolean onLongClick(View view) { if (view.getId() == R.id.download) { - callback.showFileBrowser(this); + callback.pickDirectoryToSaveAttachmentTo(this); return true; }