widget on icon / fix addOrUpdateStatusWidget
This commit is contained in:
parent
aec0917e75
commit
e7a8dcbbf1
4 changed files with 28 additions and 0 deletions
|
@ -241,6 +241,7 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis
|
|||
}
|
||||
}
|
||||
}
|
||||
log.info("oldest buffered msg time: $oldestTime | isSending: $isSending")
|
||||
app().showLocationHelper.addOrUpdateStatusWidget(oldestTime, isSending)
|
||||
}
|
||||
startWidgetUpdates()
|
||||
|
|
|
@ -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)
|
||||
|
|
10
OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml
Normal file
10
OsmAnd/res/drawable/anim_widget_location_sharing_on_day.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<item
|
||||
android:drawable="@drawable/widget_location_sharing_on_day"
|
||||
android:duration="500" />
|
||||
<item
|
||||
android:drawable="@drawable/widget_location_sharing_off_day"
|
||||
android:duration="500" />
|
||||
</animation-list>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:oneshot="false">
|
||||
<item
|
||||
android:drawable="@drawable/widget_location_sharing_on_night"
|
||||
android:duration="500" />
|
||||
<item
|
||||
android:drawable="@drawable/widget_location_sharing_off_night"
|
||||
android:duration="500" />
|
||||
</animation-list>
|
Loading…
Reference in a new issue