From ee38ecec5696d60b0326e778e9772784f03137cd Mon Sep 17 00:00:00 2001 From: DrKLO Date: Mon, 19 May 2014 01:44:30 +0400 Subject: [PATCH] fixed untouchable links --- .../src/main/java/org/telegram/objects/MessageObject.java | 4 ++++ .../src/main/java/org/telegram/ui/Cells/ChatMessageCell.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java index ce1a11370..f18a7ae84 100644 --- a/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java @@ -425,6 +425,7 @@ public class MessageObject { int blocksCount = (int)Math.ceil((float)linesCount / LINES_PER_BLOCK); int linesOffset = 0; + float prevOffset = 0; for (int a = 0; a < blocksCount; a++) { @@ -449,6 +450,9 @@ public class MessageObject { block.textYOffset = textLayout.getLineTop(linesOffset); if (a != blocksCount - 1) { blockHeight = Math.min(blockHeight, block.textLayout.getHeight()); + prevOffset = block.textYOffset; + } else { + blockHeight = Math.min(blockHeight, (int)(block.textYOffset - prevOffset)); } } catch (Exception e) { FileLog.e("tmessages", e); 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 e56d0db0c..9396d1aba 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) { - int blockNum = Math.max(0, y / currentMessageObject.blockHeight); y -= textY; + int blockNum = Math.max(0, y / currentMessageObject.blockHeight); if (blockNum < currentMessageObject.textLayoutBlocks.size()) { MessageObject.TextLayoutBlock block = currentMessageObject.textLayoutBlocks.get(blockNum); x -= textX - (int)Math.ceil(block.textXOffset);