Skip to content

Commit

Permalink
fix: add back change avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Jan 1, 2024
1 parent ecf9e73 commit eeb0c04
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5741,7 +5741,38 @@ private void openAvatar() {
private void onWriteButtonClick() {
if (userId != 0) {
if (imageUpdater != null) {
presentFragment(new ChangeNameActivity(resourcesProvider));
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
if (user == null) {
user = UserConfig.getInstance(currentAccount).getCurrentUser();
}
if (user == null) {
return;
}
imageUpdater.openMenu(user.photo != null && user.photo.photo_big != null && !(user.photo instanceof TLRPC.TL_userProfilePhotoEmpty), () -> {
MessagesController.getInstance(currentAccount).deleteUserPhoto(null);
cameraDrawable.setCurrentFrame(0);
cellCameraDrawable.setCurrentFrame(0);
}, dialog -> {
if (!imageUpdater.isUploadingImage()) {
cameraDrawable.setCustomEndFrame(86);
cellCameraDrawable.setCustomEndFrame(86);
writeButton.playAnimation();
if (setAvatarCell != null) {
setAvatarCell.getImageView().playAnimation();
}
} else {
cameraDrawable.setCurrentFrame(0, false);
cellCameraDrawable.setCurrentFrame(0, false);
}
}, 0);
cameraDrawable.setCurrentFrame(0);
cameraDrawable.setCustomEndFrame(43);
cellCameraDrawable.setCurrentFrame(0);
cellCameraDrawable.setCustomEndFrame(43);
writeButton.playAnimation();
if (setAvatarCell != null) {
setAvatarCell.getImageView().playAnimation();
}
} else {
if (playProfileAnimation != 0 && parentLayout.getFragmentStack().get(parentLayout.getFragmentStack().size() - 2) instanceof ChatActivity) {
finishFragment();
Expand Down Expand Up @@ -10852,7 +10883,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
} else if (position == setAvatarRow) {
cellCameraDrawable.setCustomEndFrame(86);
cellCameraDrawable.setCurrentFrame(85, false);
textCell.setTextAndIcon(LocaleController.getString("EditName", R.string.EditName), R.drawable.msg_edit, false);
textCell.setTextAndIcon(LocaleController.getString("SetProfilePhoto", R.string.SetProfilePhoto), cellCameraDrawable, false);
textCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton);
textCell.getImageView().setPadding(0, 0, 0, AndroidUtilities.dp(8));
textCell.setImageLeft(12);
Expand Down

0 comments on commit eeb0c04

Please sign in to comment.