From e7a8dcbbf15ee6f9823131d08f952c78b0c614c3 Mon Sep 17 00:00:00 2001 From: Dmitriy Ruban Date: Mon, 6 Jan 2020 16:32:24 +0200 Subject: [PATCH] widget on icon / fix addOrUpdateStatusWidget --- .../src/net/osmand/telegram/TelegramService.kt | 1 + .../net/osmand/telegram/helpers/ShowLocationHelper.kt | 7 +++++++ .../drawable/anim_widget_location_sharing_on_day.xml | 10 ++++++++++ .../drawable/anim_widget_location_sharing_on_night.xml | 10 ++++++++++ 4 files changed, 28 insertions(+) create mode 100644 OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml create mode 100644 OsmAnd/res/drawable/anim_widget_location_sharing_on_night.xml diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt index a7d1e4a880..77ea8f28dc 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt @@ -241,6 +241,7 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis } } } + log.info("oldest buffered msg time: $oldestTime | isSending: $isSending") app().showLocationHelper.addOrUpdateStatusWidget(oldestTime, isSending) } startWidgetUpdates() diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt index 5433827e19..9ff378af15 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -47,6 +47,8 @@ class ShowLocationHelper(private val app: TelegramApplication) { private const val STATUS_WIDGET_MENU_ICON = "widget_location_sharing_night" 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_OFF_ICON_DAY = "widget_location_sharing_off_day" private const val STATUS_WIDGET_OFF_ICON_NIGHT = "widget_location_sharing_off_night" @@ -216,6 +218,11 @@ class ShowLocationHelper(private val app: TelegramApplication) { OsmandFormatter.getFormattedDurationForWidget(diffTime) } time == 0L && isSending -> { + iconDay = STATUS_WIDGET_ON_ANIM_ICON_DAY + iconNight = STATUS_WIDGET_ON_ANIM_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) diff --git a/OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml b/OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml new file mode 100644 index 0000000000..a194131788 --- /dev/null +++ b/OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/anim_widget_location_sharing_on_night.xml b/OsmAnd/res/drawable/anim_widget_location_sharing_on_night.xml new file mode 100644 index 0000000000..5805fe4f54 --- /dev/null +++ b/OsmAnd/res/drawable/anim_widget_location_sharing_on_night.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file