From 8a7ce0bdd4f11edbc67bd980d83a0dd4892cc9cc Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 14 Feb 2019 19:02:34 +0200 Subject: [PATCH] Fix live now messages updates --- OsmAnd-telegram/res/layout/live_now_chat_card.xml | 11 ++++++----- .../src/net/osmand/telegram/helpers/TelegramHelper.kt | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/OsmAnd-telegram/res/layout/live_now_chat_card.xml b/OsmAnd-telegram/res/layout/live_now_chat_card.xml index 26714c98a4..c42646c74d 100644 --- a/OsmAnd-telegram/res/layout/live_now_chat_card.xml +++ b/OsmAnd-telegram/res/layout/live_now_chat_card.xml @@ -59,6 +59,7 @@ android:id="@+id/details_container" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingBottom="2dp" android:gravity="center_vertical"> @@ -116,7 +117,7 @@ android:maxLines="1" android:textColor="?android:textColorSecondary" android:textSize="@dimen/list_item_description_text_size" - app:firstBaselineToTopHeight="@dimen/list_item_baseline_to_top_height" + app:firstBaselineToTopHeight="@dimen/list_item_icon_margin_right" app:typeface="@string/font_roboto_regular" tools:text="@string/shared_string_group" /> @@ -153,7 +154,7 @@ android:layout_height="wrap_content" android:maxLines="1" android:textSize="@dimen/list_item_description_text_size" - app:firstBaselineToTopHeight="@dimen/list_item_baseline_to_top_height_small" + app:firstBaselineToTopHeight="18dp" app:typeface="@string/font_roboto_medium" tools:text="213 m" tools:textColor="@color/ctrl_active_light"/> @@ -167,7 +168,7 @@ android:textColor="?attr/android:textColorSecondary" android:textSize="@dimen/list_item_description_text_size" android:visibility="visible" - app:firstBaselineToTopHeight="@dimen/list_item_icon_margin_right" /> + app:firstBaselineToTopHeight="18dp" /> @@ -180,7 +181,7 @@ android:maxLines="1" android:textColor="?attr/android:textColorSecondary" android:textSize="@dimen/list_item_description_text_size" - app:firstBaselineToTopHeight="@dimen/list_item_icon_margin_right" + app:firstBaselineToTopHeight="18dp" app:typeface="@string/font_roboto_regular" tools:text="Live: 1 • All: 36"/> diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index 04750f11ef..c36e7688a9 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -1282,6 +1282,12 @@ class TelegramHelper private constructor() { TdApi.UpdateMessageEdited.CONSTRUCTOR -> { val updateMessageEdited = obj as TdApi.UpdateMessageEdited lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, updateMessageEdited.editDate) + val message = usersLocationMessages[updateMessageEdited.messageId] + if (message != null) { + synchronized(message) { + message.editDate = updateMessageEdited.editDate + } + } } TdApi.UpdateMessageContent.CONSTRUCTOR -> { val updateMessageContent = obj as TdApi.UpdateMessageContent @@ -1295,6 +1301,7 @@ class TelegramHelper private constructor() { synchronized(message) { lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, Math.max(message.date, message.editDate)) message.content = updateMessageContent.newContent + message.content = OsmandLocationUtils.parseMessageContent(message, this@TelegramHelper) } incomingMessagesListeners.forEach { it.onReceiveChatLocationMessages(message.chatId, message)