Java Code Examples for org.telegram.tgnet.ConnectionsManager#FileTypePhoto
The following examples show how to use
org.telegram.tgnet.ConnectionsManager#FileTypePhoto .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) { if (photoLocation instanceof TLRPC.TL_fileEncryptedLocation) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = photoLocation.volume_id; location.volume_id = photoLocation.volume_id; location.access_hash = photoLocation.secret; location.local_id = photoLocation.local_id; iv = new byte[32]; System.arraycopy(photoLocation.iv, 0, iv, 0, iv.length); key = photoLocation.key; initialDatacenterId = datacenterId = photoLocation.dc_id; } else if (photoLocation instanceof TLRPC.TL_fileLocation) { location = new TLRPC.TL_inputFileLocation(); location.volume_id = photoLocation.volume_id; location.secret = photoLocation.secret; location.local_id = photoLocation.local_id; initialDatacenterId = datacenterId = photoLocation.dc_id; allowDisordererFileSave = true; } currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 2
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getExtensionByMime(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 3
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) { if (photoLocation instanceof TLRPC.TL_fileEncryptedLocation) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = photoLocation.volume_id; location.volume_id = photoLocation.volume_id; location.access_hash = photoLocation.secret; location.local_id = photoLocation.local_id; iv = new byte[32]; System.arraycopy(photoLocation.iv, 0, iv, 0, iv.length); key = photoLocation.key; initialDatacenterId = datacenterId = photoLocation.dc_id; } else if (photoLocation instanceof TLRPC.TL_fileLocation) { location = new TLRPC.TL_inputFileLocation(); location.volume_id = photoLocation.volume_id; location.secret = photoLocation.secret; location.local_id = photoLocation.local_id; initialDatacenterId = datacenterId = photoLocation.dc_id; allowDisordererFileSave = true; } currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 4
Source File: FileLoadOperation.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getExtensionByMime(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 5
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getMimeTypePart(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 6
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 6 votes |
public FileLoadOperation(int instance, WebFile webDocument) { currentAccount = instance; webFile = webDocument; webLocation = webDocument.location; totalBytesCount = webDocument.size; initialDatacenterId = datacenterId = MessagesController.getInstance(currentAccount).webFileDatacenterId; String defaultExt = FileLoader.getMimeTypePart(webDocument.mime_type); if (webDocument.mime_type.startsWith("image/")) { currentType = ConnectionsManager.FileTypePhoto; } else if (webDocument.mime_type.equals("audio/ogg")) { currentType = ConnectionsManager.FileTypeAudio; } else if (webDocument.mime_type.startsWith("video/")) { currentType = ConnectionsManager.FileTypeVideo; } else { currentType = ConnectionsManager.FileTypeFile; } allowDisordererFileSave = true; ext = ImageLoader.getHttpUrlExtension(webDocument.url, defaultExt); }
Example 7
Source File: FileLoadOperation.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }
Example 8
Source File: FileLoadOperation.java From Telegram with GNU General Public License v2.0 | 4 votes |
public FileLoadOperation(ImageLocation imageLocation, Object parent, String extension, int size) { parentObject = parent; if (imageLocation.isEncrypted()) { location = new TLRPC.TL_inputEncryptedFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; iv = new byte[32]; System.arraycopy(imageLocation.iv, 0, iv, 0, iv.length); key = imageLocation.key; } else if (imageLocation.photoPeer != null) { location = new TLRPC.TL_inputPeerPhotoFileLocation(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.big = imageLocation.photoPeerBig; location.peer = imageLocation.photoPeer; } else if (imageLocation.stickerSet != null) { location = new TLRPC.TL_inputStickerSetThumb(); location.id = imageLocation.location.volume_id; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.stickerset = imageLocation.stickerSet; } else if (imageLocation.thumbSize != null) { if (imageLocation.photoId != 0) { location = new TLRPC.TL_inputPhotoFileLocation(); location.id = imageLocation.photoId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } else { location = new TLRPC.TL_inputDocumentFileLocation(); location.id = imageLocation.documentId; location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.access_hash = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; location.thumb_size = imageLocation.thumbSize; } if (location.file_reference == null) { location.file_reference = new byte[0]; } } else { location = new TLRPC.TL_inputFileLocation(); location.volume_id = imageLocation.location.volume_id; location.local_id = imageLocation.location.local_id; location.secret = imageLocation.access_hash; location.file_reference = imageLocation.file_reference; if (location.file_reference == null) { location.file_reference = new byte[0]; } allowDisordererFileSave = true; } ungzip = imageLocation.imageType == FileLoader.IMAGE_TYPE_LOTTIE || imageLocation.imageType == FileLoader.IMAGE_TYPE_SVG; initialDatacenterId = datacenterId = imageLocation.dc_id; currentType = ConnectionsManager.FileTypePhoto; totalBytesCount = size; ext = extension != null ? extension : "jpg"; }