mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
Rearrange fields/methods
This commit is contained in:
parent
83d876f246
commit
d3073be89a
@ -45,18 +45,20 @@ import org.apache.commons.io.IOUtils;
|
||||
|
||||
public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener {
|
||||
private Context context;
|
||||
private Button viewButton;
|
||||
private Button downloadButton;
|
||||
private LocalAttachmentBodyPart part;
|
||||
private Message message;
|
||||
private LocalAttachmentBodyPart part;
|
||||
private Account account;
|
||||
private MessagingController controller;
|
||||
private MessagingListener listener;
|
||||
private AttachmentFileDownloadCallback callback;
|
||||
|
||||
private Button viewButton;
|
||||
private Button downloadButton;
|
||||
|
||||
private String name;
|
||||
private String contentType;
|
||||
private long size;
|
||||
|
||||
private AttachmentFileDownloadCallback callback;
|
||||
|
||||
public AttachmentView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
@ -73,17 +75,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
public interface AttachmentFileDownloadCallback {
|
||||
/**
|
||||
* This method is called to ask the user to pick a directory to save the attachment to.
|
||||
* <p/>
|
||||
* 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 pickDirectoryToSaveAttachmentTo(AttachmentView caller);
|
||||
}
|
||||
|
||||
public void setButtonsEnabled(boolean enabled) {
|
||||
viewButton.setEnabled(enabled);
|
||||
downloadButton.setEnabled(enabled);
|
||||
@ -214,7 +205,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onSaveButtonClicked() {
|
||||
boolean isExternalStorageMounted = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
|
||||
if (!isExternalStorageMounted) {
|
||||
@ -228,6 +218,10 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
|
||||
}
|
||||
}
|
||||
|
||||
public void writeFile() {
|
||||
writeFile(new File(K9.getAttachmentDefaultPath()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the attachment as file in the given directory
|
||||
*/
|
||||
@ -252,10 +246,6 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
|
||||
}
|
||||
}
|
||||
|
||||
public void writeFile() {
|
||||
writeFile(new File(K9.getAttachmentDefaultPath()));
|
||||
}
|
||||
|
||||
public void showFile() {
|
||||
Uri uri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId());
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
@ -292,6 +282,18 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
|
||||
public interface AttachmentFileDownloadCallback {
|
||||
/**
|
||||
* This method is called to ask the user to pick a directory to save the attachment to.
|
||||
* <p/>
|
||||
* 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 pickDirectoryToSaveAttachmentTo(AttachmentView caller);
|
||||
}
|
||||
|
||||
|
||||
private class LoadAndDisplayThumbnailAsyncTask extends AsyncTask<Void, Void, Bitmap> {
|
||||
private final ImageView thumbnail;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user