Skip to content

Commit

Permalink
fix: optimize hide phone
Browse files Browse the repository at this point in the history
1. use Hidden as Text when hide phone switched on
2. add hide option to MyProfile

Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Dec 29, 2024
1 parent 6b87b45 commit f4d0df4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -787,11 +787,8 @@ public void setUser(TLRPC.User user, boolean accounts) {
status.setColor(Theme.getColor(Theme.isCurrentThemeDark() ? Theme.key_chats_verifiedBackground : Theme.key_chats_menuPhoneCats));
if (!Config.hidePhone) {
phoneTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
} else if (!TextUtils.isEmpty(user.username)) {
phoneTextView.setText("@" + user.username);
} else {
// phoneTextView.setText(LocaleController.getString("MobileHidden", R.string.MobileHidden));
phoneTextView.setVisibility(GONE);
phoneTextView.setText(LocaleController.getString(R.string.hidePhone));
}
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));
Expand Down
10 changes: 6 additions & 4 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11886,10 +11886,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
} else {
value = LocaleController.getString(R.string.NumberUnknown);
}
} else if (!TextUtils.isEmpty(user.username)) {
value = "@" + user.username;
} else {
value = "@???";
value = LocaleController.getString(R.string.PhoneHidden);
}
detailCell.setTextAndValue(value, LocaleController.getString(R.string.TapToChangePhone), true);
detailCell.setContentDescriptionValueFirst(false);
Expand Down Expand Up @@ -14490,9 +14488,13 @@ private boolean editRow(View view, int position) {
presentFragment(new UserInfoActivity());
});
} else if (position == phoneRow) {
itemOptions.add(R.drawable.profile_phone, getString(R.string.ProfilePhoneEdit), () -> {
itemOptions.add(R.drawable.msg_newphone, getString(R.string.ProfilePhoneEdit), () -> {
presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
});
itemOptions.add(R.drawable.msg_block2, getString(R.string.Hide), () -> {
hidePhone = true;
updateListAnimated(false);
});
} else if (position == birthdayRow) {
itemOptions.add(R.drawable.msg_edit, getString(R.string.ProfileBirthdayChange), () -> {
showDialog(AlertsCreator.createBirthdayPickerDialog(getContext(), getString(R.string.EditProfileBirthdayTitle), getString(R.string.EditProfileBirthdayButton), userFull.birthday, birthday -> {
Expand Down

0 comments on commit f4d0df4

Please sign in to comment.