From 490bb70c73bbaaf80afcec159f3779e78162706f Mon Sep 17 00:00:00 2001 From: xtaodada Date: Wed, 7 Jun 2023 22:18:25 +0800 Subject: [PATCH] fix: sendMedia cannot expand --- .../org/telegram/ui/ChatUsersActivity.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index e12288555b..5505149728 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -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) { @@ -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; } @@ -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; @@ -3025,7 +3034,7 @@ public boolean isEnabled(RecyclerView.ViewHolder holder) { } } if (viewType == VIEW_TYPE_INNER_CHECK) { - return true; + return ChatObject.canBlockUsers(currentChat); } return false; } @@ -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);