Skip to content

Commit

Permalink
fix: sendMedia cannot expand
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Jun 7, 2023
1 parent 4969677 commit 490bb70
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ protected void onChangeAnimationUpdate(RecyclerView.ViewHolder holder) {
if (listAdapter) {
if (isExpandableSendMediaRow(position)) {
CheckBoxCell checkBoxCell = (CheckBoxCell) view;
if (!checkBoxCell.isEnabled()) return;
if (position == sendMediaPhotosRow) {
defaultBannedRights.send_photos = !defaultBannedRights.send_photos;
} else if (position == sendMediaVideosRow) {
Expand Down Expand Up @@ -1008,6 +1009,14 @@ protected void onCancel() {
return;
} else if (position > permissionsSectionRow && position <= Math.max(manageTopicsRow, changeInfoRow)) {
TextCheckCell2 checkCell = (TextCheckCell2) view;
if (position == sendMediaRow) {
//defaultBannedRights.send_media = !defaultBannedRights.send_media;
DiffCallback diffCallback = saveState();
sendMediaExpanded = !sendMediaExpanded;
AndroidUtilities.updateVisibleRows(listView);
updateListAnimated(diffCallback);
return;
}
if (!checkCell.isEnabled()) {
return;
}
Expand All @@ -1019,14 +1028,14 @@ protected void onCancel() {
}
return;
}
if (position == sendMediaRow) {
//defaultBannedRights.send_media = !defaultBannedRights.send_media;
DiffCallback diffCallback = saveState();
sendMediaExpanded = !sendMediaExpanded;
AndroidUtilities.updateVisibleRows(listView);
updateListAnimated(diffCallback);
return;
}
// if (position == sendMediaRow) {
// //defaultBannedRights.send_media = !defaultBannedRights.send_media;
// DiffCallback diffCallback = saveState();
// sendMediaExpanded = !sendMediaExpanded;
// AndroidUtilities.updateVisibleRows(listView);
// updateListAnimated(diffCallback);
// return;
// }
checkCell.setChecked(!checkCell.isChecked());
if (position == changeInfoRow) {
defaultBannedRights.change_info = !defaultBannedRights.change_info;
Expand Down Expand Up @@ -3025,7 +3034,7 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) {
}
}
if (viewType == VIEW_TYPE_INNER_CHECK) {
return true;
return ChatObject.canBlockUsers(currentChat);
}
return false;
}
Expand Down Expand Up @@ -3370,6 +3379,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
checkCell.setCollapseArrow(String.format(Locale.US, "%d/9", sentMediaCount), !sendMediaExpanded, new Runnable() {
@Override
public void run() {
if (!checkCell.isEnabled()) return;
boolean checked = !checkCell.isChecked();
checkCell.setChecked(checked);
setSendMediaEnabled(checked);
Expand Down

0 comments on commit 490bb70

Please sign in to comment.