1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-04 11:13:36 +00:00

Improve direct send in linked group

This commit is contained in:
世界 2021-04-19 20:19:06 +08:00
parent 379bac4fef
commit 22d8712fb0
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -2007,7 +2007,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
imageView.setRoundRadius(AndroidUtilities.dp(20)); imageView.setRoundRadius(AndroidUtilities.dp(20));
frameLayout.addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 22, 5, 22, 0)); frameLayout.addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 22, 5, 22, 0));
avatarDrawable.setInfo(currentChat); avatarDrawable.setInfo(currentChat);
imageView.setImage(ImageLocation.getForChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, currentChat); imageView.setImage(ImageLocation.getForChat(currentChat, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, currentChat);
TextView textView = new TextView(context); TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem)); textView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
@ -3644,9 +3644,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE || bottomOverlayChat != null && bottomOverlayChat.getVisibility() == View.VISIBLE ||
currentChat != null && (ChatObject.isNotInChat(currentChat) && !isThreadChat() || ChatObject.isChannel(currentChat) && !ChatObject.canPost(currentChat) && !currentChat.megagroup || !ChatObject.canSendMessages(currentChat)) || currentChat != null && (ChatObject.isNotInChat(currentChat) && !isThreadChat() || ChatObject.isChannel(currentChat) && !ChatObject.canPost(currentChat) && !currentChat.megagroup || !ChatObject.canSendMessages(currentChat)) ||
textSelectionHelper.isSelectionMode()) { textSelectionHelper.isSelectionMode()) {
slidingView.setSlidingOffset(0); if (!canSendInCommentGroup()) {
slidingView = null; slidingView.setSlidingOffset(0);
return; slidingView = null;
return;
}
} }
startedTrackingPointerId = e.getPointerId(0); startedTrackingPointerId = e.getPointerId(0);
maybeStartTrackingSlidingView = true; maybeStartTrackingSlidingView = true;
@ -17069,20 +17071,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
bottomOverlayChat.setVisibility(View.INVISIBLE); bottomOverlayChat.setVisibility(View.INVISIBLE);
chatActivityEnterView.setFieldFocused(); chatActivityEnterView.setFieldFocused();
AndroidUtilities.runOnUIThread(() -> chatActivityEnterView.openKeyboard(), 100); AndroidUtilities.runOnUIThread(() -> chatActivityEnterView.openKeyboard(), 100);
} else { } else if (!canSendInCommentGroup()) {
boolean showEnter = false; bottomOverlayChat.setVisibility(View.VISIBLE);
if (currentChat != null && currentChat.megagroup && chatInfo != null && chatInfo.linked_chat_id != 0) { chatActivityEnterView.setFieldFocused(false);
TLRPC.Chat linked = getMessagesController().getChat(chatInfo.linked_chat_id); chatActivityEnterView.setVisibility(View.INVISIBLE);
showEnter = !ChatObject.isKickedFromChat(linked); chatActivityEnterView.closeKeyboard();
} if (stickersAdapter != null) {
if (!showEnter) { stickersAdapter.hide();
bottomOverlayChat.setVisibility(View.VISIBLE);
chatActivityEnterView.setFieldFocused(false);
chatActivityEnterView.setVisibility(View.INVISIBLE);
chatActivityEnterView.closeKeyboard();
if (stickersAdapter != null) {
stickersAdapter.hide();
}
} }
} }
if (attachItem != null) { if (attachItem != null) {
@ -18985,6 +18980,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
currentChat != null && (ChatObject.isNotInChat(currentChat) && !isThreadChat() || ChatObject.isChannel(currentChat) && !ChatObject.canPost(currentChat) && !currentChat.megagroup || !ChatObject.canSendMessages(currentChat))) { currentChat != null && (ChatObject.isNotInChat(currentChat) && !isThreadChat() || ChatObject.isChannel(currentChat) && !ChatObject.canPost(currentChat) && !currentChat.megagroup || !ChatObject.canSendMessages(currentChat))) {
allowChatActions = false; allowChatActions = false;
} }
allowChatActions |= canSendInCommentGroup();
if (single || type < 2 || type == 20) { if (single || type < 2 || type == 20) {
if (getParentActivity() == null) { if (getParentActivity() == null) {
@ -22136,7 +22132,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
new String[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("ShareQRCode", R.string.ShareQRCode)}, new String[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("ShareQRCode", R.string.ShareQRCode)},
new int[]{R.drawable.baseline_open_in_browser_24, R.drawable.baseline_content_copy_24, R.drawable.wallet_qr}, (which, text, __) -> { new int[]{R.drawable.baseline_open_in_browser_24, R.drawable.baseline_content_copy_24, R.drawable.wallet_qr}, (which, text, __) -> {
if (which == 0) { if (which == 0) {
processExternalUrl(1, urlFinal, false); processExternalUrl(1, urlFinal, false);
} else if (which == 1) { } else if (which == 1) {
String url1 = urlFinal; String url1 = urlFinal;
boolean tel = false; boolean tel = false;
@ -24671,4 +24667,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
} }
} }
private boolean canSendInCommentGroup() {
//currentChat是群组
return currentChat != null && currentChat.megagroup && chatInfo != null && chatInfo.linked_chat_id != 0;
}
} }