diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java index 03017f5b66..9a3f4f9273 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatEditActivity.java @@ -1911,9 +1911,6 @@ private void updateFields(boolean updateChat, boolean animated) { if (!currentChat.default_banned_rights.send_plain) { count++; } - if (!currentChat.default_banned_rights.send_gifs) { - count++; - } count += ChatUsersActivity.getSendMediaSelectedCount(currentChat.default_banned_rights); if (!currentChat.default_banned_rights.pin_messages) { count++; @@ -1927,16 +1924,10 @@ private void updateFields(boolean updateChat, boolean animated) { if (!currentChat.default_banned_rights.change_info) { count++; } - if (!currentChat.default_banned_rights.send_games) { - count++; - } - if (!currentChat.default_banned_rights.send_inline) { - count++; - } } else { - count = forum ? 14 : 13; + count = forum ? 17 : 16; } - blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), String.format("%d/%d", count, forum ? 14 : 13), R.drawable.msg_permissions, true); + blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), String.format("%d/%d", count, forum ? 17 : 16), R.drawable.msg_permissions, true); } if (memberRequestsCell != null) { memberRequestsCell.setTextAndValueAndIcon(LocaleController.getString("MemberRequests", R.string.MemberRequests), String.format("%d", info.requests_pending), R.drawable.msg_requests, logCell != null && logCell.getVisibility() == View.VISIBLE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java index d81f294e24..09ac6fae30 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatRightsEditActivity.java @@ -157,10 +157,10 @@ public class ChatRightsEditActivity extends BaseFragment { private int sendRoundRow; private int sendStickersRow; -// private int sendGamesRow; -// private int sendInlineRow; -// -// private int sendGifsRow; + private int sendGamesRow; + private int sendInlineRow; + + private int sendGifsRow; private int sendPollsRow; private int embedLinksRow; private int startVoiceChatRow; @@ -824,7 +824,13 @@ public void onScrollStateChanged(RecyclerView recyclerView, int newState) { } else if (position == sendVoiceRow) { value = bannedRights.send_voices = !bannedRights.send_voices; } else if (position == sendStickersRow) { - value = bannedRights.send_stickers = bannedRights.send_games = bannedRights.send_gifs = bannedRights.send_inline = !bannedRights.send_stickers; + value = bannedRights.send_stickers = !bannedRights.send_stickers; + } else if (position == sendGifsRow) { + value = bannedRights.send_gifs = !bannedRights.send_gifs; + } else if (position == sendGamesRow) { + value = bannedRights.send_games = !bannedRights.send_games; + } else if (position == sendInlineRow) { + value = bannedRights.send_inline = !bannedRights.send_inline; } else if (position == embedLinksRow) { if (bannedRights.send_plain || defaultBannedRights.send_plain) { View senMessagesView = linearLayoutManager.findViewByPosition(sendMessagesRow); @@ -1165,6 +1171,9 @@ private void updateRows(boolean update) { sendVoiceRow = -1; sendRoundRow = -1; sendStickersRow = -1; + sendGifsRow = -1; + sendGamesRow = -1; + sendInlineRow = -1; sendPollsRow = -1; embedLinksRow = -1; startVoiceChatRow = -1; @@ -1220,6 +1229,9 @@ private void updateRows(boolean update) { sendVoiceRow = rowCount++; sendRoundRow = rowCount++; sendStickersRow = rowCount++; + sendGifsRow = rowCount++; + sendGamesRow = rowCount++; + sendInlineRow = rowCount++; sendPollsRow = rowCount++; embedLinksRow = rowCount++; } @@ -1739,8 +1751,18 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { boolean animated = checkBoxCell.getTag() != null && (Integer) checkBoxCell.getTag() == position; checkBoxCell.setTag(position); if (position == sendStickersRow) { - checkBoxCell.setText(LocaleController.getString("SendMediaPermissionStickersGifs", R.string.SendMediaPermissionStickersGifs), "", !bannedRights.send_stickers && !defaultBannedRights.send_stickers, true, animated); + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendStickers2", R.string.UserRestrictionsSendStickers2), "", !bannedRights.send_stickers && !defaultBannedRights.send_stickers, true, animated); +// checkBoxCell.setText(LocaleController.getString("SendMediaPermissionStickersGifs", R.string.SendMediaPermissionStickersGifs), "", !bannedRights.send_stickers && !defaultBannedRights.send_stickers, true, animated); checkBoxCell.setIcon(defaultBannedRights.send_stickers ? R.drawable.permission_locked : 0); + } else if (position == sendGifsRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendGifs", R.string.UserRestrictionsSendGifs), "", !bannedRights.send_gifs && !defaultBannedRights.send_gifs, true, animated); + checkBoxCell.setIcon(defaultBannedRights.send_gifs ? R.drawable.permission_locked : 0); + } else if (position == sendGamesRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendGames", R.string.UserRestrictionsSendGames), "", !bannedRights.send_games && !defaultBannedRights.send_games, true, animated); + checkBoxCell.setIcon(defaultBannedRights.send_games ? R.drawable.permission_locked : 0); + } else if (position == sendInlineRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendInline", R.string.UserRestrictionsSendInline), "", !bannedRights.send_inline && !defaultBannedRights.send_inline, true, animated); + checkBoxCell.setIcon(defaultBannedRights.send_inline ? R.drawable.permission_locked : 0); } else if (position == embedLinksRow) { checkBoxCell.setText(LocaleController.getString("UserRestrictionsEmbedLinks", R.string.UserRestrictionsEmbedLinks), "", !bannedRights.embed_links && !defaultBannedRights.embed_links && !bannedRights.send_plain && !defaultBannedRights.send_plain, true, animated); checkBoxCell.setIcon(defaultBannedRights.embed_links ? R.drawable.permission_locked : 0); @@ -1843,7 +1865,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (position == sendMediaRow) { int sentMediaCount = getSendMediaSelectedCount(); checkCell.setTextAndCheck(LocaleController.getString("UserRestrictionsSendMedia", R.string.UserRestrictionsSendMedia), sentMediaCount > 0, true, true); - checkCell.setCollapseArrow(String.format(Locale.US, "%d/9", sentMediaCount), !sendMediaExpanded, () -> { + checkCell.setCollapseArrow(String.format(Locale.US, "%d/12", sentMediaCount), !sendMediaExpanded, () -> { if (allDefaultMediaBanned()) { new AlertDialog.Builder(getParentActivity()) .setTitle(LocaleController.getString("UserRestrictionsCantModify", R.string.UserRestrictionsCantModify)) @@ -2167,7 +2189,7 @@ private boolean allDefaultMediaBanned() { } private boolean isExpandableSendMediaRow(int position) { - if (position == sendStickersRow || position == embedLinksRow || position == sendPollsRow || + if (position == sendStickersRow || position == sendGifsRow || position == sendGamesRow || position == sendInlineRow || position == embedLinksRow || position == sendPollsRow || position == sendPhotosRow || position == sendVideosRow || position == sendFilesRow || position == sendMusicRow || position == sendRoundRow || position == sendVoiceRow || position == channelPostMessagesRow || position == channelEditMessagesRow || position == channelDeleteMessagesRow || diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java index dcaac72c69..9d5bf0343f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatUsersActivity.java @@ -125,6 +125,10 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente private int sendMediaPhotosRow; private int sendMediaVideosRow; private int sendMediaStickerGifsRow; + private int sendMediaGamesRow; + private int sendMediaInlineRow; + + private int sendMediaGifsRow; private int sendMediaMusicRow; private int sendMediaFilesRow; private int sendMediaVoiceMessagesRow; @@ -320,6 +324,9 @@ private void updateRows() { sendMediaPhotosRow = -1; sendMediaVideosRow = -1; sendMediaStickerGifsRow = -1; + sendMediaGifsRow = -1; + sendMediaGamesRow = -1; + sendMediaInlineRow = -1; sendMediaMusicRow = -1; sendMediaFilesRow = -1; sendMediaVoiceMessagesRow = -1; @@ -335,6 +342,9 @@ private void updateRows() { sendMediaPhotosRow = rowCount++; sendMediaVideosRow = rowCount++; sendMediaStickerGifsRow = rowCount++; + sendMediaGifsRow = rowCount++; + sendMediaGamesRow = rowCount++; + sendMediaInlineRow = rowCount++; sendMediaMusicRow = rowCount++; sendMediaFilesRow = rowCount++; sendMediaVoiceMessagesRow = rowCount++; @@ -731,7 +741,13 @@ protected void onChangeAnimationUpdate(RecyclerView.ViewHolder holder) { } else if (position == sendMediaVideosRow) { defaultBannedRights.send_videos = !defaultBannedRights.send_videos; } else if (position == sendMediaStickerGifsRow) { - defaultBannedRights.send_stickers = defaultBannedRights.send_games = defaultBannedRights.send_gifs = defaultBannedRights.send_inline = !defaultBannedRights.send_stickers; + defaultBannedRights.send_stickers = !defaultBannedRights.send_stickers; + } else if (position == sendMediaGifsRow) { + defaultBannedRights.send_gifs = !defaultBannedRights.send_gifs; + } else if (position == sendMediaGamesRow) { + defaultBannedRights.send_games = !defaultBannedRights.send_games; + } else if (position == sendMediaInlineRow) { + defaultBannedRights.send_inline = !defaultBannedRights.send_inline; } else if (position == sendMediaMusicRow) { defaultBannedRights.send_audios = !defaultBannedRights.send_audios; } else if (position == sendMediaFilesRow) { @@ -3313,7 +3329,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { } else if (position == sendMediaRow) { int sentMediaCount = getSendMediaSelectedCount(); checkCell.setTextAndCheck(LocaleController.getString("UserRestrictionsSendMedia", R.string.UserRestrictionsSendMedia), sentMediaCount > 0, true, animated); - checkCell.setCollapseArrow(String.format(Locale.US, "%d/9", sentMediaCount), !sendMediaExpanded, new Runnable() { + checkCell.setCollapseArrow(String.format(Locale.US, "%d/12", sentMediaCount), !sendMediaExpanded, new Runnable() { @Override public void run() { if (!checkCell.isEnabled()) return; @@ -3393,7 +3409,14 @@ public void run() { } else if (position == sendMediaVideosRow) { checkBoxCell.setText(LocaleController.getString("SendMediaPermissionVideos", R.string.SendMediaPermissionVideos), "", !defaultBannedRights.send_videos, true, animated); } else if (position == sendMediaStickerGifsRow) { - checkBoxCell.setText(LocaleController.getString("SendMediaPermissionStickersGifs", R.string.SendMediaPermissionStickersGifs), "", !defaultBannedRights.send_stickers, true, animated); + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendStickers2", R.string.UserRestrictionsSendStickers2), "", !defaultBannedRights.send_stickers, true, animated); +// checkBoxCell.setText(LocaleController.getString("SendMediaPermissionStickersGifs", R.string.SendMediaPermissionStickersGifs), "", !defaultBannedRights.send_stickers, true, animated); + } else if (position == sendMediaGifsRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendGifs", R.string.UserRestrictionsSendGifs), "", !defaultBannedRights.send_gifs, true, animated); + } else if (position == sendMediaGamesRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendGames", R.string.UserRestrictionsSendGames), "", !defaultBannedRights.send_games, true, animated); + } else if (position == sendMediaInlineRow) { + checkBoxCell.setText(LocaleController.getString("UserRestrictionsSendInline", R.string.UserRestrictionsSendInline), "", !defaultBannedRights.send_inline, true, animated); } else if (position == sendMediaMusicRow) { checkBoxCell.setText(LocaleController.getString("SendMediaPermissionMusic", R.string.SendMediaPermissionMusic), "", !defaultBannedRights.send_audios, true, animated); } else if (position == sendMediaFilesRow) { @@ -3486,7 +3509,7 @@ private void setSendMediaEnabled(boolean enabled) { } private boolean isExpandableSendMediaRow(int position) { - return position == sendMediaPhotosRow || position == sendMediaVideosRow || position == sendMediaStickerGifsRow || + return position == sendMediaPhotosRow || position == sendMediaVideosRow || position == sendMediaStickerGifsRow || position == sendMediaGifsRow || position == sendMediaGamesRow || position == sendMediaInlineRow || position == sendMediaMusicRow || position == sendMediaFilesRow || position == sendMediaVoiceMessagesRow || position == sendMediaVideoMessagesRow || position == sendMediaEmbededLinksRow || position == sendPollsRow; } @@ -3649,6 +3672,15 @@ public static int getSendMediaSelectedCount(TLRPC.TL_chatBannedRights bannedRigh if (!bannedRights.send_stickers) { i++; } + if (!bannedRights.send_gifs) { + i++; + } + if (!bannedRights.send_games) { + i++; + } + if (!bannedRights.send_inline) { + i++; + } if (!bannedRights.send_audios) { i++; }