diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 29dca66cd..844d17d2e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -209,11 +209,11 @@ public class Theme { public static Drawable broadcastMediaDrawable; public static Drawable errorDrawable; public static Drawable systemDrawable; - public static Drawable backgroundBluePressed; + //public static Drawable backgroundBluePressed; public static Drawable timeBackgroundDrawable; public static Drawable timeStickerBackgroundDrawable; - public static Drawable botLink; - public static Drawable botInline; + //public static Drawable botLink; + //public static Drawable botInline; public static Drawable[] clockChannelDrawable = new Drawable[2]; public static Drawable[] cornerOuter = new Drawable[4]; @@ -270,8 +270,8 @@ public class Theme { broadcastDrawable = context.getResources().getDrawable(R.drawable.broadcast3); broadcastMediaDrawable = context.getResources().getDrawable(R.drawable.broadcast4); systemDrawable = context.getResources().getDrawable(R.drawable.system); - botLink = context.getResources().getDrawable(R.drawable.bot_link); - botInline = context.getResources().getDrawable(R.drawable.bot_lines); + //botLink = context.getResources().getDrawable(R.drawable.bot_link); + //botInline = context.getResources().getDrawable(R.drawable.bot_lines); viewsCountDrawable[0] = context.getResources().getDrawable(R.drawable.post_views); viewsCountDrawable[1] = context.getResources().getDrawable(R.drawable.post_views_s); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java index 185fa140e..030ab6825 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/MentionsAdapter.java @@ -174,9 +174,11 @@ public class MentionsAdapter extends BaseSearchAdapterRecycler { botInfo = info; } + /* public void setBotsCount(int count) { botsCount = count; } + */ @Override public void clearRecentHashtags() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 1eb937801..d8cab8bed 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -83,7 +83,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate void didPressedImage(ChatMessageCell cell); void didPressedShare(ChatMessageCell cell); void didPressedOther(ChatMessageCell cell); - void didPressedBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button); + //void didPressedBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button); boolean needPlayAudio(MessageObject messageObject); boolean canPerformActions(); } @@ -96,6 +96,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private final static int DOCUMENT_ATTACH_TYPE_MUSIC = 5; private final static int DOCUMENT_ATTACH_TYPE_STICKER = 6; + /* private class BotButton { private int x; private int y; @@ -107,6 +108,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private float progressAlpha; private long lastUpdateTime; } + */ private int textX; private int textY; @@ -219,10 +221,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate private StaticLayout performerLayout; private int performerX; - private ArrayList botButtons = new ArrayList<>(); - private HashMap botButtonsByData = new HashMap<>(); - private int widthForButtons; - private int pressedBotButton; + //private ArrayList botButtons = new ArrayList<>(); + //private HashMap botButtonsByData = new HashMap<>(); + //private int widthForButtons; + //private int pressedBotButton; // private int TAG; @@ -895,6 +897,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return result; } + /* private boolean checkBotButtonMotionEvent(MotionEvent event) { if (botButtons.isEmpty()) { return false; @@ -933,6 +936,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } return result; } + */ @Override public boolean onTouchEvent(MotionEvent event) { @@ -958,13 +962,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (!result) { result = checkPhotoImageMotionEvent(event); } - if (!result) { + /*if (!result) { result = checkBotButtonMotionEvent(event); - } + }*/ if (event.getAction() == MotionEvent.ACTION_CANCEL) { buttonPressed = 0; - pressedBotButton = -1; + //pressedBotButton = -1; linkPreviewPressed = false; otherPressed = false; imagePressed = false; @@ -1445,9 +1449,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate return; } resetPressedLink(-1); - if (buttonPressed != 0 || pressedBotButton != -1) { + if (buttonPressed != 0 /*|| pressedBotButton != -1*/) { buttonPressed = 0; - pressedBotButton = -1; + //pressedBotButton = -1; invalidate(); } if (delegate != null) { @@ -1754,7 +1758,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate hasLinkPreview = false; linkPreviewPressed = false; buttonPressed = 0; - pressedBotButton = -1; + //pressedBotButton = -1; linkPreviewHeight = 0; mediaOffsetY = 0; documentAttachType = DOCUMENT_ATTACH_TYPE_NONE; @@ -2719,10 +2723,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } - botButtons.clear(); + /*botButtons.clear(); if (messageIdChanged) { botButtonsByData.clear(); - } + }*/ /* EDIT BY MR if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) { @@ -3379,6 +3383,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate radialProgress.draw(canvas); } + /* if (!botButtons.isEmpty()) { int addX; if (currentMessageObject.isOutOwner()) { @@ -3440,6 +3445,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } } + */ } private Drawable getDrawableForCurrentState() { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 843df3af8..464d57f27 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -316,10 +316,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private HashMap botInfo = new HashMap<>(); private String botUser; private long inlineReturn; - private MessageObject botButtons; - private MessageObject botReplyButtons; - private int botsCount; - private boolean hasBotsCommands; + //private MessageObject botButtons; + //private MessageObject botReplyButtons; + //private int botsCount; + //private boolean hasBotsCommands; private long chatEnterTime = 0; private long chatLeaveTime = 0; @@ -1550,9 +1550,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatListView.setOnInterceptTouchListener(new RecyclerListView.OnInterceptTouchListener() { @Override public boolean onInterceptTouchEvent(MotionEvent event) { - if (chatActivityEnterView != null && chatActivityEnterView.isEditingMessage()) { + /*if (chatActivityEnterView != null && chatActivityEnterView.isEditingMessage()) { return true; - } + }*/ if (actionBar.isActionModeShowed()) { return false; } @@ -2134,7 +2134,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not mentionsAdapter.setChatInfo(info); mentionsAdapter.setNeedUsernames(currentChat != null); mentionsAdapter.setNeedBotContext(currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 46); - mentionsAdapter.setBotsCount(currentChat != null ? botsCount : 1); + //mentionsAdapter.setBotsCount(currentChat != null ? botsCount : 1); mentionListView.setOnItemClickListener(mentionsOnItemClickListener = new RecyclerListView.OnItemClickListener() { @Override public void onItemClick(View view, int position) { @@ -2275,7 +2275,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatActivityEnterView.setDialogId(dialog_id); chatActivityEnterView.addToAttachLayout(menuItem); chatActivityEnterView.setId(id_chat_compose_panel); - chatActivityEnterView.setBotsCount(botsCount, hasBotsCommands); + //chatActivityEnterView.setBotsCount(botsCount, hasBotsCommands); chatActivityEnterView.setAllowStickersAndGifs(currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 23, currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 46); contentView.addView(chatActivityEnterView, contentView.getChildCount() - 1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM)); chatActivityEnterView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() { @@ -2663,7 +2663,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatListView.setEmptyView(emptyViewContainer); } - chatActivityEnterView.setButtons(userBlocked ? null : botButtons); + //chatActivityEnterView.setButtons(userBlocked ? null : botButtons); if (!AndroidUtilities.isTablet() || AndroidUtilities.isSmallTablet()) { contentView.addView(playerView = new PlayerView(context, this), LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0)); @@ -4374,6 +4374,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not */ } + /* private void updateBotButtons() { if (headerItem == null || currentUser == null || currentEncryptedChat != null || !currentUser.bot) { return; @@ -4407,6 +4408,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not headerItem.hideSubItem(bot_settings); } } + */ private void updateTitleIcons() { if (avatarContainer == null) { @@ -5656,12 +5658,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MessagesController.getInstance().loadMessages(dialog_id, 30, 0, !cacheEndReached[0], minDate[0], classGuid, 0, 0, ChatObject.isChannel(currentChat), lastLoadIndex++); loading = true; } else { - if (botButtons != null) { + /*if (botButtons != null) { botButtons = null; if (chatActivityEnterView != null) { chatActivityEnterView.setButtons(null, false); } - } + }*/ if (currentEncryptedChat == null && currentUser != null && currentUser.bot && botUser == null) { botUser = ""; updateBottomOverlay(); @@ -5781,9 +5783,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not SendMessagesHelper.getInstance().setCurrentChatInfo(info); } if (info instanceof TLRPC.TL_chatFull) { - hasBotsCommands = false; + //hasBotsCommands = false; botInfo.clear(); - botsCount = 0; + //botsCount = 0; URLSpanBotCommand.enabled = false; for (int a = 0; a < info.participants.participants.size(); a++) { TLRPC.ChatParticipant participant = info.participants.participants.get(a); @@ -5800,18 +5802,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatListView.invalidateViews(); } } else if (info instanceof TLRPC.TL_channelFull) { - hasBotsCommands = false; + //hasBotsCommands = false; botInfo.clear(); - botsCount = 0; + //botsCount = 0; URLSpanBotCommand.enabled = !info.bot_info.isEmpty(); - botsCount = info.bot_info.size(); + /*botsCount = info.bot_info.size(); for (int a = 0; a < info.bot_info.size(); a++) { TLRPC.BotInfo bot = info.bot_info.get(a); if (!bot.commands.isEmpty() && (!ChatObject.isChannel(currentChat) || currentChat != null && currentChat.megagroup)) { hasBotsCommands = true; } botInfo.put(bot.user_id, bot); - } + }*/ if (chatListView != null) { chatListView.invalidateViews(); } @@ -5819,12 +5821,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not mentionsAdapter.setBotInfo(botInfo); } } - if (chatActivityEnterView != null) { + /*if (chatActivityEnterView != null) { chatActivityEnterView.setBotsCount(botsCount, hasBotsCommands); - } - if (mentionsAdapter != null) { + }*/ + /*if (mentionsAdapter != null) { mentionsAdapter.setBotsCount(botsCount); - } + }*/ if (ChatObject.isChannel(currentChat) && mergeDialogId == 0 && info.migrated_from_chat_id != 0) { mergeDialogId = -info.migrated_from_chat_id; maxMessageId[1] = info.migrated_from_max_id; @@ -5954,12 +5956,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not actionBar.hideActionMode(); updatePinnedMessageView(true); - if (botButtons != null) { + /*if (botButtons != null) { botButtons = null; if (chatActivityEnterView != null) { chatActivityEnterView.setButtons(null, false); } - } + }*/ if (currentEncryptedChat == null && currentUser != null && currentUser.bot && botUser == null) { botUser = ""; updateBottomOverlay(); @@ -6161,6 +6163,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not updateVisibleRows(); } } else if (id == NotificationCenter.botInfoDidLoaded) { + /* int guid = (Integer) args[1]; if (classGuid == guid) { TLRPC.BotInfo info = (TLRPC.BotInfo) args[0]; @@ -6181,6 +6184,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } updateBotButtons(); } + */ } else if (id == NotificationCenter.botKeyboardDidLoaded) { /* EDIT BY MR if (dialog_id == (Long) args[1]) { @@ -6378,7 +6382,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else { bottomOverlayChatText.setText(LocaleController.getString("Unblock", R.string.Unblock)); } - if (botButtons != null) { + /*if (botButtons != null) { botButtons = null; if (chatActivityEnterView != null) { if (replyingMessageObject != null && botReplyButtons == replyingMessageObject) { @@ -6387,7 +6391,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } chatActivityEnterView.setButtons(botButtons, false); } - } + }*/ } else if (botUser != null && currentUser.bot) { bottomOverlayChatText.setText(LocaleController.getString("BotStart", R.string.BotStart)); chatActivityEnterView.hidePopup(false); @@ -7904,7 +7908,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } int count = chatListView.getChildCount(); - MessageObject editingMessageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null; + //MessageObject editingMessageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null; for (int a = 0; a < count; a++) { View view = chatListView.getChildAt(a); if (view instanceof ChatMessageCell) { @@ -7914,7 +7918,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not boolean selected = false; if (actionBar.isActionModeShowed()) { MessageObject messageObject = cell.getMessageObject(); - if (messageObject == editingMessageObject || selectedMessagesIds[messageObject.getDialogId() == dialog_id ? 0 : 1].containsKey(messageObject.getId())) { + if (/*messageObject == editingMessageObject ||*/ selectedMessagesIds[messageObject.getDialogId() == dialog_id ? 0 : 1].containsKey(messageObject.getId())) { view.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR); selected = true; } else { @@ -8315,6 +8319,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } + /* @Override public void didPressedBotButton(ChatMessageCell cell, TLRPC.KeyboardButton button) { if (getParentActivity() == null || bottomOverlayChat.getVisibility() == View.VISIBLE && !(button instanceof TLRPC.TL_keyboardButtonCallback) && !(button instanceof TLRPC.TL_keyboardButtonUrl)) { @@ -8322,6 +8327,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } chatActivityEnterView.didPressedBotButton(button, cell.getMessageObject(), cell.getMessageObject()); } + */ @Override public void didPressedCancelSendButton(ChatMessageCell cell) { @@ -8559,8 +8565,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not boolean selected = false; boolean disableSelection = false; if (actionBar.isActionModeShowed()) { - MessageObject messageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null; - if (messageObject == message || selectedMessagesIds[message.getDialogId() == dialog_id ? 0 : 1].containsKey(message.getId())) { + //MessageObject messageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null; + if (/*messageObject == message ||*/ selectedMessagesIds[message.getDialogId() == dialog_id ? 0 : 1].containsKey(message.getId())) { view.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR); selected = true; } else { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/BotKeyboardView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/BotKeyboardView.java deleted file mode 100644 index 7c1bfa0d3..000000000 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/BotKeyboardView.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This is the source code of Telegram for Android v. 3.x.x. - * It is licensed under GNU GPL v. 2 or later. - * You should have received a copy of the license in this archive (see LICENSE). - * - * Copyright Nikolai Kudashov, 2013-2016. - */ - -package org.telegram.ui.Components; - -import android.content.Context; -import android.util.TypedValue; -import android.view.Gravity; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.ScrollView; -import android.widget.TextView; - -import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.Emoji; -import org.telegram.messenger.R; -import org.telegram.tgnet.TLRPC; - -import java.util.ArrayList; - -public class BotKeyboardView extends LinearLayout { - - private LinearLayout container; - private TLRPC.TL_replyKeyboardMarkup botButtons; - private BotKeyboardViewDelegate delegate; - private int panelHeight; - private boolean isFullSize; - private int buttonHeight; - private ArrayList buttonViews = new ArrayList<>(); - - public interface BotKeyboardViewDelegate { - void didPressedButton(TLRPC.KeyboardButton button); - } - - public BotKeyboardView(Context context) { - super(context); - - setOrientation(VERTICAL); - - ScrollView scrollView = new ScrollView(context); - addView(scrollView); - container = new LinearLayout(context); - container.setOrientation(VERTICAL); - scrollView.addView(container); - - setBackgroundColor(0xfff5f6f7); - } - - public void setDelegate(BotKeyboardViewDelegate botKeyboardViewDelegate) { - delegate = botKeyboardViewDelegate; - } - - public void setPanelHeight(int height) { - panelHeight = height; - if (isFullSize && botButtons != null && botButtons.rows.size() != 0) { - buttonHeight = !isFullSize ? 42 : (int) Math.max(42, (panelHeight - AndroidUtilities.dp(30) - (botButtons.rows.size() - 1) * AndroidUtilities.dp(10)) / botButtons.rows.size() / AndroidUtilities.density); - int count = container.getChildCount(); - int newHeight = AndroidUtilities.dp(buttonHeight); - for (int a = 0; a < count; a++) { - View v = container.getChildAt(a); - LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) v.getLayoutParams(); - if (layoutParams.height != newHeight) { - layoutParams.height = newHeight; - v.setLayoutParams(layoutParams); - } - } - } - } - - public void invalidateViews() { - for (int a = 0; a < buttonViews.size(); a++) { - buttonViews.get(a).invalidate(); - } - } - - public boolean isFullSize() { - return isFullSize; - } - - public void setButtons(TLRPC.TL_replyKeyboardMarkup buttons) { - botButtons = buttons; - container.removeAllViews(); - buttonViews.clear(); - - if (buttons != null && botButtons.rows.size() != 0) { - isFullSize = !buttons.resize; - buttonHeight = !isFullSize ? 42 : (int) Math.max(42, (panelHeight - AndroidUtilities.dp(30) - (botButtons.rows.size() - 1) * AndroidUtilities.dp(10)) / botButtons.rows.size() / AndroidUtilities.density); - for (int a = 0; a < buttons.rows.size(); a++) { - TLRPC.TL_keyboardButtonRow row = buttons.rows.get(a); - - LinearLayout layout = new LinearLayout(getContext()); - layout.setOrientation(LinearLayout.HORIZONTAL); - container.addView(layout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, buttonHeight, 15, a == 0 ? 15 : 10, 15, a == buttons.rows.size() - 1 ? 15 : 0)); - - float weight = 1.0f / row.buttons.size(); - for (int b = 0; b < row.buttons.size(); b++) { - TLRPC.KeyboardButton button = row.buttons.get(b); - TextView textView = new TextView(getContext()); - textView.setTag(button); - textView.setTextColor(0xff36474f); - textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); - textView.setGravity(Gravity.CENTER); - textView.setBackgroundResource(R.drawable.bot_keyboard_states); - textView.setPadding(AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4), 0); - textView.setText(Emoji.replaceEmoji(button.text, textView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); - layout.addView(textView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, weight, 0, 0, b != row.buttons.size() - 1 ? 10 : 0, 0)); - textView.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - delegate.didPressedButton((TLRPC.KeyboardButton) v.getTag()); - } - }); - buttonViews.add(textView); - } - } - } - } - - public int getKeyboardHeight() { - return isFullSize ? panelHeight : botButtons.rows.size() * AndroidUtilities.dp(buttonHeight) + AndroidUtilities.dp(30) + (botButtons.rows.size() - 1) * AndroidUtilities.dp(10); - } -} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index a1a86b1b8..5fa95c073 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -28,10 +28,8 @@ import android.os.Bundle; import android.os.PowerManager; import android.os.SystemClock; import android.text.Editable; -import android.text.InputFilter; import android.text.Layout; import android.text.SpannableStringBuilder; -import android.text.Spanned; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; @@ -50,7 +48,6 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; @@ -305,16 +302,16 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe private LinearLayout textFieldContainer; private FrameLayout sendButtonContainer; private View topView; - private PopupWindow botKeyboardPopup; - private BotKeyboardView botKeyboardView; + //private PopupWindow botKeyboardPopup; + //private BotKeyboardView botKeyboardView; private ImageView notifyButton; private RecordCircle recordCircle; private CloseProgressDrawable2 progressDrawable; private Drawable backgroundDrawable; - private MessageObject editingMessageObject; - private int editingMessageReqId; - private boolean editingCaption; + //private MessageObject editingMessageObject; + //private int editingMessageReqId; + //private boolean editingCaption; private int currentPopupContentType = -1; @@ -324,10 +321,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe private boolean isPaused = true; private boolean showKeyboardOnResume; - private MessageObject botButtonsMessageObject; - private TLRPC.TL_replyKeyboardMarkup botReplyMarkup; - private int botCount; - private boolean hasBotCommands; + //private MessageObject botButtonsMessageObject; + //private TLRPC.TL_replyKeyboardMarkup botReplyMarkup; + //private int botCount; + //private boolean hasBotCommands; private PowerManager.WakeLock mWakeLock; private AnimatorSet runningAnimation; @@ -359,7 +356,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe private boolean ignoreTextChange; private int innerTextChange; private MessageObject replyingMessageObject; - private MessageObject botMessageObject; + //private MessageObject botMessageObject; private TLRPC.WebPage messageWebPage; private boolean messageWebPageSearch = true; private ChatActivityEnterViewDelegate delegate; @@ -580,10 +577,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe public boolean onKey(View view, int i, KeyEvent keyEvent) { if (i == KeyEvent.KEYCODE_BACK && !keyboardVisible && isPopupShowing()) { if (keyEvent.getAction() == 1) { - if (currentPopupContentType == 1 && botButtonsMessageObject != null) { + /*if (currentPopupContentType == 1 && botButtonsMessageObject != null) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); preferences.edit().putInt("hidekeyboard_" + dialog_id, botButtonsMessageObject.getId()).commit(); - } + }*/ showPopup(0, 0); removeGifFromInputField(); } @@ -645,7 +642,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (innerTextChange != 2 && before != count && (count - before) > 1) { processChange = true; } - if (editingMessageObject == null && !canWriteToChannel && message.length() != 0 && lastTypingTimeSend < System.currentTimeMillis() - 5000 && !ignoreTextChange) { + if (/*editingMessageObject == null &&*/ !canWriteToChannel && message.length() != 0 && lastTypingTimeSend < System.currentTimeMillis() - 5000 && !ignoreTextChange) { int currentTime = ConnectionsManager.getInstance().getCurrentTime(); TLRPC.User currentUser = null; if ((int) dialog_id > 0) { @@ -705,6 +702,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe botButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { + /* if (botReplyMarkup != null) { if (!isPopupShowing() || currentPopupContentType != 1) { showPopup(1, 1); @@ -721,6 +719,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe setFieldText("/"); openKeyboard(); } + */ } }); @@ -1278,6 +1277,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } + /* public void setReplyingMessageObject(MessageObject messageObject) { if (messageObject != null) { if (botMessageObject == null && botButtonsMessageObject != replyingMessageObject) { @@ -1293,6 +1293,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe replyingMessageObject = messageObject; } } + */ public void setWebPage(TLRPC.WebPage webPage, boolean searchWebPages) { messageWebPage = webPage; @@ -1396,9 +1397,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } private void checkSendButton(boolean animated) { - if (editingMessageObject != null) { + /*if (editingMessageObject != null) { return; - } + }*/ if (isPaused) { animated = false; } @@ -1631,7 +1632,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } private void updateFieldRight(int attachVisible) { - if (messageEditText == null || editingMessageObject != null) { + if (messageEditText == null /*|| editingMessageObject != null*/) { return; } FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) messageEditText.getLayoutParams(); @@ -1757,9 +1758,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (longPress) { String text = messageEditText.getText().toString(); TLRPC.User user = messageObject != null && (int) dialog_id < 0 ? MessagesController.getInstance().getUser(messageObject.messageOwner.from_id) : null; - if ((botCount != 1 || username) && user != null && user.bot && !command.contains("@")) { + /*if ((botCount != 1 || username) && user != null && user.bot && !command.contains("@")) { text = String.format(Locale.US, "%s@%s", command, user.username) + " " + text.replaceFirst("^/[a-zA-Z@\\d_]{1,255}(\\s|$)", ""); - } else { + } else */ { text = command + " " + text.replaceFirst("^/[a-zA-Z@\\d_]{1,255}(\\s|$)", ""); } ignoreTextChange = true; @@ -1774,9 +1775,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } else { TLRPC.User user = messageObject != null && (int) dialog_id < 0 ? MessagesController.getInstance().getUser(messageObject.messageOwner.from_id) : null; - if ((botCount != 1 || username) && user != null && user.bot && !command.contains("@")) { + /*if ((botCount != 1 || username) && user != null && user.bot && !command.contains("@")) { SendMessagesHelper.getInstance().sendMessage(String.format(Locale.US, "%s@%s", command, user.username), dialog_id, null, null, false, null, null, null); - } else { + } else*/ { SendMessagesHelper.getInstance().sendMessage(command, dialog_id, null, null, false, null, null, null); } } @@ -1896,6 +1897,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } + /* public void setFieldFocused() { if (messageEditText != null) { try { @@ -1905,6 +1907,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } } + */ public void setFieldFocused(boolean focus) { if (messageEditText == null) { @@ -1957,6 +1960,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe attachButton.addView(view, LayoutHelper.createLinear(48, 48)); } + /* private void updateBotButton() { if (botButton == null) { return; @@ -2051,7 +2055,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } updateBotButton(); } + */ + /* public void didPressedBotButton(final TLRPC.KeyboardButton button, final MessageObject replyMessageObject, final MessageObject messageObject) { if (button == null || messageObject == null) { return; @@ -2134,9 +2140,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe parentFragment.presentFragment(fragment); } } + */ public boolean isPopupView(View view) { - return view == botKeyboardView || view == emojiView; + return /*view == botKeyboardView ||*/ view == emojiView; } public boolean isRecordCircle(View view) { @@ -2252,7 +2259,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe emojiView.addRecentSticker(sticker); } - private void showPopup(int show, int contentType) { + private void showPopup(int show, int contentType /*0=emojiView, 1=botKeyboardView*/ ) { if (show == 1) { if (contentType == 0 && emojiView == null) { if (parentActivity == null) { @@ -2264,17 +2271,17 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe View currentView = null; if (contentType == 0) { emojiView.setVisibility(VISIBLE); - if (botKeyboardView != null && botKeyboardView.getVisibility() != GONE) { + /*if (botKeyboardView != null && botKeyboardView.getVisibility() != GONE) { botKeyboardView.setVisibility(GONE); - } + }*/ currentView = emojiView; - } else if (contentType == 1) { + } /*else if (contentType == 1) { if (emojiView != null && emojiView.getVisibility() != GONE) { emojiView.setVisibility(GONE); } botKeyboardView.setVisibility(VISIBLE); currentView = botKeyboardView; - } + } */ currentPopupContentType = contentType; if (keyboardHeight <= 0) { @@ -2284,12 +2291,12 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe keyboardHeightLand = ApplicationLoader.applicationContext.getSharedPreferences("emoji", Context.MODE_PRIVATE).getInt("kbd_height_land3", AndroidUtilities.dp(200)); } int currentHeight = AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? keyboardHeightLand : keyboardHeight; - if (contentType == 1) { + /*if (contentType == 1) { currentHeight = Math.min(botKeyboardView.getKeyboardHeight(), currentHeight); } if (botKeyboardView != null) { botKeyboardView.setPanelHeight(currentHeight); - } + }*/ FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) currentView.getLayoutParams(); layoutParams.width = AndroidUtilities.displaySize.x; @@ -2304,7 +2311,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } else if (contentType == 1) { emojiButton.setImageResource(R.drawable.ic_msg_panel_smiles); } - updateBotButton(); + //updateBotButton(); onWindowSizeChanged(); } } else { @@ -2315,9 +2322,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (emojiView != null) { emojiView.setVisibility(GONE); } - if (botKeyboardView != null) { + /*if (botKeyboardView != null) { botKeyboardView.setVisibility(GONE); - } + }*/ if (sizeNotifierLayout != null) { if (show == 0) { emojiPadding = 0; @@ -2325,16 +2332,16 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe sizeNotifierLayout.requestLayout(); onWindowSizeChanged(); } - updateBotButton(); + //updateBotButton(); } } public void hidePopup(boolean byBackButton) { if (isPopupShowing()) { - if (currentPopupContentType == 1 && byBackButton && botButtonsMessageObject != null) { + /*if (currentPopupContentType == 1 && byBackButton && botButtonsMessageObject != null) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); preferences.edit().putInt("hidekeyboard_" + dialog_id, botButtonsMessageObject.getId()).commit(); - } + }*/ showPopup(0, 0); removeGifFromInputField(); } @@ -2361,16 +2368,21 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } } + public boolean isEditingMessage() { - return editingMessageObject != null; + return false; + //return editingMessageObject != null; } + /* public MessageObject getEditingMessageObject() { return editingMessageObject; } + */ public boolean isEditingCaption() { - return editingCaption; + return false; + //return editingCaption; } public boolean hasAudioToSend() { @@ -2386,7 +2398,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe } public boolean isPopupShowing() { - return emojiView != null && emojiView.getVisibility() == VISIBLE || botKeyboardView != null && botKeyboardView.getVisibility() == VISIBLE; + return emojiView != null && emojiView.getVisibility() == VISIBLE /*|| botKeyboardView != null && botKeyboardView.getVisibility() == VISIBLE*/; } public boolean isKeyboardVisible() { @@ -2414,19 +2426,19 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (isPopupShowing()) { int newHeight = isWidthGreater ? keyboardHeightLand : keyboardHeight; - if (currentPopupContentType == 1 && !botKeyboardView.isFullSize()) { + /*if (currentPopupContentType == 1 && !botKeyboardView.isFullSize()) { newHeight = Math.min(botKeyboardView.getKeyboardHeight(), newHeight); - } + }*/ View currentView = null; if (currentPopupContentType == 0) { currentView = emojiView; - } else if (currentPopupContentType == 1) { + } /*else if (currentPopupContentType == 1) { currentView = botKeyboardView; - } - if (botKeyboardView != null) { + }*/ + /*if (botKeyboardView != null) { botKeyboardView.setPanelHeight(newHeight); - } + }*/ FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) currentView.getLayoutParams(); if (layoutParams.width != AndroidUtilities.displaySize.x || layoutParams.height != newHeight) { @@ -2482,9 +2494,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe if (emojiView != null) { emojiView.invalidateViews(); } - if (botKeyboardView != null) { + /*if (botKeyboardView != null) { botKeyboardView.invalidateViews(); - } + }*/ } else if (id == NotificationCenter.recordProgressChanged) { long t = (Long) args[0]; Long time = t / 1000; diff --git a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard.png b/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard.png deleted file mode 100644 index e045972d8..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button.9.png b/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button.9.png deleted file mode 100644 index 55777ab32..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button_pressed.9.png b/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button_pressed.9.png deleted file mode 100644 index 15a03df75..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/bot_keyboard_button_pressed.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/bot_lines.png b/TMessagesProj/src/main/res/drawable-hdpi/bot_lines.png deleted file mode 100755 index 3d80a3e40..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/bot_lines.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/bot_link.png b/TMessagesProj/src/main/res/drawable-hdpi/bot_link.png deleted file mode 100755 index 9fbea8cf5..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/bot_link.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard.png b/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard.png deleted file mode 100644 index 0e9f59a4c..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button.9.png b/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button.9.png deleted file mode 100644 index d84e51881..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button_pressed.9.png b/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button_pressed.9.png deleted file mode 100644 index 094720870..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/bot_keyboard_button_pressed.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/bot_lines.png b/TMessagesProj/src/main/res/drawable-mdpi/bot_lines.png deleted file mode 100755 index 8f7e13f52..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/bot_lines.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/bot_link.png b/TMessagesProj/src/main/res/drawable-mdpi/bot_link.png deleted file mode 100755 index 76d34b503..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/bot_link.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard.png b/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard.png deleted file mode 100644 index af078978d..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button.9.png deleted file mode 100644 index 7f5fd2a7a..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button_pressed.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button_pressed.9.png deleted file mode 100644 index 66fe8b30e..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/bot_keyboard_button_pressed.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/bot_lines.png b/TMessagesProj/src/main/res/drawable-xhdpi/bot_lines.png deleted file mode 100755 index 11980a894..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/bot_lines.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/bot_link.png b/TMessagesProj/src/main/res/drawable-xhdpi/bot_link.png deleted file mode 100755 index 024405b37..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/bot_link.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard.png b/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard.png deleted file mode 100644 index 67b0fa4de..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button.9.png b/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button.9.png deleted file mode 100644 index 58fccc6e9..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button_pressed.9.png b/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button_pressed.9.png deleted file mode 100644 index dba2a36bc..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_keyboard_button_pressed.9.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_lines.png b/TMessagesProj/src/main/res/drawable-xxhdpi/bot_lines.png deleted file mode 100755 index e5d26151c..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_lines.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_link.png b/TMessagesProj/src/main/res/drawable-xxhdpi/bot_link.png deleted file mode 100755 index 411dc89d8..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/bot_link.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable/bot_keyboard_states.xml b/TMessagesProj/src/main/res/drawable/bot_keyboard_states.xml deleted file mode 100644 index 3f0757f53..000000000 --- a/TMessagesProj/src/main/res/drawable/bot_keyboard_states.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file