当前位置: 首页>>代码示例>>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;未经允许,请勿转载。