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


Java Slide類代碼示例

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


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

示例1: getSlideForAttachment

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
public static Slide getSlideForAttachment(Context context, Attachment attachment) {
  Slide slide = null;
  if (isGif(attachment.getContentType())) {
    slide = new GifSlide(context, attachment);
  } else if (ContentType.isImageType(attachment.getContentType())) {
    slide = new ImageSlide(context, attachment);
  } else if (ContentType.isVideoType(attachment.getContentType())) {
    slide = new VideoSlide(context, attachment);
  } else if (ContentType.isAudioType(attachment.getContentType())) {
    slide = new AudioSlide(context, attachment);
  } else if (isMms(attachment.getContentType())) {
    slide = new MmsSlide(context, attachment);
  } else if (ContentType.isFileType(attachment.getContentType())) {
    slide = new FileSlide(context, attachment);
  }

  return slide;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:19,代碼來源:MediaUtil.java

示例2: getDraftsForCurrentState

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private Drafts getDraftsForCurrentState() {
  Drafts drafts = new Drafts();

  if (!Util.isEmpty(composeText)) {
    drafts.add(new Draft(Draft.TEXT, composeText.getText().toString()));
  }

  for (Slide slide : attachmentManager.buildSlideDeck().getSlides()) {
    if      (slide.hasAudio() && slide.getUri() != null)    drafts.add(new Draft(Draft.AUDIO, slide.getUri().toString()));
    else if (slide.hasVideo() && slide.getUri() != null)    drafts.add(new Draft(Draft.VIDEO, slide.getUri().toString()));
    else if (slide.hasLocation())                           drafts.add(new Draft(Draft.LOCATION, ((LocationSlide)slide).getPlace().serialize()));
    else if (slide.hasImage() && slide.getUri() != null)    drafts.add(new Draft(Draft.IMAGE, slide.getUri().toString()));
  }

  return drafts;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:17,代碼來源:ConversationActivity.java

示例3: handleSaveAttachment

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的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

示例4: getSlideForAttachment

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
public static Slide getSlideForAttachment(Context context, Attachment attachment) {
  Slide slide = null;
  if (isGif(attachment.getContentType())) {
    slide = new GifSlide(context, attachment);
  } else if (isImageType(attachment.getContentType())) {
    slide = new ImageSlide(context, attachment);
  } else if (isVideoType(attachment.getContentType())) {
    slide = new VideoSlide(context, attachment);
  } else if (isAudioType(attachment.getContentType())) {
    slide = new AudioSlide(context, attachment);
  } else if (isMms(attachment.getContentType())) {
    slide = new MmsSlide(context, attachment);
  } else if (attachment.getContentType() != null) {
    slide = new DocumentSlide(context, attachment);
  }

  return slide;
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:19,代碼來源:MediaUtil.java

示例5: getDraftsForCurrentState

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private Drafts getDraftsForCurrentState() {
    Drafts drafts = new Drafts();

    if (!Util.isEmpty(composeText)) {
      drafts.add(new Draft(Draft.TEXT, composeText.getTextTrimmed()));
    }

    for (Slide slide : attachmentManager.buildSlideDeck().getSlides()) {
      if      (slide.hasAudio() && slide.getUri() != null)    drafts.add(new Draft(Draft.AUDIO, slide.getUri().toString()));
      else if (slide.hasVideo() && slide.getUri() != null)    drafts.add(new Draft(Draft.VIDEO, slide.getUri().toString()));
// Location-TODO      else if (slide.hasLocation())                           drafts.add(new Draft(Draft.LOCATION, ((LocationSlide)slide).getPlace().serialize()));
      else if (slide.hasImage() && slide.getUri() != null)    drafts.add(new Draft(Draft.IMAGE, slide.getUri().toString()));
    }

    return drafts;
  }
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:17,代碼來源:ConversationActivity.java

示例6: handleForwardMessage

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private void handleForwardMessage(MessageRecord message) {
  Intent composeIntent = new Intent(getActivity(), ShareActivity.class);
  composeIntent.putExtra(Intent.EXTRA_TEXT, message.getDisplayBody().toString());
  if (message.isMms()) {
    MediaMmsMessageRecord mediaMessage = (MediaMmsMessageRecord) message;
    if (mediaMessage.containsMediaSlide()) {
      Slide slide = mediaMessage.getSlideDeck().getSlides().get(0);
      composeIntent.putExtra(Intent.EXTRA_STREAM, slide.getUri());
      composeIntent.setType(slide.getContentType());
    }
  }
  startActivity(composeIntent);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:14,代碼來源:ConversationFragment.java

示例7: handleSaveAttachment

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的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

示例8: fetchMediaSlide

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
public void fetchMediaSlide(final FutureTaskListener<Slide> listener) {
  slideDeckFutureTask.addListener(new FutureTaskListener<SlideDeck>() {
    @Override
    public void onSuccess(SlideDeck deck) {
      for (Slide slide : deck.getSlides()) {
        if (slide.hasImage() || slide.hasVideo() || slide.hasAudio()) {
          listener.onSuccess(slide);
          return;
        }
      }
      listener.onFailure(new MediaNotFoundException("no media slide found"));
    }

    @Override
    public void onFailure(Throwable error) {
      listener.onFailure(error);
    }
  });
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:20,代碼來源:MediaMmsMessageRecord.java

示例9: handleSaveAttachment

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的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

示例10: hasBigPictureSlide

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private boolean hasBigPictureSlide(@Nullable SlideDeck slideDeck) {
  if (masterSecret == null || slideDeck == null || Build.VERSION.SDK_INT < 16) {
    return false;
  }

  Slide thumbnailSlide = slideDeck.getThumbnailSlide();

  return thumbnailSlide != null         &&
         thumbnailSlide.hasImage()      &&
         !thumbnailSlide.isInProgress() &&
         thumbnailSlide.getThumbnailUri() != null;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:13,代碼來源:SingleRecipientNotificationBuilder.java

示例11: onClick

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
@Override
public void onClick(View v, final Slide slide) {
  if (messageRecord.isMmsNotification()) {
    ApplicationContext.getInstance(context)
                      .getJobManager()
                      .add(new MmsDownloadJob(context, messageRecord.getId(),
                                              messageRecord.getThreadId(), false));
  } else {
    DatabaseFactory.getAttachmentDatabase(context).setTransferState(messageRecord.getId(),
                                                                    slide.asAttachment(),
                                                                    AttachmentDatabase.TRANSFER_PROGRESS_STARTED);
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:14,代碼來源:ConversationItem.java

示例12: fireIntent

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private void fireIntent(Slide slide) {
  Log.w(TAG, "Clicked: " + slide.getUri() + " , " + slide.getContentType());
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  intent.setDataAndType(PartAuthority.getAttachmentPublicUri(slide.getUri()), slide.getContentType());
  try {
    context.startActivity(intent);
  } catch (ActivityNotFoundException anfe) {
    Log.w(TAG, "No activity existed to view the media.");
    Toast.makeText(context, R.string.ConversationItem_unable_to_open_media, Toast.LENGTH_LONG).show();
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:13,代碼來源:ConversationItem.java

示例13: onBindItemViewHolder

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
@Override
public void onBindItemViewHolder(final ViewHolder viewHolder, final @NonNull Cursor cursor) {
  final ThumbnailView imageView   = viewHolder.imageView;
  final MediaRecord   mediaRecord = MediaRecord.from(cursor);

  Slide slide = MediaUtil.getSlideForAttachment(getContext(), mediaRecord.getAttachment());

  if (slide != null) {
    imageView.setImageResource(masterSecret, slide, false);
  }

  imageView.setOnClickListener(new OnMediaClickListener(mediaRecord));
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:14,代碼來源:MediaAdapter.java

示例14: isMediaPending

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
@Override
public boolean isMediaPending() {
  for (Slide slide : getSlideDeck().getSlides()) {
    if (slide.isInProgress() || slide.isPendingDownload()) {
      return true;
    }
  }

  return false;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:11,代碼來源:MmsMessageRecord.java

示例15: getAttachmentUriFor

import org.thoughtcrime.securesms.mms.Slide; //導入依賴的package包/類
private @Nullable Uri getAttachmentUriFor(MessageRecord record) {
  if (!record.isMms() || record.isMmsNotification() || record.isGroupAction()) return null;

  SlideDeck slideDeck = ((MediaMmsMessageRecord)record).getSlideDeck();
  Slide     thumbnail = slideDeck.getThumbnailSlide();

  return thumbnail != null ? thumbnail.getThumbnailUri() : null;
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:9,代碼來源:ThreadDatabase.java


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