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

The following examples show how to use org.telegram.tgnet.TLRPC#InputFile . 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: ChannelCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
    AndroidUtilities.runOnUIThread(() -> {
        if (file != null) {
            uploadedAvatar = file;
            if (createAfterUpload) {
                try {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                donePressed = false;
                doneButton.performClick();
            }
            showAvatarProgress(false, true);
        } else {
            avatar = smallSize.location;
            avatarBig = bigSize.location;
            avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, null);
            showAvatarProgress(true, false);
        }
    });
}
 
Example 2
Source File: ChatEditActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
    AndroidUtilities.runOnUIThread(() -> {
        if (file != null) {
            uploadedAvatar = file;
            if (createAfterUpload) {
                try {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                donePressed = false;
                doneButton.performClick();
            }
            showAvatarProgress(false, true);
        } else {
            avatar = smallSize.location;
            avatarBig = bigSize.location;
            avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, currentChat);
            showAvatarProgress(true, false);
        }
    });
}
 
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: ChannelCreateActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
    AndroidUtilities.runOnUIThread(() -> {
        if (file != null) {
            uploadedAvatar = file;
            if (createAfterUpload) {
                try {
                    if (progressDialog != null && progressDialog.isShowing()) {
                        progressDialog.dismiss();
                        progressDialog = null;
                    }
                } catch (Exception e) {
                    FileLog.e(e);
                }
                donePressed = false;
                doneButton.performClick();
            }
            showAvatarProgress(false, true);
        } else {
            avatar = smallSize.location;
            avatarBig = bigSize.location;
            avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, null);
            showAvatarProgress(true, false);
        }
    });
}
 
Example 6
Source File: InstantCameraView.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.recordProgressChanged) {
        long t = (Long) args[0];
        progress = t / 60000.0f;
        recordedTime = t;
        invalidate();
    } else if (id == NotificationCenter.FileDidUpload) {
        final String location = (String) args[0];
        if (cameraFile != null && cameraFile.getAbsolutePath().equals(location)) {
            file = (TLRPC.InputFile) args[1];
            encryptedFile = (TLRPC.InputEncryptedFile) args[2];
            size = (Long) args[5];
            if (encryptedFile != null) {
                key = (byte[]) args[3];
                iv = (byte[]) args[4];
            }
        }
    }
}
 
Example 7
Source File: GroupCreateFinalActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
    AndroidUtilities.runOnUIThread(() -> {
        if (file != null) {
            uploadedAvatar = file;
            if (createAfterUpload) {
                if (delegate != null) {
                    delegate.didStartChatCreation();
                }
                MessagesController.getInstance(currentAccount).createChat(editText.getText().toString(), selectedContacts, null, chatType, currentGroupCreateLocation, currentGroupCreateAddress, GroupCreateFinalActivity.this);
            }
            showAvatarProgress(false, true);
            avatarEditor.setImageDrawable(null);
        } else {
            avatar = smallSize.location;
            avatarBig = bigSize.location;
            avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, null);
            showAvatarProgress(true, false);
        }
    });
}
 
Example 8
Source File: GroupCreateFinalActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didUploadPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
    AndroidUtilities.runOnUIThread(() -> {
        if (file != null) {
            uploadedAvatar = file;
            if (createAfterUpload) {
                if (delegate != null) {
                    delegate.didStartChatCreation();
                }
                MessagesController.getInstance(currentAccount).createChat(editText.getText().toString(), selectedContacts, null, chatType, currentGroupCreateLocation, currentGroupCreateAddress, GroupCreateFinalActivity.this);
            }
            showAvatarProgress(false, true);
            avatarEditor.setImageDrawable(null);
        } else {
            avatar = smallSize.location;
            avatarBig = bigSize.location;
            avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, null);
            showAvatarProgress(true, false);
        }
    });
}
 
Example 9
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 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: InstantCameraView.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.FileDidUpload) {
        final String location = (String) args[0];
        if (cameraFile != null && cameraFile.getAbsolutePath().equals(location)) {
            file = (TLRPC.InputFile) args[1];
            encryptedFile = (TLRPC.InputEncryptedFile) args[2];
            size = (Long) args[5];
            if (encryptedFile != null) {
                key = (byte[]) args[3];
                iv = (byte[]) args[4];
            }
        }
    }
}
 
Example 12
Source File: FileLoader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
void fileDidUploaded(String location, TLRPC.InputFile inputFile,
TLRPC.InputEncryptedFile inputEncryptedFile,
byte[] key, byte[] iv, long totalFileSize);
 
Example 13
Source File: FileUploadOperation.java    From TelePlus-Android with GNU General Public License v2.0 votes vote down vote up
void didFinishUploadingFile(FileUploadOperation operation, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv); 
Example 14
Source File: FileUploadOperation.java    From Telegram with GNU General Public License v2.0 votes vote down vote up
void didFinishUploadingFile(FileUploadOperation operation, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv); 
Example 15
Source File: FileUploadOperation.java    From TelePlus-Android with GNU General Public License v2.0 votes vote down vote up
void didFinishUploadingFile(FileUploadOperation operation, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv); 
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); 
Example 17
Source File: ImageUpdater.java    From Telegram-FOSS with GNU General Public License v2.0 votes vote down vote up
void didUploadPhoto(TLRPC.InputFile file, TLRPC.PhotoSize bigSize, TLRPC.PhotoSize smallSize); 
Example 18
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 19
Source File: ImageUpdater.java    From Telegram with GNU General Public License v2.0 votes vote down vote up
void didUploadPhoto(TLRPC.InputFile file, TLRPC.PhotoSize bigSize, TLRPC.PhotoSize smallSize); 
Example 20
Source File: FileLoader.java    From Telegram-FOSS with GNU General Public License v2.0 votes vote down vote up
void fileDidUploaded(String location, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv, long totalFileSize);