fix: sendMedia cannot expand

This commit is contained in:
xtaodada 2023-06-07 22:18:25 +08:00
parent 640ab74b48
commit 0d6e27edfa
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -719,6 +719,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
if (listAdapter) { if (listAdapter) {
if (isExpandableSendMediaRow(position)) { if (isExpandableSendMediaRow(position)) {
CheckBoxCell checkBoxCell = (CheckBoxCell) view; CheckBoxCell checkBoxCell = (CheckBoxCell) view;
if (!checkBoxCell.isEnabled()) return;
if (position == sendMediaPhotosRow) { if (position == sendMediaPhotosRow) {
defaultBannedRights.send_photos = !defaultBannedRights.send_photos; defaultBannedRights.send_photos = !defaultBannedRights.send_photos;
} else if (position == sendMediaVideosRow) { } else if (position == sendMediaVideosRow) {
@ -1008,6 +1009,14 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
return; return;
} else if (position > permissionsSectionRow && position <= Math.max(manageTopicsRow, changeInfoRow)) { } else if (position > permissionsSectionRow && position <= Math.max(manageTopicsRow, changeInfoRow)) {
TextCheckCell2 checkCell = (TextCheckCell2) view; 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()) { if (!checkCell.isEnabled()) {
return; return;
} }
@ -1019,14 +1028,14 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
} }
return; return;
} }
if (position == sendMediaRow) { // if (position == sendMediaRow) {
//defaultBannedRights.send_media = !defaultBannedRights.send_media; // //defaultBannedRights.send_media = !defaultBannedRights.send_media;
DiffCallback diffCallback = saveState(); // DiffCallback diffCallback = saveState();
sendMediaExpanded = !sendMediaExpanded; // sendMediaExpanded = !sendMediaExpanded;
AndroidUtilities.updateVisibleRows(listView); // AndroidUtilities.updateVisibleRows(listView);
updateListAnimated(diffCallback); // updateListAnimated(diffCallback);
return; // return;
} // }
checkCell.setChecked(!checkCell.isChecked()); checkCell.setChecked(!checkCell.isChecked());
if (position == changeInfoRow) { if (position == changeInfoRow) {
defaultBannedRights.change_info = !defaultBannedRights.change_info; defaultBannedRights.change_info = !defaultBannedRights.change_info;
@ -3025,7 +3034,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
} }
} }
if (viewType == VIEW_TYPE_INNER_CHECK) { if (viewType == VIEW_TYPE_INNER_CHECK) {
return true; return ChatObject.canBlockUsers(currentChat);
} }
return false; return false;
} }
@ -3370,6 +3379,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
checkCell.setCollapseArrow(String.format(Locale.US, "%d/9", sentMediaCount), !sendMediaExpanded, new Runnable() { checkCell.setCollapseArrow(String.format(Locale.US, "%d/9", sentMediaCount), !sendMediaExpanded, new Runnable() {
@Override @Override
public void run() { public void run() {
if (!checkCell.isEnabled()) return;
boolean checked = !checkCell.isChecked(); boolean checked = !checkCell.isChecked();
checkCell.setChecked(checked); checkCell.setChecked(checked);
setSendMediaEnabled(checked); setSendMediaEnabled(checked);