mirror of https://github.com/NekoX-Dev/NekoX.git
Remove icon in ChatEditActivity and fix permission count
This commit is contained in:
parent
040500f1d9
commit
2a19e63c62
|
@ -862,7 +862,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
|
|
||||||
if ((ChatObject.isChannel(currentChat) || currentChat.gigagroup) && ChatObject.hasAdminRights(currentChat)) {
|
if ((ChatObject.isChannel(currentChat) || currentChat.gigagroup) && ChatObject.hasAdminRights(currentChat)) {
|
||||||
logCell = new TextCell(context);
|
logCell = new TextCell(context);
|
||||||
logCell.setTextAndIcon(LocaleController.getString("EventLog"), R.drawable.group_log, false);
|
logCell.setText(LocaleController.getString("EventLog", R.string.EventLog), false);
|
||||||
logCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
logCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
||||||
logCell.setOnClickListener(v -> presentFragment(new ChannelAdminLogActivity(currentChat)));
|
logCell.setOnClickListener(v -> presentFragment(new ChannelAdminLogActivity(currentChat)));
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
||||||
TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
|
TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
|
||||||
realAdminCount = res.count;
|
realAdminCount = res.count;
|
||||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", res.count), R.drawable.actions_addadmin, true);
|
adminCell.setTextAndValue(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", res.count), true);
|
||||||
}));
|
}));
|
||||||
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
|
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
|
||||||
}
|
}
|
||||||
|
@ -1420,22 +1420,25 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
memberRequestsCell.setVisibility(info.requests_pending > 0 ? View.VISIBLE : View.GONE);
|
memberRequestsCell.setVisibility(info.requests_pending > 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
if (isChannel) {
|
if (isChannel) {
|
||||||
membersCell.setTextAndValueAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), String.format("%d", info.participants_count), R.drawable.actions_viewmembers, true);
|
membersCell.setTextAndValue(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), String.format("%d", info.participants_count), true);
|
||||||
blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), String.format("%d", Math.max(info.banned_count, info.kicked_count)), R.drawable.actions_removed, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
blockCell.setTextAndValue(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), String.format("%d", Math.max(info.banned_count, info.kicked_count)), logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
if (ChatObject.isChannel(currentChat)) {
|
if (ChatObject.isChannel(currentChat)) {
|
||||||
membersCell.setTextAndValueAndIcon(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), String.format("%d", info.participants_count), R.drawable.actions_viewmembers, true);
|
membersCell.setTextAndValue(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), String.format("%d", info.participants_count), true);
|
||||||
} else {
|
} else {
|
||||||
membersCell.setTextAndValueAndIcon(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), String.format("%d", info.participants.participants.size()), R.drawable.actions_viewmembers, memberRequestsCell.getVisibility() == View.VISIBLE);
|
membersCell.setTextAndValue(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), String.format("%d", info.participants.participants.size()), memberRequestsCell.getVisibility() == View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (currentChat.gigagroup) {
|
if (currentChat.gigagroup) {
|
||||||
blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), String.format("%d", Math.max(info.banned_count, info.kicked_count)), R.drawable.actions_removed, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
blockCell.setTextAndValue(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), String.format("%d", Math.max(info.banned_count, info.kicked_count)), logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (currentChat.default_banned_rights != null) {
|
if (currentChat.default_banned_rights != null) {
|
||||||
if (!currentChat.default_banned_rights.send_stickers) {
|
if (!currentChat.default_banned_rights.send_stickers) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
if (!currentChat.default_banned_rights.send_gifs) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
if (!currentChat.default_banned_rights.send_media) {
|
if (!currentChat.default_banned_rights.send_media) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1457,13 +1460,19 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
if (!currentChat.default_banned_rights.change_info) {
|
if (!currentChat.default_banned_rights.change_info) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
if (!currentChat.default_banned_rights.send_games) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (!currentChat.default_banned_rights.send_inline) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
count = 9;
|
count = 11;
|
||||||
}
|
}
|
||||||
blockCell.setTextAndValueAndIcon(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), String.format("%d/%d", count, 9), R.drawable.actions_permissions, true);
|
blockCell.setTextAndValue(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), count + " / 11", true);
|
||||||
}
|
}
|
||||||
if (memberRequestsCell != null) {
|
if (memberRequestsCell != null) {
|
||||||
memberRequestsCell.setTextAndValueAndIcon(LocaleController.getString("MemberRequests", R.string.MemberRequests), String.format("%d", info.requests_pending), R.drawable.actions_requests, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
memberRequestsCell.setTextAndValue(LocaleController.getString("MemberRequests", R.string.MemberRequests), String.format("%d", info.requests_pending), logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// NekoX: read admins count
|
// NekoX: read admins count
|
||||||
|
@ -1473,20 +1482,20 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
getRealChannelAdminCount();
|
getRealChannelAdminCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adminCell.setTextAndValueAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", ChatObject.isChannel(currentChat) ? info.admins_count : getAdminCount()), R.drawable.actions_addadmin, true);
|
adminCell.setTextAndValue(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), String.format("%d", ChatObject.isChannel(currentChat) ? info.admins_count : getAdminCount()), true);
|
||||||
} else {
|
} else {
|
||||||
if (isChannel) {
|
if (isChannel) {
|
||||||
membersCell.setTextAndIcon(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), R.drawable.actions_viewmembers, true);
|
membersCell.setText(LocaleController.getString("ChannelSubscribers", R.string.ChannelSubscribers), true);
|
||||||
blockCell.setTextAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), R.drawable.actions_removed, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
blockCell.setText(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
membersCell.setTextAndIcon(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), R.drawable.actions_viewmembers, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
membersCell.setText(LocaleController.getString("ChannelMembers", R.string.ChannelMembers), logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
if (currentChat.gigagroup) {
|
if (currentChat.gigagroup) {
|
||||||
blockCell.setTextAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), R.drawable.actions_removed, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
blockCell.setTextAndIcon(LocaleController.getString("ChannelBlacklist", R.string.ChannelBlacklist), R.drawable.actions_removed, logCell != null && logCell.getVisibility() == View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
blockCell.setTextAndIcon(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), R.drawable.actions_permissions, true);
|
blockCell.setText(LocaleController.getString("ChannelPermissions", R.string.ChannelPermissions), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adminCell.setTextAndIcon(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), R.drawable.actions_addadmin, true);
|
adminCell.setText(LocaleController.getString("ChannelAdministrators", R.string.ChannelAdministrators), true);
|
||||||
}
|
}
|
||||||
reactionsCell.setVisibility(ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE);
|
reactionsCell.setVisibility(ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE);
|
||||||
updateReactionsCell();
|
updateReactionsCell();
|
||||||
|
@ -1494,9 +1503,9 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
inviteLinksCell.setVisibility(View.GONE);
|
inviteLinksCell.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
if (info.invitesCount > 0) {
|
if (info.invitesCount > 0) {
|
||||||
inviteLinksCell.setTextAndValueAndIcon(LocaleController.getString("InviteLinks", R.string.InviteLinks), Integer.toString(info.invitesCount), R.drawable.actions_link, true);
|
inviteLinksCell.setTextAndValue(LocaleController.getString("InviteLinks", R.string.InviteLinks), Integer.toString(info.invitesCount), true);
|
||||||
} else {
|
} else {
|
||||||
inviteLinksCell.setTextAndValueAndIcon(LocaleController.getString("InviteLinks", R.string.InviteLinks), "1", R.drawable.actions_link, true);
|
inviteLinksCell.setTextAndValue(LocaleController.getString("InviteLinks", R.string.InviteLinks), "1", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1519,8 +1528,8 @@ public class ChatEditActivity extends BaseFragment implements ImageUpdater.Image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int reacts = Math.min(getMediaDataController().getEnabledReactionsList().size(), count);
|
int reacts = Math.min(getMediaDataController().getEnabledReactionsList().size(), count);
|
||||||
reactionsCell.setTextAndValueAndIcon(LocaleController.getString("Reactions", R.string.Reactions), reacts == 0 ? LocaleController.getString("ReactionsOff", R.string.ReactionsOff) :
|
reactionsCell.setTextAndValue(LocaleController.getString("Reactions", R.string.Reactions), reacts == 0 ? LocaleController.getString("ReactionsOff", R.string.ReactionsOff) :
|
||||||
LocaleController.formatString("ReactionsCount", R.string.ReactionsCount, reacts, getMediaDataController().getEnabledReactionsList().size()), R.drawable.actions_reactions, true);
|
LocaleController.formatString("ReactionsCount", R.string.ReactionsCount, reacts, getMediaDataController().getEnabledReactionsList().size()), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue