当前位置: 首页>>代码示例>>Java>>正文


Java TLRPC.TL_documentAttributeVideo方法代码示例

本文整理汇总了Java中org.telegram.tgnet.TLRPC.TL_documentAttributeVideo方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.TL_documentAttributeVideo方法的具体用法?Java TLRPC.TL_documentAttributeVideo怎么用?Java TLRPC.TL_documentAttributeVideo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.tgnet.TLRPC的用法示例。


在下文中一共展示了TLRPC.TL_documentAttributeVideo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isVideoDocument

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isVideoDocument(TLRPC.Document document) {
    if (document != null) {
        boolean isAnimated = false;
        boolean isVideo = false;
        for (int a = 0; a < document.attributes.size(); a++) {
            TLRPC.DocumentAttribute attribute = document.attributes.get(a);
            if (attribute instanceof TLRPC.TL_documentAttributeVideo) {
                isVideo = true;
            } else if (attribute instanceof TLRPC.TL_documentAttributeAnimated) {
                isAnimated = true;
            }
        }
        return isVideo && !isAnimated;
    }
    return false;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:17,代码来源:MessageObject.java

示例2: setItem

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setItem(int a, int index, MessageObject messageObject) {
    messageObjects[a] = messageObject;
    indeces[a] = index;

    if (messageObject != null) {
        photoVideoViews[a].setVisibility(VISIBLE);

        PhotoVideoView photoVideoView = photoVideoViews[a];
        photoVideoView.imageView.getImageReceiver().setParentMessageObject(messageObject);
        photoVideoView.imageView.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(messageObject), false);
        if (messageObject.isVideo()) {
            photoVideoView.videoInfoContainer.setVisibility(VISIBLE);
            int duration = 0;
            for (int b = 0; b < messageObject.getDocument().attributes.size(); b++) {
                TLRPC.DocumentAttribute attribute = messageObject.getDocument().attributes.get(b);
                if (attribute instanceof TLRPC.TL_documentAttributeVideo) {
                    duration = attribute.duration;
                    break;
                }
            }
            int minutes = duration / 60;
            int seconds = duration - minutes * 60;
            photoVideoView.videoTextView.setText(String.format("%d:%02d", minutes, seconds));
            if (messageObject.getDocument().thumb != null) {
                TLRPC.FileLocation location = messageObject.getDocument().thumb.location;
                photoVideoView.imageView.setImage(null, null, null, ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.photo_placeholder_in), null, location, "b", null, 0);
            } else {
                photoVideoView.imageView.setImageResource(R.drawable.photo_placeholder_in);
            }
        } else if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && messageObject.messageOwner.media.photo != null && !messageObject.photoThumbs.isEmpty()) {
            photoVideoView.videoInfoContainer.setVisibility(INVISIBLE);
            TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 80);
            photoVideoView.imageView.setImage(null, null, null, ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.photo_placeholder_in), null, photoSize.location, "b", null, 0);
        } else {
            photoVideoView.videoInfoContainer.setVisibility(INVISIBLE);
            photoVideoView.imageView.setImageResource(R.drawable.photo_placeholder_in);
        }
    } else {
        photoVideoViews[a].clearAnimation();
        photoVideoViews[a].setVisibility(INVISIBLE);
        messageObjects[a] = null;
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:44,代码来源:SharedPhotoVideoCell.java


注:本文中的org.telegram.tgnet.TLRPC.TL_documentAttributeVideo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。