Fix live now messages updates

This commit is contained in:
Chumva 2019-02-14 19:02:34 +02:00
parent e958a25646
commit 8a7ce0bdd4
2 changed files with 13 additions and 5 deletions

View file

@ -59,6 +59,7 @@
android:id="@+id/details_container" android:id="@+id/details_container"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:gravity="center_vertical"> android:gravity="center_vertical">
<LinearLayout <LinearLayout
@ -86,7 +87,7 @@
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/list_item_description_text_size" 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" app:typeface="@string/font_roboto_regular"
tools:text="213 m" /> tools:text="213 m" />
@ -116,7 +117,7 @@
android:maxLines="1" android:maxLines="1"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/list_item_description_text_size" 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" app:typeface="@string/font_roboto_regular"
tools:text="@string/shared_string_group" /> tools:text="@string/shared_string_group" />
@ -153,7 +154,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:textSize="@dimen/list_item_description_text_size" 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" app:typeface="@string/font_roboto_medium"
tools:text="213 m" tools:text="213 m"
tools:textColor="@color/ctrl_active_light"/> tools:textColor="@color/ctrl_active_light"/>
@ -167,7 +168,7 @@
android:textColor="?attr/android:textColorSecondary" android:textColor="?attr/android:textColorSecondary"
android:textSize="@dimen/list_item_description_text_size" android:textSize="@dimen/list_item_description_text_size"
android:visibility="visible" android:visibility="visible"
app:firstBaselineToTopHeight="@dimen/list_item_icon_margin_right" /> app:firstBaselineToTopHeight="18dp" />
</LinearLayout> </LinearLayout>
@ -180,7 +181,7 @@
android:maxLines="1" android:maxLines="1"
android:textColor="?attr/android:textColorSecondary" android:textColor="?attr/android:textColorSecondary"
android:textSize="@dimen/list_item_description_text_size" 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" app:typeface="@string/font_roboto_regular"
tools:text="Live: 1 • All: 36"/> tools:text="Live: 1 • All: 36"/>

View file

@ -1282,6 +1282,12 @@ class TelegramHelper private constructor() {
TdApi.UpdateMessageEdited.CONSTRUCTOR -> { TdApi.UpdateMessageEdited.CONSTRUCTOR -> {
val updateMessageEdited = obj as TdApi.UpdateMessageEdited val updateMessageEdited = obj as TdApi.UpdateMessageEdited
lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, updateMessageEdited.editDate) lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, updateMessageEdited.editDate)
val message = usersLocationMessages[updateMessageEdited.messageId]
if (message != null) {
synchronized(message) {
message.editDate = updateMessageEdited.editDate
}
}
} }
TdApi.UpdateMessageContent.CONSTRUCTOR -> { TdApi.UpdateMessageContent.CONSTRUCTOR -> {
val updateMessageContent = obj as TdApi.UpdateMessageContent val updateMessageContent = obj as TdApi.UpdateMessageContent
@ -1295,6 +1301,7 @@ class TelegramHelper private constructor() {
synchronized(message) { synchronized(message) {
lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, Math.max(message.date, message.editDate)) lastTelegramUpdateTime = Math.max(lastTelegramUpdateTime, Math.max(message.date, message.editDate))
message.content = updateMessageContent.newContent message.content = updateMessageContent.newContent
message.content = OsmandLocationUtils.parseMessageContent(message, this@TelegramHelper)
} }
incomingMessagesListeners.forEach { incomingMessagesListeners.forEach {
it.onReceiveChatLocationMessages(message.chatId, message) it.onReceiveChatLocationMessages(message.chatId, message)