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
This commit is contained in:
DrKLO 2014-05-17 03:32:05 +04:00
parent 5ebe60a00d
commit 0065ca64f5
2 changed files with 10 additions and 1 deletions

View file

@ -40,8 +40,8 @@ public class ChatMessageCell extends ChatBaseCell {
int x = (int)event.getX(); int x = (int)event.getX();
int y = (int)event.getY(); int y = (int)event.getY();
if (x >= textX && y >= textY && x <= textX + currentMessageObject.textWidth && y <= textY + currentMessageObject.textHeight) { if (x >= textX && y >= textY && x <= textX + currentMessageObject.textWidth && y <= textY + currentMessageObject.textHeight) {
y -= textY;
int blockNum = Math.max(0, y / currentMessageObject.blockHeight); int blockNum = Math.max(0, y / currentMessageObject.blockHeight);
y -= textY;
if (blockNum < currentMessageObject.textLayoutBlocks.size()) { if (blockNum < currentMessageObject.textLayoutBlocks.size()) {
MessageObject.TextLayoutBlock block = currentMessageObject.textLayoutBlocks.get(blockNum); MessageObject.TextLayoutBlock block = currentMessageObject.textLayoutBlocks.get(blockNum);
x -= textX - (int)Math.ceil(block.textXOffset); x -= textX - (int)Math.ceil(block.textXOffset);

View file

@ -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() { messsageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {