Java Code Examples for org.telegram.tgnet.TLRPC#TL_secureFile

The following examples show how to use org.telegram.tgnet.TLRPC#TL_secureFile . 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: ChannelEditInfoActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(() -> {
        uploadedAvatar = file;
        avatar = small.location;
        avatarImage.setImage(avatar, "50_50", avatarDrawable);
        if (createAfterUpload) {
            try {
                if (progressDialog != null && progressDialog.isShowing()) {
                    progressDialog.dismiss();
                    progressDialog = null;
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
            donePressed = false;
            doneButton.performClick();
        }
    });
}
 
Example 2
Source File: ChannelCreateActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload) {
                try {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                donePressed = false;
                doneButton.performClick();
            }
        }
    });
}
 
Example 3
Source File: ChannelEditInfoActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(() -> {
        uploadedAvatar = file;
        avatar = small.location;
        avatarImage.setImage(avatar, "50_50", avatarDrawable);
        if (createAfterUpload) {
            try {
                if (progressDialog != null && progressDialog.isShowing()) {
                    progressDialog.dismiss();
                    progressDialog = null;
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
            donePressed = false;
            doneButton.performClick();
        }
    });
}
 
Example 4
Source File: ChannelCreateActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload) {
                try {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                donePressed = false;
                doneButton.performClick();
            }
        }
    });
}
 
Example 5
Source File: SecureDocument.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SecureDocument(SecureDocumentKey key, TLRPC.TL_secureFile file, String p, byte[] fh, byte[] secret) {
    secureDocumentKey = key;
    secureFile = file;
    path = p;
    fileHash = fh;
    fileSecret = secret;
}
 
Example 6
Source File: ChangeChatNameActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile)
{
    AndroidUtilities.runOnUIThread(new Runnable()
    {
        @Override
        public void run()
        {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload)
            {
                donePressed = false;
                try
                {
                    if (progressDialog != null && progressDialog.isShowing())
                    {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                }
                catch (Exception e)
                {
                    FileLog.e(e);
                }
                doneButton.performClick();
            }
        }
    });
}
 
Example 7
Source File: GroupCreateFinalActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload) {
                MessagesController.getInstance(currentAccount).createChat(editText.getText().toString(), selectedContacts, null, chatType, GroupCreateFinalActivity.this);
            }
        }
    });
}
 
Example 8
Source File: ImageUpdater.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void processBitmap(Bitmap bitmap) {
    if (bitmap == null) {
        return;
    }
    if (encryptedDocument) {
        bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 2048, 2048, 89, false, 320, 320);
        if (delegate != null) {
            TLRPC.TL_secureFile secureFile = new TLRPC.TL_secureFile();
            secureFile.dc_id = (int) bigPhoto.location.volume_id;
            secureFile.id = bigPhoto.location.local_id;
            secureFile.date = (int) (System.currentTimeMillis() / 1000);
            delegate.didUploadedPhoto(null, null, null, secureFile);
        }
        SharedConfig.saveConfig();
    } else {
        smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 100, 100, 80, false);
        bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false, 320, 320);
        bitmap.recycle();
        if (bigPhoto != null && smallPhoto != null) {
            if (returnOnly) {
                if (delegate != null) {
                    delegate.didUploadedPhoto(null, smallPhoto, bigPhoto, null);
                }
            } else {
                UserConfig.getInstance(currentAccount).saveConfig(false);
                uploadingImage = FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE) + "/" + bigPhoto.location.volume_id + "_" + bigPhoto.location.local_id + ".jpg";
                NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidUpload);
                NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidFailUpload);
                FileLoader.getInstance(currentAccount).uploadFile(uploadingImage, false, true, ConnectionsManager.FileTypePhoto);
            }
        }
    }
}
 
Example 9
Source File: SecureDocument.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SecureDocument(SecureDocumentKey key, TLRPC.TL_secureFile file, String p, byte[] fh, byte[] secret) {
    secureDocumentKey = key;
    secureFile = file;
    path = p;
    fileHash = fh;
    fileSecret = secret;
}
 
Example 10
Source File: ChangeChatNameActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile)
{
    AndroidUtilities.runOnUIThread(new Runnable()
    {
        @Override
        public void run()
        {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload)
            {
                donePressed = false;
                try
                {
                    if (progressDialog != null && progressDialog.isShowing())
                    {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                }
                catch (Exception e)
                {
                    FileLog.e(e);
                }
                doneButton.performClick();
            }
        }
    });
}
 
Example 11
Source File: GroupCreateFinalActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big, final TLRPC.TL_secureFile secureFile) {
    AndroidUtilities.runOnUIThread(new Runnable() {
        @Override
        public void run() {
            uploadedAvatar = file;
            avatar = small.location;
            avatarImage.setImage(avatar, "50_50", avatarDrawable);
            if (createAfterUpload) {
                MessagesController.getInstance(currentAccount).createChat(editText.getText().toString(), selectedContacts, null, chatType, GroupCreateFinalActivity.this);
            }
        }
    });
}
 
Example 12
Source File: ImageUpdater.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void processBitmap(Bitmap bitmap) {
    if (bitmap == null) {
        return;
    }
    if (encryptedDocument) {
        bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 2048, 2048, 89, false, 320, 320);
        if (delegate != null) {
            TLRPC.TL_secureFile secureFile = new TLRPC.TL_secureFile();
            secureFile.dc_id = (int) bigPhoto.location.volume_id;
            secureFile.id = bigPhoto.location.local_id;
            secureFile.date = (int) (System.currentTimeMillis() / 1000);
            delegate.didUploadedPhoto(null, null, null, secureFile);
        }
        SharedConfig.saveConfig();
    } else {
        smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 100, 100, 80, false);
        bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false, 320, 320);
        bitmap.recycle();
        if (bigPhoto != null && smallPhoto != null) {
            if (returnOnly) {
                if (delegate != null) {
                    delegate.didUploadedPhoto(null, smallPhoto, bigPhoto, null);
                }
            } else {
                UserConfig.getInstance(currentAccount).saveConfig(false);
                uploadingImage = FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE) + "/" + bigPhoto.location.volume_id + "_" + bigPhoto.location.local_id + ".jpg";
                NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidUpload);
                NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidFailUpload);
                FileLoader.getInstance(currentAccount).uploadFile(uploadingImage, false, true, ConnectionsManager.FileTypePhoto);
            }
        }
    }
}
 
Example 13
Source File: SecureDocument.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public SecureDocument(SecureDocumentKey key, TLRPC.TL_secureFile file, String p, byte[] fh, byte[] secret) {
    secureDocumentKey = key;
    secureFile = file;
    path = p;
    fileHash = fh;
    fileSecret = secret;
}
 
Example 14
Source File: SecureDocument.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public SecureDocument(SecureDocumentKey key, TLRPC.TL_secureFile file, String p, byte[] fh, byte[] secret) {
    secureDocumentKey = key;
    secureFile = file;
    path = p;
    fileHash = fh;
    fileSecret = secret;
}
 
Example 15
Source File: ImageUpdater.java    From TelePlus-Android with GNU General Public License v2.0 votes vote down vote up
void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big, TLRPC.TL_secureFile secureFile); 
Example 16
Source File: ImageUpdater.java    From TelePlus-Android with GNU General Public License v2.0 votes vote down vote up
void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big, TLRPC.TL_secureFile secureFile);