From 0566232711609eb2f7bb22903859d220afbe7da0 Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Tue, 11 Feb 2020 12:23:32 +0200 Subject: [PATCH] status widget remove animation / change appearance --- OsmAnd-telegram/res/values/strings.xml | 1 + .../telegram/helpers/ShowLocationHelper.kt | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) 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 adf59d90c9..d618c0f626 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -49,10 +49,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" @@ -232,21 +232,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