From 0065ca64f5b020ac4644f0a5b3854c5c60ed3ea5 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sat, 17 May 2014 03:32:05 +0400 Subject: [PATCH] Hide emoji popup by pressing text message area, fixed that some links were untouchable https://github.com/DrKLO/Telegram/pull/272 https://github.com/DrKLO/Telegram/issues/392 --- .../main/java/org/telegram/ui/Cells/ChatMessageCell.java | 2 +- .../src/main/java/org/telegram/ui/ChatActivity.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 9396d1ab..e56d0db0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -40,8 +40,8 @@ public class ChatMessageCell extends ChatBaseCell { int x = (int)event.getX(); int y = (int)event.getY(); if (x >= textX && y >= textY && x <= textX + currentMessageObject.textWidth && y <= textY + currentMessageObject.textHeight) { - y -= textY; int blockNum = Math.max(0, y / currentMessageObject.blockHeight); + y -= textY; if (blockNum < currentMessageObject.textLayoutBlocks.size()) { MessageObject.TextLayoutBlock block = currentMessageObject.textLayoutBlocks.get(blockNum); x -= textX - (int)Math.ceil(block.textXOffset); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index d04baddb..fdc86b83 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -753,6 +753,15 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } }); + messsageEditText.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (emojiPopup != null && emojiPopup.isShowing()) { + showEmojiPopup(false); + } + } + }); + messsageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {