1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Remove "m" prefix for field names

This commit is contained in:
cketti 2014-10-20 21:09:23 -04:00
parent b3bc85ba10
commit 1e89314f3e

View File

@ -44,14 +44,14 @@ import org.apache.commons.io.IOUtils;
public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener { public class AttachmentView extends FrameLayout implements OnClickListener, OnLongClickListener {
private Context mContext; private Context context;
private Button viewButton; private Button viewButton;
private Button downloadButton; private Button downloadButton;
private LocalAttachmentBodyPart part; private LocalAttachmentBodyPart part;
private Message mMessage; private Message message;
private Account mAccount; private Account account;
private MessagingController mController; private MessagingController controller;
private MessagingListener mListener; private MessagingListener listener;
private String name; private String name;
private String contentType; private String contentType;
private long size; private long size;
@ -60,17 +60,17 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
public AttachmentView(Context context, AttributeSet attrs, int defStyle) { public AttachmentView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
mContext = context; this.context = context;
} }
public AttachmentView(Context context, AttributeSet attrs) { public AttachmentView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mContext = context; this.context = context;
} }
public AttachmentView(Context context) { public AttachmentView(Context context) {
super(context); super(context);
mContext = context; this.context = context;
} }
@ -113,10 +113,10 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
MessagingController controller, MessagingListener listener) throws MessagingException { MessagingController controller, MessagingListener listener) throws MessagingException {
part = (LocalAttachmentBodyPart) inputPart; part = (LocalAttachmentBodyPart) inputPart;
mMessage = message; this.message = message;
mAccount = account; this.account = account;
mController = controller; this.controller = controller;
mListener = listener; this.listener = listener;
boolean firstClassAttachment = extractAttachmentInformation(part); boolean firstClassAttachment = extractAttachmentInformation(part);
@ -187,7 +187,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
downloadButton.setOnLongClickListener(this); downloadButton.setOnLongClickListener(this);
attachmentName.setText(name); attachmentName.setText(name);
attachmentInfo.setText(SizeFormatter.formatSize(mContext, size)); attachmentInfo.setText(SizeFormatter.formatSize(context, size));
ImageView thumbnail = (ImageView) findViewById(R.id.attachment_icon); ImageView thumbnail = (ImageView) findViewById(R.id.attachment_icon);
new LoadAndDisplayThumbnailAsyncTask(thumbnail).execute(); new LoadAndDisplayThumbnailAsyncTask(thumbnail).execute();
@ -218,8 +218,8 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
} }
private void onViewButtonClicked() { private void onViewButtonClicked() {
if (mMessage != null) { if (message != null) {
mController.loadAttachment(mAccount, mMessage, part, new Object[] {false, this}, mListener); controller.loadAttachment(account, message, part, new Object[] {false, this}, listener);
} }
} }
@ -238,15 +238,15 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
try { try {
String filename = Utility.sanitizeFilename(name); String filename = Utility.sanitizeFilename(name);
File file = Utility.createUniqueFile(directory, filename); File file = Utility.createUniqueFile(directory, filename);
Uri uri = AttachmentProvider.getAttachmentUri(mAccount, part.getAttachmentId()); Uri uri = AttachmentProvider.getAttachmentUri(account, part.getAttachmentId());
InputStream in = mContext.getContentResolver().openInputStream(uri); InputStream in = context.getContentResolver().openInputStream(uri);
OutputStream out = new FileOutputStream(file); OutputStream out = new FileOutputStream(file);
IOUtils.copy(in, out); IOUtils.copy(in, out);
out.flush(); out.flush();
out.close(); out.close();
in.close(); in.close();
attachmentSaved(file.toString()); attachmentSaved(file.toString());
new MediaScannerNotifier(mContext, file); new MediaScannerNotifier(context, file);
} catch (IOException ioe) { } catch (IOException ioe) {
if (K9.DEBUG) { if (K9.DEBUG) {
Log.e(K9.LOG_TAG, "Error saving attachment", ioe); Log.e(K9.LOG_TAG, "Error saving attachment", ioe);
@ -270,45 +270,45 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
* Abort early if there's no place to save the attachment. We don't want to spend * Abort early if there's no place to save the attachment. We don't want to spend
* the time downloading it and then abort. * the time downloading it and then abort.
*/ */
String message = mContext.getString(R.string.message_view_status_attachment_not_saved); String message = context.getString(R.string.message_view_status_attachment_not_saved);
displayMessageToUser(message); displayMessageToUser(message);
return; return;
} }
if (mMessage != null) { if (message != null) {
mController.loadAttachment(mAccount, mMessage, part, new Object[] {true, this}, mListener); controller.loadAttachment(account, message, part, new Object[] {true, this}, listener);
} }
} }
public void showFile() { public void showFile() {
Uri uri = AttachmentProvider.getAttachmentUriForViewing(mAccount, part.getAttachmentId()); Uri uri = AttachmentProvider.getAttachmentUriForViewing(account, part.getAttachmentId());
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
// We explicitly set the ContentType in addition to the URI because some attachment viewers (such as Polaris office 3.0.x) choke on documents without a mime type // We explicitly set the ContentType in addition to the URI because some attachment viewers (such as Polaris office 3.0.x) choke on documents without a mime type
intent.setDataAndType(uri, contentType); intent.setDataAndType(uri, contentType);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
try { try {
mContext.startActivity(intent); context.startActivity(intent);
} catch (Exception e) { } catch (Exception e) {
Log.e(K9.LOG_TAG, "Could not display attachment of type " + contentType, e); Log.e(K9.LOG_TAG, "Could not display attachment of type " + contentType, e);
String message = mContext.getString(R.string.message_view_no_viewer, contentType); String message = context.getString(R.string.message_view_no_viewer, contentType);
displayMessageToUser(message); displayMessageToUser(message);
} }
} }
public void attachmentSaved(final String filename) { public void attachmentSaved(final String filename) {
String message = mContext.getString(R.string.message_view_status_attachment_saved, filename); String message = context.getString(R.string.message_view_status_attachment_saved, filename);
displayMessageToUser(message); displayMessageToUser(message);
} }
public void attachmentNotSaved() { public void attachmentNotSaved() {
String message = mContext.getString(R.string.message_view_status_attachment_not_saved); String message = context.getString(R.string.message_view_status_attachment_not_saved);
displayMessageToUser(message); displayMessageToUser(message);
} }
private void displayMessageToUser(String message) { private void displayMessageToUser(String message) {
Toast.makeText(mContext, message, Toast.LENGTH_LONG).show(); Toast.makeText(context, message, Toast.LENGTH_LONG).show();
} }
public void setCallback(AttachmentFileDownloadCallback callback) { public void setCallback(AttachmentFileDownloadCallback callback) {
@ -329,8 +329,8 @@ public class AttachmentView extends FrameLayout implements OnClickListener, OnLo
private Bitmap getPreviewIcon() { private Bitmap getPreviewIcon() {
Bitmap icon = null; Bitmap icon = null;
try { try {
InputStream input = mContext.getContentResolver().openInputStream( InputStream input = context.getContentResolver().openInputStream(
AttachmentProvider.getAttachmentThumbnailUri(mAccount, AttachmentProvider.getAttachmentThumbnailUri(account,
part.getAttachmentId(), part.getAttachmentId(),
62, 62,
62)); 62));