feat: Allow Ban In Join Requests List
This commit is contained in:
parent
df8a3aa9bd
commit
81d63a1dd9
@ -88,6 +88,27 @@ public class MemberRequestCell extends FrameLayout {
|
|||||||
dismissLayoutParams.leftMargin = LocaleController.isRTL ? 0 : (int)(addButtonWidth + AndroidUtilities.dp(73 + 6));
|
dismissLayoutParams.leftMargin = LocaleController.isRTL ? 0 : (int)(addButtonWidth + AndroidUtilities.dp(73 + 6));
|
||||||
dismissLayoutParams.rightMargin = LocaleController.isRTL ? (int)(addButtonWidth + AndroidUtilities.dp(73 + 6)) : 0;
|
dismissLayoutParams.rightMargin = LocaleController.isRTL ? (int)(addButtonWidth + AndroidUtilities.dp(73 + 6)) : 0;
|
||||||
addView(dismissButton, dismissLayoutParams);
|
addView(dismissButton, dismissLayoutParams);
|
||||||
|
|
||||||
|
float dismissButtonWidth = dismissButton.getPaint().measureText(dismissButton.getText().toString()) + btnPadding * 2;
|
||||||
|
TextView banButton = new TextView(getContext());
|
||||||
|
banButton.setBackground(Theme.AdaptiveRipple.filledRect(Theme.key_featuredStickers_addButton, 4));
|
||||||
|
banButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
|
||||||
|
banButton.setMaxLines(1);
|
||||||
|
banButton.setPadding(btnPadding, 0, btnPadding, 0);
|
||||||
|
banButton.setText(LocaleController.getString("KickFromGroup", R.string.KickFromGroup));
|
||||||
|
banButton.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText));
|
||||||
|
banButton.setTextSize(14);
|
||||||
|
banButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
|
banButton.setOnClickListener(v -> {
|
||||||
|
if (clickListener != null && importer != null) {
|
||||||
|
clickListener.onBanClicked(importer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
FrameLayout.LayoutParams banLayoutParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, AndroidUtilities.dp(32), LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||||
|
banLayoutParams.topMargin = AndroidUtilities.dp(62);
|
||||||
|
banLayoutParams.leftMargin = LocaleController.isRTL ? 0 : (int)(addButtonWidth + dismissButtonWidth + AndroidUtilities.dp(73 + 6));
|
||||||
|
banLayoutParams.rightMargin = LocaleController.isRTL ? (int)(addButtonWidth + dismissButtonWidth + AndroidUtilities.dp(73 + 6)) : 0;
|
||||||
|
addView(banButton, banLayoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(LongSparseArray<TLRPC.User> users, TLRPC.TL_chatInviteImporter importer, boolean isNeedDivider) {
|
public void setData(LongSparseArray<TLRPC.User> users, TLRPC.TL_chatInviteImporter importer, boolean isNeedDivider) {
|
||||||
@ -143,5 +164,7 @@ public class MemberRequestCell extends FrameLayout {
|
|||||||
void onAddClicked(TLRPC.TL_chatInviteImporter importer);
|
void onAddClicked(TLRPC.TL_chatInviteImporter importer);
|
||||||
|
|
||||||
void onDismissClicked(TLRPC.TL_chatInviteImporter importer);
|
void onDismissClicked(TLRPC.TL_chatInviteImporter importer);
|
||||||
|
|
||||||
|
void onBanClicked(TLRPC.TL_chatInviteImporter importer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,6 +388,20 @@ public class MemberRequestsDelegate implements MemberRequestCell.OnClickListener
|
|||||||
hideChatJoinRequest(importer, false);
|
hideChatJoinRequest(importer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBanClicked(TLRPC.TL_chatInviteImporter importer) {
|
||||||
|
kickUser(importer);
|
||||||
|
hideChatJoinRequest(importer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void kickUser(TLRPC.TL_chatInviteImporter importer) {
|
||||||
|
TLRPC.User user = users.get(importer.user_id);
|
||||||
|
if (user == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fragment.getMessagesController().deleteParticipantFromChat(chatId, user);
|
||||||
|
}
|
||||||
|
|
||||||
public void setAdapterItemsEnabled(boolean adapterItemsEnabled) {
|
public void setAdapterItemsEnabled(boolean adapterItemsEnabled) {
|
||||||
if (recyclerView != null) {
|
if (recyclerView != null) {
|
||||||
int position = adapter.extraFirstHolders();
|
int position = adapter.extraFirstHolders();
|
||||||
@ -735,7 +749,7 @@ public class MemberRequestsDelegate implements MemberRequestCell.OnClickListener
|
|||||||
});
|
});
|
||||||
popupLayout.addView(sendMsgCell);
|
popupLayout.addView(sendMsgCell);
|
||||||
|
|
||||||
ActionBarMenuSubItem dismissCell = new ActionBarMenuSubItem(context, false, true);
|
ActionBarMenuSubItem dismissCell = new ActionBarMenuSubItem(context, false, false);
|
||||||
dismissCell.setColors(Theme.getColor(Theme.key_dialogTextRed2, resourcesProvider), Theme.getColor(Theme.key_dialogRedIcon, resourcesProvider));
|
dismissCell.setColors(Theme.getColor(Theme.key_dialogTextRed2, resourcesProvider), Theme.getColor(Theme.key_dialogRedIcon, resourcesProvider));
|
||||||
dismissCell.setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector, resourcesProvider));
|
dismissCell.setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector, resourcesProvider));
|
||||||
dismissCell.setTextAndIcon(LocaleController.getString("DismissRequest", R.string.DismissRequest), R.drawable.msg_remove);
|
dismissCell.setTextAndIcon(LocaleController.getString("DismissRequest", R.string.DismissRequest), R.drawable.msg_remove);
|
||||||
@ -746,6 +760,18 @@ public class MemberRequestsDelegate implements MemberRequestCell.OnClickListener
|
|||||||
hidePreview();
|
hidePreview();
|
||||||
});
|
});
|
||||||
popupLayout.addView(dismissCell);
|
popupLayout.addView(dismissCell);
|
||||||
|
|
||||||
|
ActionBarMenuSubItem banCell = new ActionBarMenuSubItem(context, false, true);
|
||||||
|
banCell.setColors(Theme.getColor(Theme.key_dialogTextRed2, resourcesProvider), Theme.getColor(Theme.key_dialogRedIcon, resourcesProvider));
|
||||||
|
banCell.setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector, resourcesProvider));
|
||||||
|
banCell.setTextAndIcon(LocaleController.getString("KickFromGroup", R.string.KickFromGroup), R.drawable.profile_ban);
|
||||||
|
banCell.setOnClickListener((v) -> {
|
||||||
|
if (importer != null) {
|
||||||
|
onBanClicked(importer);
|
||||||
|
}
|
||||||
|
hidePreview();
|
||||||
|
});
|
||||||
|
popupLayout.addView(banCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user