Fix several bugs and improve ui
This commit is contained in:
parent
eadecb4a5c
commit
4ae629580a
8 changed files with 105 additions and 127 deletions
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
@ -12,15 +11,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?attr/card_bg_color">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_bar_height"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/action_bar_height"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -30,28 +23,14 @@
|
|||
android:paddingRight="@dimen/content_padding_standard"
|
||||
android:text="@string/timeline"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:paddingTop="@dimen/content_padding_standard"
|
||||
android:paddingBottom="12dp"
|
||||
android:textSize="@dimen/title_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/options"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half"
|
||||
tools:src="@drawable/ic_action_other_menu"
|
||||
tools:tint="@color/icon_light"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/action_bar_descr_bottom_margin"
|
||||
android:paddingLeft="@dimen/content_padding_standard"
|
||||
android:paddingRight="@dimen/content_padding_standard"
|
||||
android:text="@string/timeline_description"
|
||||
|
@ -99,7 +78,7 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/date_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_header_height"
|
||||
android:layout_height="@dimen/timeline_time_buttons_height"
|
||||
android:background="@color/screen_bg_light"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/content_padding_standard"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/image_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:layout_height="102dp"
|
||||
app:layout_scrollFlags="scroll">
|
||||
|
||||
<ImageView
|
||||
|
@ -22,7 +22,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/shared_string_back"
|
||||
android:padding="@dimen/content_padding_standard"
|
||||
|
@ -31,10 +30,10 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="@dimen/my_location_user_icon_size"
|
||||
android:layout_height="@dimen/my_location_user_icon_size"
|
||||
android:layout_width="@dimen/timeline_user_icon_size"
|
||||
android:layout_height="@dimen/timeline_user_icon_size"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_half"
|
||||
tools:src="@drawable/img_user_picture" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
|
@ -84,8 +83,8 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginStart="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
|
@ -99,7 +98,9 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_header_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/card_divider_bottom_margin"
|
||||
android:paddingBottom="@dimen/content_padding_half"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
|
@ -112,7 +113,7 @@
|
|||
android:layout_weight="1"
|
||||
android:background="@drawable/btn_round"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="@dimen/image_button_padding"
|
||||
android:paddingRight="@dimen/image_button_padding"
|
||||
|
@ -225,7 +226,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:src="@drawable/ic_action_polygom_dark" />
|
||||
android:src="@drawable/ic_action_sort_by_distance" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -233,25 +234,27 @@
|
|||
android:layout_marginLeft="18dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/distance_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@null"
|
||||
android:text="@string/shared_string_distance"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/list_item_description_text_size" />
|
||||
android:textSize="@dimen/list_item_description_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/distance_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="40 km"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/hint_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold"
|
||||
tools:text="40 km" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -277,25 +280,27 @@
|
|||
android:layout_marginLeft="18dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/duration_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@null"
|
||||
android:text="@string/time_on_the_move"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/list_item_description_text_size" />
|
||||
android:textSize="@dimen/list_item_description_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/duration_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="3:32:44"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/hint_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold"
|
||||
tools:text="3:32:44" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -346,8 +351,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="11dp"
|
||||
android:paddingTop="13dp">
|
||||
android:paddingTop="13dp"
|
||||
android:paddingBottom="11dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
|
@ -369,25 +374,27 @@
|
|||
android:layout_marginLeft="18dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/average_speed_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@null"
|
||||
android:text="@string/average_speed"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/list_item_description_text_size" />
|
||||
android:textSize="@dimen/list_item_description_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/average_speed_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="15:04:58"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/hint_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold"
|
||||
tools:text="15:04:58" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -413,25 +420,27 @@
|
|||
android:layout_marginLeft="18dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/average_altitude_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:background="@null"
|
||||
android:text="@string/average_altitude"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/list_item_description_text_size" />
|
||||
android:textSize="@dimen/list_item_description_text_size"
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/average_altitude_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:text="20:58:00"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/hint_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold"
|
||||
tools:text="20:58:00" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -446,13 +455,13 @@
|
|||
android:id="@+id/open_in_osmand_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_item_height_min"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginBottom="@dimen/image_button_padding"
|
||||
android:background="@drawable/btn_round"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half">
|
||||
android:paddingLeft="@dimen/content_padding_standard"
|
||||
android:paddingRight="@dimen/content_padding_standard">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/open_in_osmand_icon"
|
||||
|
@ -469,7 +478,7 @@
|
|||
android:text="@string/open_in_osmand"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/list_item_title_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -477,13 +486,13 @@
|
|||
android:id="@+id/share_gpx_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_item_height_min"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:background="@drawable/btn_round"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/content_padding_half"
|
||||
android:paddingRight="@dimen/content_padding_half">
|
||||
android:paddingLeft="@dimen/content_padding_standard"
|
||||
android:paddingRight="@dimen/content_padding_standard">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_gpx_icon"
|
||||
|
@ -501,7 +510,7 @@
|
|||
android:text="@string/shared_string_share"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/list_item_title_text_size"
|
||||
app:typeface="@string/font_roboto_medium" />
|
||||
app:typeface="@string/font_roboto_regular" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
<dimen name="my_location_text_sides_margin">32dp</dimen>
|
||||
<dimen name="my_location_user_icon_size">60dp</dimen>
|
||||
|
||||
<dimen name="timeline_user_icon_size">56dp</dimen>
|
||||
<dimen name="timeline_time_buttons_height">50dp</dimen>
|
||||
|
||||
<dimen name="disable_sharing_image_height">132dp</dimen>
|
||||
<dimen name="disable_sharing_icon_top_margin">30dp</dimen>
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
val previousMessageLatLon = lastLocationPoints[newItem]
|
||||
val distance = if (previousMessageLatLon != null) { MapUtils.getDistance(previousMessageLatLon, loc.latitude, loc.longitude) } else 0.0
|
||||
val message = LocationMessages.LocationMessage(currentUserId, 0, loc.latitude, loc.longitude, loc.altitude,
|
||||
loc.speed.toDouble(), loc.accuracy.toDouble(), loc.bearing.toDouble(), loc.time, -1, 0, distance)
|
||||
loc.speed.toDouble(), loc.accuracy.toDouble(), loc.bearing.toDouble(), loc.time, TYPE_MY_LOCATION, 0, distance)
|
||||
|
||||
dbHelper.addLocationMessage(message)
|
||||
lastLocationPoints[newItem] = LatLon(message.lat, message.lon)
|
||||
|
@ -158,20 +158,20 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
readableDatabase?.rawQuery(
|
||||
"$TIMELINE_TABLE_SELECT WHERE $COL_USER_ID = ? AND $COL_TIME BETWEEN $start AND $end ORDER BY $COL_CHAT_ID ASC, $COL_TYPE DESC, $COL_TIME ASC ",
|
||||
arrayOf(userId.toString()))?.apply {
|
||||
if (moveToFirst()) {
|
||||
var type = -1
|
||||
val userLocationsMap: MutableMap<Int, List<LocationMessage>> = mutableMapOf()
|
||||
userLocations = UserLocations(userId, 0, emptyMap())
|
||||
var userLocationsListBytetype: MutableList<LocationMessage>? = null
|
||||
if (moveToFirst()) {
|
||||
userLocations = UserLocations(userId, 0, userLocationsMap)
|
||||
var userLocationsListByType: MutableList<LocationMessage>? = null
|
||||
do {
|
||||
val locationMessage = readLocationMessage(this@apply)
|
||||
if (type != locationMessage.type) {
|
||||
type = locationMessage.type
|
||||
userLocationsListBytetype = mutableListOf()
|
||||
userLocationsListBytetype.add(locationMessage)
|
||||
userLocationsMap.set(type, userLocationsListBytetype)
|
||||
userLocationsListByType = mutableListOf()
|
||||
userLocationsListByType.add(locationMessage)
|
||||
userLocationsMap.set(type, userLocationsListByType)
|
||||
} else {
|
||||
userLocationsListBytetype?.add(locationMessage)
|
||||
userLocationsListByType?.add(locationMessage)
|
||||
}
|
||||
} while (moveToNext())
|
||||
}
|
||||
|
@ -213,13 +213,13 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
readableDatabase?.rawQuery(
|
||||
"$TIMELINE_TABLE_SELECT WHERE $COL_USER_ID != ? AND $COL_TIME BETWEEN $start AND $end ORDER BY $COL_USER_ID, $COL_CHAT_ID, $COL_TYPE DESC, $COL_TIME ",
|
||||
arrayOf(currentUserId.toString()))?.apply {
|
||||
if (moveToFirst()) {
|
||||
var type = -1
|
||||
var userId = -1
|
||||
var chatId = -1L
|
||||
var userLocations: UserLocations? = null
|
||||
var userLocations: UserLocations?
|
||||
var userLocationsMap: MutableMap<Int, List<LocationMessage>>? = null
|
||||
var userLocationsListBytetype: MutableList<LocationMessage>? = null
|
||||
if (moveToFirst()) {
|
||||
var userLocationsListByType: MutableList<LocationMessage>? = null
|
||||
do {
|
||||
val locationMessage = readLocationMessage(this@apply)
|
||||
if (userId != locationMessage.userId || chatId != locationMessage.chatId) {
|
||||
|
@ -227,19 +227,19 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
chatId = locationMessage.chatId
|
||||
type = locationMessage.type
|
||||
userLocationsMap = mutableMapOf()
|
||||
userLocationsListBytetype = mutableListOf()
|
||||
userLocationsListBytetype.add(locationMessage)
|
||||
userLocationsMap[type] = userLocationsListBytetype
|
||||
userLocationsListByType = mutableListOf()
|
||||
userLocationsListByType.add(locationMessage)
|
||||
userLocationsMap[type] = userLocationsListByType
|
||||
userLocations = UserLocations(userId, chatId, userLocationsMap)
|
||||
res.add(userLocations)
|
||||
}
|
||||
if (type != locationMessage.type) {
|
||||
type = locationMessage.type
|
||||
userLocationsListBytetype = mutableListOf()
|
||||
userLocationsListBytetype.add(locationMessage)
|
||||
userLocationsMap?.set(type, userLocationsListBytetype)
|
||||
userLocationsListByType = mutableListOf()
|
||||
userLocationsListByType.add(locationMessage)
|
||||
userLocationsMap?.set(type, userLocationsListByType)
|
||||
} else {
|
||||
userLocationsListBytetype?.add(locationMessage)
|
||||
userLocationsListByType?.add(locationMessage)
|
||||
}
|
||||
} while (moveToNext())
|
||||
}
|
||||
|
@ -477,5 +477,6 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
const val TYPE_BOT_MAP = 3
|
||||
const val TYPE_BOT_TEXT = 4
|
||||
const val TYPE_BOT_BOTH = 5
|
||||
const val TYPE_MY_LOCATION = 6
|
||||
}
|
||||
}
|
|
@ -30,6 +30,8 @@ class ShareLocationHelper(private val app: TelegramApplication) {
|
|||
|
||||
var lastLocationUpdateTime: Long = 0
|
||||
|
||||
var lastMyLocationUpdateTime: Long = 0
|
||||
|
||||
var lastLocation: Location? = null
|
||||
set(value) {
|
||||
if (lastTimeInMillis == 0L) {
|
||||
|
@ -51,10 +53,10 @@ class ShareLocationHelper(private val app: TelegramApplication) {
|
|||
lastLocation = location
|
||||
|
||||
if (location != null) {
|
||||
lastLocationUpdateTime = System.currentTimeMillis()
|
||||
if (app.settings.getChatsShareInfo().isNotEmpty()) {
|
||||
shareLocationMessages(location, app.telegramHelper.getCurrentUserId())
|
||||
}
|
||||
lastLocationUpdateTime = System.currentTimeMillis()
|
||||
}
|
||||
app.settings.updateSharingStatusHistory()
|
||||
refreshNotification()
|
||||
|
@ -223,8 +225,9 @@ class ShareLocationHelper(private val app: TelegramApplication) {
|
|||
prepareMapAndTextMessage(shareInfo, message, isBot, sharingMode)
|
||||
}
|
||||
}
|
||||
if (System.currentTimeMillis() - lastLocationUpdateTime > MY_LOCATION_UPDATE_MS) {
|
||||
if (System.currentTimeMillis() - lastMyLocationUpdateTime > MY_LOCATION_UPDATE_MS) {
|
||||
app.locationMessages.addMyLocationMessage(location)
|
||||
lastMyLocationUpdateTime = System.currentTimeMillis()
|
||||
}
|
||||
if (bufferedMessagesFull) {
|
||||
checkNetworkType()
|
||||
|
|
|
@ -1309,24 +1309,6 @@ class TelegramHelper private constructor() {
|
|||
}
|
||||
}
|
||||
}
|
||||
TdApi.UpdateMessageEdited.CONSTRUCTOR -> {
|
||||
val updateMessageEdited = obj as TdApi.UpdateMessageEdited
|
||||
val message = usersLocationMessages[updateMessageEdited.messageId]
|
||||
log.debug("UpdateMessageEdited " + updateMessageEdited.messageId)
|
||||
if (message == null) {
|
||||
updateMessageEdited.apply {
|
||||
requestMessage(chatId, messageId, this@TelegramHelper::addNewMessage)
|
||||
}
|
||||
} else {
|
||||
synchronized(message) {
|
||||
message.editDate = updateMessageEdited.editDate
|
||||
lastTelegramUpdateTime = Math.max(message.date, message.editDate)
|
||||
}
|
||||
incomingMessagesListeners.forEach {
|
||||
it.updateLocationMessages()
|
||||
}
|
||||
}
|
||||
}
|
||||
TdApi.UpdateMessageContent.CONSTRUCTOR -> {
|
||||
val updateMessageContent = obj as TdApi.UpdateMessageContent
|
||||
val message = usersLocationMessages[updateMessageContent.messageId]
|
||||
|
|
|
@ -229,10 +229,11 @@ class UserGpxInfoFragment : BaseDialogFragment() {
|
|||
|
||||
private fun updateGPXStatisticRow() {
|
||||
val analysis: GPXUtilities.GPXTrackAnalysis = gpxFile.getAnalysis(0)
|
||||
avgElevationTv.text = OsmandFormatter.getFormattedAlt(analysis.avgElevation, app)
|
||||
avgSpeedTv.text = if (analysis.isSpeedSpecified) OsmandFormatter.getFormattedSpeed(analysis.avgSpeed, app) else ""
|
||||
totalDistanceTv.text = OsmandFormatter.getFormattedDistance(analysis.totalDistance, app)
|
||||
timeSpanTv.text = Algorithms.formatDuration((analysis.timeSpan / 1000).toInt(), true)
|
||||
|
||||
avgElevationTv.text = if (analysis.avgElevation != 0.0) OsmandFormatter.getFormattedAlt(analysis.avgElevation, app) else "-"
|
||||
avgSpeedTv.text = if (analysis.isSpeedSpecified) OsmandFormatter.getFormattedSpeed(analysis.avgSpeed, app) else "-"
|
||||
totalDistanceTv.text = if (analysis.totalDistance != 0.0f) OsmandFormatter.getFormattedDistance(analysis.totalDistance, app) else "-"
|
||||
timeSpanTv.text = if (analysis.timeSpan != 0L) Algorithms.formatDuration((analysis.timeSpan / 1000).toInt(), true) else "-"
|
||||
}
|
||||
|
||||
private fun updateGPXMap() {
|
||||
|
|
|
@ -522,9 +522,9 @@ object OsmandLocationUtils {
|
|||
val user = app.telegramHelper.getUser(pt!!.userId)
|
||||
val fileName: String
|
||||
fileName = if (user != null) {
|
||||
(TelegramUiHelper.getUserName(user) + "_" + SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(Date(pt.time)))
|
||||
(TelegramUiHelper.getUserName(user) + "_" + SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date(pt.time)))
|
||||
} else {
|
||||
userId.toString() + "_" + SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(Date(pt.time))
|
||||
userId.toString() + "_" + SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date(pt.time))
|
||||
}
|
||||
fout = File(dir, "$fileName.gpx")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue