當前位置: 首頁>>代碼示例>>Java>>正文


Java Attachment類代碼示例

本文整理匯總了Java中org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment的典型用法代碼示例。如果您正苦於以下問題:Java Attachment類的具體用法?Java Attachment怎麽用?Java Attachment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Attachment類屬於org.thoughtcrime.securesms.util.SaveAttachmentTask包,在下文中一共展示了Attachment類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSaveAttachment

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void handleSaveAttachment(final MediaMmsMessageRecord message) {
  SaveAttachmentTask.showWarningDialog(getActivity(), new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
      for (Slide slide : message.getSlideDeck().getSlides()) {
        if ((slide.hasImage() || slide.hasVideo() || slide.hasAudio()) && slide.getUri() != null) {
          SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity(), masterSecret);
          saveTask.execute(new Attachment(slide.getUri(), slide.getContentType(), slide.getFilename(), message.getDateReceived()));
          return;
        }
      }

      Log.w(TAG, "No slide with attachable media found, failing nicely.");
      Toast.makeText(getActivity(),
                     getResources().getQuantityString(R.plurals.ConversationFragment_error_while_saving_attachments_to_sd_card, 1),
                     Toast.LENGTH_LONG).show();
    }
  });
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:ConversationFragment.java

示例2: handleSaveAttachment

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void handleSaveAttachment(final MediaMmsMessageRecord message) {
  SaveAttachmentTask.showWarningDialog(getActivity(), new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
      for (Slide slide : message.getSlideDeck().getSlides()) {
        if ((slide.hasImage() || slide.hasVideo() || slide.hasAudio() || slide.hasDocument()) && slide.getUri() != null) {
          SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity(), masterSecret, list);
          saveTask.execute(new Attachment(slide.getUri(), slide.getContentType(), message.getDateReceived(), slide.getFileName().orNull()));
          return;
        }
      }

      Log.w(TAG, "No slide with attachable media found, failing nicely.");
      Toast.makeText(getActivity(),
                     getResources().getQuantityString(R.plurals.ConversationFragment_error_while_saving_attachments_to_sd_card, 1),
                     Toast.LENGTH_LONG).show();
    }
  });
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:19,代碼來源:ConversationFragment.java

示例3: handleSaveAttachment

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void handleSaveAttachment(final MediaMmsMessageRecord message) {
  SaveAttachmentTask.showWarningDialog(getActivity(), new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {

      message.fetchMediaSlide(new FutureTaskListener<Slide>() {
        @Override
        public void onSuccess(Slide slide) {
          SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity(), masterSecret);
          saveTask.execute(new Attachment(slide.getUri(), slide.getContentType(), message.getDateReceived()));
        }

        @Override
        public void onFailure(Throwable error) {
          Log.w(TAG, "No slide with attachable media found, failing nicely.");
          Log.w(TAG, error);
          Toast.makeText(getActivity(), R.string.ConversationFragment_error_while_saving_attachment_to_sd_card, Toast.LENGTH_LONG).show();
        }
      });
    }
  });
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:22,代碼來源:ConversationFragment.java

示例4: saveToDisk

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void saveToDisk() {
  SaveAttachmentTask.showWarningDialog(this, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
      SaveAttachmentTask saveTask = new SaveAttachmentTask(MediaPreviewActivity.this, masterSecret);
      long saveDate = (date > 0) ? date : System.currentTimeMillis();
      saveTask.execute(new Attachment(mediaUri, mediaType, mediaName, saveDate));
    }
  });
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:11,代碼來源:MediaPreviewActivity.java

示例5: saveToDisk

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void saveToDisk() {
  SaveAttachmentTask.showWarningDialog(this, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
      SaveAttachmentTask saveTask = new SaveAttachmentTask(MediaPreviewActivity.this, masterSecret, image);
      long saveDate = (date > 0) ? date : System.currentTimeMillis();
      saveTask.execute(new Attachment(mediaUri, mediaType, saveDate, null));
    }
  });
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:11,代碼來源:MediaPreviewActivity.java

示例6: saveToDisk

import org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment; //導入依賴的package包/類
private void saveToDisk() {
  SaveAttachmentTask.showWarningDialog(this, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
      SaveAttachmentTask saveTask = new SaveAttachmentTask(MediaPreviewActivity.this, masterSecret);
      saveTask.execute(new Attachment(mediaUri, mediaType, date));
    }
  });
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:10,代碼來源:MediaPreviewActivity.java


注:本文中的org.thoughtcrime.securesms.util.SaveAttachmentTask.Attachment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。