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


Java TLRPC.DocumentAttribute方法代码示例

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


在下文中一共展示了TLRPC.DocumentAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateWaveform

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateWaveform() {
    if (currentMessageObject == null || documentAttachType != DOCUMENT_ATTACH_TYPE_AUDIO) {
        return;
    }
    for (int a = 0; a < documentAttach.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = documentAttach.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
            if (attribute.waveform == null || attribute.waveform.length == 0) {
                MediaController.getInstance().generateWaveform(currentMessageObject);
            }
            useSeekBarWaweform = attribute.waveform != null;
            seekBarWaveform.setWaveform(attribute.waveform);
            break;
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:17,代码来源:ChatMessageCell.java

示例3: getMusicTitle

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getMusicTitle() {
    TLRPC.Document document;
    if (type == 0) {
        document = messageOwner.media.webpage.document;
    } else {
        document = messageOwner.media.document;
    }
    for (int a = 0; a < document.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = document.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
            if (attribute.voice) {
                return LocaleController.formatDateAudio(messageOwner.date);
            }
            String title = attribute.title;
            if (title == null || title.length() == 0) {
                title = FileLoader.getDocumentFileName(document);
                if (title == null || title.length() == 0) {
                    title = LocaleController.getString("AudioUnknownTitle", R.string.AudioUnknownTitle);
                }
            }
            return title;
        }
    }
    return "";
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:MessageObject.java

示例4: isStickerDocument

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

示例5: isVoiceDocument

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static boolean isVoiceDocument(TLRPC.Document document) {
    if (document != null) {
        for (int a = 0; a < document.attributes.size(); a++) {
            TLRPC.DocumentAttribute attribute = document.attributes.get(a);
            if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
                return attribute.voice;
            }
        }
    }
    return false;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:12,代码来源:MessageObject.java

示例6: isMusicDocument

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

示例7: getInputStickerSet

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static TLRPC.InputStickerSet getInputStickerSet(TLRPC.Message message) {
    if (message.media != null && message.media.document != null) {
        for (TLRPC.DocumentAttribute attribute : message.media.document.attributes) {
            if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
                if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetEmpty) {
                    return null;
                }
                return attribute.stickerset;
            }
        }
    }
    return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:14,代码来源:MessageObject.java

示例8: getStrickerChar

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getStrickerChar() {
    if (messageOwner.media != null && messageOwner.media.document != null) {
        for (TLRPC.DocumentAttribute attribute : messageOwner.media.document.attributes) {
            if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
                return attribute.alt;
            }
        }
    }
    return null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:11,代码来源:MessageObject.java

示例9: updateProgress

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void updateProgress() {
    if (currentMessageObject == null) {
        return;
    }

    if (!seekBar.isDragging()) {
        seekBar.setProgress(currentMessageObject.audioProgress);
    }

    int duration = 0;
    if (!MediaController.getInstance().isPlayingAudio(currentMessageObject)) {
        for (int a = 0; a < currentMessageObject.getDocument().attributes.size(); a++) {
            TLRPC.DocumentAttribute attribute = currentMessageObject.getDocument().attributes.get(a);
            if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
                duration = attribute.duration;
                break;
            }
        }
    } else {
        duration = currentMessageObject.audioProgressSec;
    }
    String timeString = String.format("%02d:%02d", duration / 60, duration % 60);
    if (lastTimeString == null || lastTimeString != null && !lastTimeString.equals(timeString)) {
        timeWidth = (int)Math.ceil(timePaint.measureText(timeString));
        timeLayout = new StaticLayout(timeString, timePaint, timeWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
    }
    invalidate();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:PopupAudioView.java

示例10: getMusicAuthor

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getMusicAuthor() {
    TLRPC.Document document;
    if (type == 0) {
        document = messageOwner.media.webpage.document;
    } else {
        document = messageOwner.media.document;
    }
    for (int a = 0; a < document.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = document.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
            if (attribute.voice) {
                if (isOutOwner() || messageOwner.fwd_from != null && messageOwner.fwd_from.from_id == UserConfig.getClientUserId()) {
                    return LocaleController.getString("FromYou", R.string.FromYou);
                }
                TLRPC.User user = null;
                TLRPC.Chat chat = null;
                if (messageOwner.fwd_from != null && messageOwner.fwd_from.channel_id != 0) {
                    chat = MessagesController.getInstance().getChat(messageOwner.fwd_from.channel_id);
                } else if (messageOwner.fwd_from != null && messageOwner.fwd_from.from_id != 0) {
                    user = MessagesController.getInstance().getUser(messageOwner.fwd_from.from_id);
                } else if (messageOwner.from_id < 0) {
                    chat = MessagesController.getInstance().getChat(-messageOwner.from_id);
                } else {
                    user = MessagesController.getInstance().getUser(messageOwner.from_id);
                }
                if (user != null) {
                    return UserObject.getUserName(user);
                } else if (chat != null) {
                    return chat.title;
                }
            }
            String performer = attribute.performer;
            if (performer == null || performer.length() == 0) {
                performer = LocaleController.getString("AudioUnknownArtist", R.string.AudioUnknownArtist);
            }
            return performer;
        }
    }
    return "";
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:41,代码来源:MessageObject.java

示例11: getStickerSetId

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public static long getStickerSetId(TLRPC.Document document) {
    for (int a = 0; a < document.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = document.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
            if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetID) {
                return attribute.stickerset.id;
            }
            break;
        }
    }
    return -1;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:13,代码来源:StickersQuery.java

示例12: getStickerEmoji

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public String getStickerEmoji() {
    for (int a = 0; a < messageOwner.media.document.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = messageOwner.media.document.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
            return attribute.alt != null && attribute.alt.length() > 0 ? attribute.alt : null;
        }
    }
    return null;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:10,代码来源:MessageObject.java

示例13: StickerView

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public StickerView(Context context, Point position, float angle, float scale, Size baseSize, TLRPC.Document sticker) {
    super(context, position);
    setRotation(angle);
    setScale(scale);

    this.sticker = sticker;
    this.baseSize = baseSize;

    for (int a = 0; a < sticker.attributes.size(); a++) {
        TLRPC.DocumentAttribute attribute = sticker.attributes.get(a);
        if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
            if (attribute.mask_coords != null)
                anchor = attribute.mask_coords.n;
            break;
        }
    }

    containerView = new FrameLayoutDrawer(context);
    addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    centerImage.setAspectFit(true);
    centerImage.setInvalidateAll(true);
    centerImage.setParentView(containerView);
    centerImage.setImage(sticker, null, sticker.thumb.location, null, "webp", true);

    updatePosition();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:28,代码来源:StickerView.java

示例14: setSticker

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void setSticker(TLRPC.Document document, boolean showEmoji) {
    if (document != null) {
        sticker = document;
        if (document.thumb != null) {
            imageView.setImage(document.thumb.location, null, "webp", null);
        }

        if (showEmoji) {
            boolean set = false;
            for (int a = 0; a < document.attributes.size(); a++) {
                TLRPC.DocumentAttribute attribute = document.attributes.get(a);
                if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
                    if (attribute.alt != null && attribute.alt.length() > 0) {
                        emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false));
                        set = true;
                    }
                    break;
                }
            }
            if (!set) {
                emojiTextView.setText(Emoji.replaceEmoji(StickersQuery.getEmojiForSticker(sticker.id), emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false));
            }
            emojiTextView.setVisibility(VISIBLE);
        } else {
            emojiTextView.setVisibility(INVISIBLE);
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:29,代码来源:StickerEmojiCell.java

示例15: updateTitle

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void updateTitle(boolean shutdown) {
    MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
    if (messageObject == null && shutdown || messageObject != null && !messageObject.isMusic()) {
        if (parentLayout != null && !parentLayout.fragmentsStack.isEmpty() && parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 1) == this) {
            finishFragment();
        } else {
            removeSelfFromStack();
        }
    } else {
        if (messageObject == null) {
            return;
        }
        checkIfMusicDownloaded(messageObject);
        updateProgress(messageObject);

        if (MediaController.getInstance().isAudioPaused()) {
            playButton.setImageResource(R.drawable.player_play_states);
        } else {
            playButton.setImageResource(R.drawable.player_pause_states);
        }
        if (actionBar != null) {
            actionBar.setTitle(messageObject.getMusicTitle());
            actionBar.getTitleTextView().setTextColor(0xff212121);
            actionBar.setSubtitle(messageObject.getMusicAuthor());
            actionBar.getSubtitleTextView().setTextColor(0xff8a8a8a);
        }
        AudioInfo audioInfo = MediaController.getInstance().getAudioInfo();
        if (audioInfo != null && audioInfo.getCover() != null) {
            placeholder.setImageBitmap(audioInfo.getCover());
            placeholder.setPadding(0, 0, 0, 0);
            placeholder.setScaleType(ImageView.ScaleType.CENTER_CROP);
        } else {
            placeholder.setImageResource(R.drawable.nocover);
            placeholder.setPadding(0, 0, 0, AndroidUtilities.dp(30));
            placeholder.setScaleType(ImageView.ScaleType.CENTER);
        }

        if (durationTextView != null) {
            int duration = 0;
            TLRPC.Document document = messageObject.getDocument();
            if (document != null) {
                for (int a = 0; a < document.attributes.size(); a++) {
                    TLRPC.DocumentAttribute attribute = document.attributes.get(a);
                    if (attribute instanceof TLRPC.TL_documentAttributeAudio) {
                        duration = attribute.duration;
                        break;
                    }
                }
            }
            durationTextView.setText(duration != 0 ? String.format("%d:%02d", duration / 60, duration % 60) : "-:--");
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:54,代码来源:AudioPlayerActivity.java


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