use of org.telegram.messenger.ImageLoader in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatAvatarContainer method openProfile.
private void openProfile(boolean byAvatar) {
if (byAvatar && (AndroidUtilities.isTablet() || AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y || !avatarImageView.getImageReceiver().hasNotThumb())) {
byAvatar = false;
}
TLRPC.User user = parentFragment.getCurrentUser();
TLRPC.Chat chat = parentFragment.getCurrentChat();
ImageReceiver imageReceiver = avatarImageView.getImageReceiver();
String key = imageReceiver.getImageKey();
ImageLoader imageLoader = ImageLoader.getInstance();
if (key != null && !imageLoader.isInMemCache(key, false)) {
Drawable drawable = imageReceiver.getDrawable();
if (drawable instanceof BitmapDrawable) {
imageLoader.putImageToCache((BitmapDrawable) drawable, key, false);
}
}
if (user != null) {
Bundle args = new Bundle();
if (UserObject.isUserSelf(user)) {
args.putLong("dialog_id", parentFragment.getDialogId());
int[] media = new int[MediaDataController.MEDIA_TYPES_COUNT];
System.arraycopy(sharedMediaPreloader.getLastMediaCount(), 0, media, 0, media.length);
MediaActivity fragment = new MediaActivity(args, sharedMediaPreloader);
fragment.setChatInfo(parentFragment.getCurrentChatInfo());
parentFragment.presentFragment(fragment);
} else {
args.putLong("user_id", user.id);
args.putBoolean("reportSpam", parentFragment.hasReportSpam());
if (timeItem != null) {
args.putLong("dialog_id", parentFragment.getDialogId());
}
args.putInt("actionBarColor", getThemedColor(Theme.key_actionBarDefault));
ProfileActivity fragment = new ProfileActivity(args, sharedMediaPreloader);
fragment.setUserInfo(parentFragment.getCurrentUserInfo());
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
parentFragment.presentFragment(fragment);
}
} else if (chat != null) {
Bundle args = new Bundle();
args.putLong("chat_id", chat.id);
ProfileActivity fragment = new ProfileActivity(args, sharedMediaPreloader);
fragment.setChatInfo(parentFragment.getCurrentChatInfo());
fragment.setPlayProfileAnimation(byAvatar ? 2 : 1);
parentFragment.presentFragment(fragment);
}
}
Aggregations