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


Java TLRPC.TL_document方法代码示例

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


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

示例1: stopRecordingInternal

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void stopRecordingInternal(final int send) {
    if (send != 0) {
        final TLRPC.TL_document audioToSend = recordingAudio;
        final File recordingAudioFileToSend = recordingAudioFile;
        fileEncodingQueue.postRunnable(new Runnable() {
            @Override
            public void run() {
                stopRecord();
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        audioToSend.date = ConnectionsManager.getInstance().getCurrentTime();
                        audioToSend.size = (int) recordingAudioFileToSend.length();
                        TLRPC.TL_documentAttributeAudio attributeAudio = new TLRPC.TL_documentAttributeAudio();
                        attributeAudio.voice = true;
                        attributeAudio.waveform = getWaveform2(recordSamples, recordSamples.length); //getWaveform(recordingAudioFileToSend.getAbsolutePath());
                        if (attributeAudio.waveform != null) {
                            attributeAudio.flags |= 4;
                        }
                        long duration = recordTimeCount;
                        attributeAudio.duration = (int) (recordTimeCount / 1000);
                        audioToSend.attributes.add(attributeAudio);
                        if (duration > 700) {
                            if (send == 1) {
                                SendMessagesHelper.getInstance().sendMessage(audioToSend, null, recordingAudioFileToSend.getAbsolutePath(), recordDialogId, recordReplyingMessageObject, null, null);
                            }
                            NotificationCenter.getInstance().postNotificationName(NotificationCenter.audioDidSent, send == 2 ? audioToSend : null, send == 2 ? recordingAudioFileToSend.getAbsolutePath() : null);
                        } else {
                            recordingAudioFileToSend.delete();
                        }
                    }
                });
            }
        });
    }
    try {
        if (audioRecorder != null) {
            audioRecorder.release();
            audioRecorder = null;
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    recordingAudio = null;
    recordingAudioFile = null;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:47,代码来源:MediaController.java

示例2: sendSticker

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendSticker(TLRPC.Document document, long peer, MessageObject replyingMessageObject) {
    if (document == null) {
        return;
    }
    if ((int) peer == 0) {
        int high_id = (int) (peer >> 32);
        TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance().getEncryptedChat(high_id);
        if (encryptedChat == null) {
            return;
        }
        if (document.thumb instanceof TLRPC.TL_photoSize) {
            File file = FileLoader.getPathToAttach(document.thumb, true);
            if (file.exists()) {
                try {
                    int len = (int) file.length();
                    byte[] arr = new byte[(int) file.length()];
                    RandomAccessFile reader = new RandomAccessFile(file, "r");
                    reader.readFully(arr);
                    TLRPC.TL_document newDocument = new TLRPC.TL_document();
                    newDocument.thumb = new TLRPC.TL_photoCachedSize();
                    newDocument.thumb.location = document.thumb.location;
                    newDocument.thumb.size = document.thumb.size;
                    newDocument.thumb.w = document.thumb.w;
                    newDocument.thumb.h = document.thumb.h;
                    newDocument.thumb.type = document.thumb.type;
                    newDocument.thumb.bytes = arr;

                    newDocument.id = document.id;
                    newDocument.access_hash = document.access_hash;
                    newDocument.date = document.date;
                    newDocument.mime_type = document.mime_type;
                    newDocument.size = document.size;
                    newDocument.dc_id = document.dc_id;
                    newDocument.attributes = document.attributes;
                    if (newDocument.mime_type == null) {
                        newDocument.mime_type = "";
                    }
                    document = newDocument;
                } catch (Exception e) {
                    FileLog.e("tmessages", e);
                }
            }
        }
    }
    SendMessagesHelper.getInstance().sendMessage((TLRPC.TL_document) document, null, null, peer, replyingMessageObject, null, null);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:47,代码来源:SendMessagesHelper.java

示例3: sendMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendMessage(TLRPC.TL_document document, VideoEditedInfo videoEditedInfo, String path, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> params) {
    sendMessage(null, null, null, videoEditedInfo, null, document, peer, path, reply_to_msg, null, true, null, null, replyMarkup, params);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:4,代码来源:SendMessagesHelper.java

示例4: FileLoadOperation

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public FileLoadOperation(TLRPC.Document documentLocation) {
    try {
        if (documentLocation instanceof TLRPC.TL_documentEncrypted) {
            location = new TLRPC.TL_inputEncryptedFileLocation();
            location.id = documentLocation.id;
            location.access_hash = documentLocation.access_hash;
            datacenter_id = documentLocation.dc_id;
            iv = new byte[32];
            System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length);
            key = documentLocation.key;
        } else if (documentLocation instanceof TLRPC.TL_document) {
            location = new TLRPC.TL_inputDocumentFileLocation();
            location.id = documentLocation.id;
            location.access_hash = documentLocation.access_hash;
            datacenter_id = documentLocation.dc_id;
        }
        totalBytesCount = documentLocation.size;
        if (key != null) {
            int toAdd = 0;
            if (totalBytesCount % 16 != 0) {
                bytesCountPadding = 16 - totalBytesCount % 16;
                totalBytesCount += bytesCountPadding;
            }
        }
        ext = FileLoader.getDocumentFileName(documentLocation);
        int idx;
        if (ext == null || (idx = ext.lastIndexOf('.')) == -1) {
            ext = "";
        } else {
            ext = ext.substring(idx);
        }
        if (ext.length() <= 1) {
            if (documentLocation.mime_type != null) {
                switch (documentLocation.mime_type) {
                    case "video/mp4":
                        ext = ".mp4";
                        break;
                    case "audio/ogg":
                        ext = ".ogg";
                        break;
                    default:
                        ext = "";
                        break;
                }
            } else {
                ext = "";
            }
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
        state = stateFailed;
        cleanup();
        Utilities.stageQueue.postRunnable(new Runnable() {
            @Override
            public void run() {
                delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
            }
        });
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:61,代码来源:FileLoadOperation.java

示例5: sendMessage

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public void sendMessage(TLRPC.TL_document document, VideoEditedInfo videoEditedInfo, String path, long peer, MessageObject reply_to_msg, TLRPC.ReplyMarkup replyMarkup, HashMap<String, String> params) {
    sendMessage(null, null, null, videoEditedInfo, null, document, null, peer, path, reply_to_msg, null, true, null, null, replyMarkup, params);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:4,代码来源:SendMessagesHelper.java

示例6: FileLoadOperation

import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
public FileLoadOperation(TLRPC.Document documentLocation) {
    try {
        if (documentLocation instanceof TLRPC.TL_documentEncrypted) {
            location = new TLRPC.TL_inputEncryptedFileLocation();
            location.id = documentLocation.id;
            location.access_hash = documentLocation.access_hash;
            datacenter_id = documentLocation.dc_id;
            iv = new byte[32];
            System.arraycopy(documentLocation.iv, 0, iv, 0, iv.length);
            key = documentLocation.key;
        } else if (documentLocation instanceof TLRPC.TL_document) {
            location = new TLRPC.TL_inputDocumentFileLocation();
            location.id = documentLocation.id;
            location.access_hash = documentLocation.access_hash;
            datacenter_id = documentLocation.dc_id;
        }
        totalBytesCount = documentLocation.size;
        if (key != null) {
            int toAdd = 0;
            if (totalBytesCount % 16 != 0) {
                bytesCountPadding = 16 - totalBytesCount % 16;
                totalBytesCount += bytesCountPadding;
            }
        }
        ext = FileLoader.getDocumentFileName(documentLocation);
        int idx;
        if (ext == null || (idx = ext.lastIndexOf('.')) == -1) {
            ext = "";
        } else {
            ext = ext.substring(idx);
        }
        if (ext.length() <= 1) {
            if (documentLocation.mime_type != null) {
                switch (documentLocation.mime_type) {
                    case "video/mp4":
                        ext = ".mp4";
                        break;
                    case "audio/ogg":
                        ext = ".ogg";
                        break;
                    default:
                        ext = "";
                        break;
                }
            } else {
                ext = "";
            }
        }
    } catch (Exception e) {
        FileLog.e("tmessages", e);
        onFail(true, 0);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:54,代码来源:FileLoadOperation.java


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