Lines Matching refs:Attachment
42 import com.android.mail.providers.Attachment;
172 final Attachment attachment = getCurrentAttachment();
174 if (attachment != null && mSaveItem != null && mShareItem != null) {
175 mSaveItem.setEnabled(!attachment.isDownloading()
176 && attachment.canSave() && !attachment.isSavedToExternal());
177 final boolean canShare = attachment.canShare();
180 mDownloadAgainItem.setEnabled(attachment.canSave() && attachment.isDownloading());
183 attachment.getContentType()));
191 List<Attachment> attachments = getAllAttachments();
194 for (final Attachment a : attachments) {
195 // If one attachment can be saved, enable save all
205 for (final Attachment a : attachments) {
234 final Attachment attachment = getCurrentAttachment();
237 mMailActivity.getContext(), attachment.size);
241 // 1. Saved, Attachment Size
243 // 3. Default, Attachment Size
244 if (attachment.isSavedToExternal()) {
246 } else if (attachment.isDownloading() &&
247 attachment.destination == UIProvider.AttachmentDestination.EXTERNAL) {
258 final Attachment attachment = getCurrentAttachment();
259 if (attachment.state == UIProvider.AttachmentState.PAUSED) {
260 mActionHandler.setAttachment(attachment);
261 mActionHandler.startDownloadingAttachment(attachment.destination);
268 updateProgressAndEmptyViews(fragment, new Attachment(cursor));
273 * state of the attachment.
277 final PhotoViewFragment fragment, final Attachment attachment) {
283 if (attachment.shouldShowProgress()) {
284 progressBar.setMax(attachment.size);
285 progressBar.setProgress(attachment.downloadedSize);
292 if (attachment.isDownloadFailed()) {
309 * Save the current attachment.
316 * Redownloads the attachment.
319 final Attachment attachment = getCurrentAttachment();
320 if (attachment != null && attachment.canSave()) {
322 // For an attachment that is downloading (or paused in the DownloadManager), we need to
324 mActionHandler.setAttachment(attachment);
326 mActionHandler.startDownloadingAttachment(attachment.destination);
331 * Saves the attachment.
332 * @param attachment the attachment to save.
334 private void saveAttachment(final Attachment attachment) {
335 if (attachment != null && attachment.canSave()) {
336 mActionHandler.setAttachment(attachment);
353 saveAttachment(new Attachment(cursor));
358 * Share the current attachment.
365 * Shares the attachment
366 * @param attachment the attachment to share
368 private void shareAttachment(final Attachment attachment) {
369 if (attachment != null) {
370 mActionHandler.setAttachment(attachment);
388 uris.add(Utils.normalizeUri(new Attachment(cursor).contentUri));
395 final Attachment attachment = getCurrentAttachment();
400 printHelper.printBitmap(PrintUtils.buildPrintJobName(context, attachment.getName()),
401 attachment.contentUri);
409 * Helper method to get the currently visible attachment.
411 protected Attachment getCurrentAttachment() {
418 return new Attachment(cursor);
421 private List<Attachment> getAllAttachments() {
428 List<Attachment> list = Lists.newArrayList();
430 list.add(new Attachment(cursor));