Lines Matching refs:Attachment
42 import com.android.mail.providers.Attachment;
170 final Attachment attachment = getCurrentAttachment();
172 if (attachment != null && mSaveItem != null && mShareItem != null) {
173 mSaveItem.setEnabled(!attachment.isDownloading()
174 && attachment.canSave() && !attachment.isSavedToExternal());
175 final boolean canShare = attachment.canShare();
178 mDownloadAgainItem.setEnabled(attachment.canSave() && attachment.isDownloading());
183 mActionHandler.shouldShowExtraOption1(attachment.getContentType()));
192 List<Attachment> attachments = getAllAttachments();
195 for (final Attachment a : attachments) {
196 // If one attachment can be saved, enable save all
206 for (final Attachment a : attachments) {
235 final Attachment attachment = getCurrentAttachment();
238 mMailActivity.getContext(), attachment.size);
242 // 1. Saved, Attachment Size
244 // 3. Default, Attachment Size
245 if (attachment.isSavedToExternal()) {
247 } else if (attachment.isDownloading() &&
248 attachment.destination == UIProvider.AttachmentDestination.EXTERNAL) {
259 final Attachment attachment = getCurrentAttachment();
260 if (attachment.state == UIProvider.AttachmentState.PAUSED) {
261 mActionHandler.setAttachment(attachment);
262 mActionHandler.startDownloadingAttachment(attachment.destination);
269 updateProgressAndEmptyViews(fragment, new Attachment(cursor));
274 * state of the attachment.
278 final PhotoViewFragment fragment, final Attachment attachment) {
284 if (attachment.shouldShowProgress()) {
285 progressBar.setMax(attachment.size);
286 progressBar.setProgress(attachment.downloadedSize);
293 if (attachment.isDownloadFailed()) {
310 * Save the current attachment.
317 * Redownloads the attachment.
320 final Attachment attachment = getCurrentAttachment();
321 if (attachment != null && attachment.canSave()) {
323 // For an attachment that is downloading (or paused in the DownloadManager), we need to
325 mActionHandler.setAttachment(attachment);
327 mActionHandler.startDownloadingAttachment(attachment.destination);
332 * Saves the attachment.
333 * @param attachment the attachment to save.
335 private void saveAttachment(final Attachment attachment) {
336 if (attachment != null && attachment.canSave()) {
337 mActionHandler.setAttachment(attachment);
354 saveAttachment(new Attachment(cursor));
359 * Share the current attachment.
366 * Shares the attachment
367 * @param attachment the attachment to share
369 private void shareAttachment(final Attachment attachment) {
370 if (attachment != null) {
371 mActionHandler.setAttachment(attachment);
389 uris.add(Utils.normalizeUri(new Attachment(cursor).contentUri));
396 final Attachment attachment = getCurrentAttachment();
401 printHelper.printBitmap(PrintUtils.buildPrintJobName(context, attachment.getName()),
402 attachment.contentUri);
410 * Helper method to get the currently visible attachment.
412 protected Attachment getCurrentAttachment() {
419 return new Attachment(cursor);
422 private List<Attachment> getAllAttachments() {
429 List<Attachment> list = Lists.newArrayList();
431 list.add(new Attachment(cursor));