diff --git a/OsmAnd-telegram/res/values/strings.xml b/OsmAnd-telegram/res/values/strings.xml index 4c4347e03d..a9105619fc 100644 --- a/OsmAnd-telegram/res/values/strings.xml +++ b/OsmAnd-telegram/res/values/strings.xml @@ -1,5 +1,6 @@ + ERR Last update from Telegram: %1$s Last response: %1$s Last update from Telegram: %1$s ago diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt index c2c665d6b2..b6fe245d0a 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -47,10 +47,10 @@ class ShowLocationHelper(private val app: TelegramApplication) { private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night" private const val STATUS_WIDGET_MENU_ICON_OLD = "ic_action_relative_bearing" private const val STATUS_WIDGET_ICON_OLD = "widget_relative_bearing_day" - private const val STATUS_WIDGET_ANIM_ICON_DAY = "anim_widget_location_sharing_day" - private const val STATUS_WIDGET_ANIM_ICON_NIGHT = "anim_widget_location_sharing_night" - private const val STATUS_WIDGET_ON_ANIM_ICON_DAY = "anim_widget_location_sharing_on_day" - private const val STATUS_WIDGET_ON_ANIM_ICON_NIGHT = "anim_widget_location_sharing_on_night" + private const val STATUS_WIDGET_ICON_DAY = "widget_location_sharing_day" + private const val STATUS_WIDGET_ICON_NIGHT = "widget_location_sharing_night" + private const val STATUS_WIDGET_ON_ICON_DAY = "widget_location_sharing_on_day" + private const val STATUS_WIDGET_ON_ICON_NIGHT = "widget_location_sharing_on_night" private const val STATUS_WIDGET_OFF_ICON_DAY = "widget_location_sharing_off_day" private const val STATUS_WIDGET_OFF_ICON_NIGHT = "widget_location_sharing_off_night" @@ -230,21 +230,27 @@ class ShowLocationHelper(private val app: TelegramApplication) { STATUS_WIDGET_MENU_ICON_OLD } val text = when { - time > 0L -> { - iconDay = STATUS_WIDGET_ANIM_ICON_DAY - iconNight = STATUS_WIDGET_ANIM_ICON_NIGHT + time > 0L && isSending -> { + iconDay = STATUS_WIDGET_ON_ICON_DAY + iconNight = STATUS_WIDGET_ON_ICON_NIGHT + val diffTime = (System.currentTimeMillis() - time) / 1000 + OsmandFormatter.getFormattedDurationForWidget(diffTime) + } + time > 0L && !isSending -> { + iconDay = STATUS_WIDGET_ICON_DAY + iconNight = STATUS_WIDGET_ICON_NIGHT val diffTime = (System.currentTimeMillis() - time) / 1000 OsmandFormatter.getFormattedDurationForWidget(diffTime) } time == 0L && isSending -> { - iconDay = STATUS_WIDGET_ON_ANIM_ICON_DAY - iconNight = STATUS_WIDGET_ON_ANIM_ICON_NIGHT + iconDay = STATUS_WIDGET_ON_ICON_DAY + iconNight = STATUS_WIDGET_ON_ICON_NIGHT app.getString(R.string.shared_string_ok) } time == 0L && !isSending -> { - iconDay = STATUS_WIDGET_ANIM_ICON_DAY - iconNight = STATUS_WIDGET_ANIM_ICON_NIGHT - app.getString(R.string.shared_string_ok) + iconDay = STATUS_WIDGET_ICON_DAY + iconNight = STATUS_WIDGET_ICON_NIGHT + app.getString(R.string.shared_string_error_short) } else -> { iconDay = STATUS_WIDGET_OFF_ICON_DAY