Merge pull request #8442 from osmandapp/fix_animation_for_OsmAnd_Tracker

status widget remove animation / change appearance
This commit is contained in:
vshcherb 2020-02-11 18:26:41 +01:00 committed by GitHub
commit 419e669946
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="shared_string_error_short">ERR</string>
<string name="last_update_from_telegram_date">Last update from Telegram: %1$s</string>
<string name="last_response_date">Last response: %1$s</string>
<string name="last_update_from_telegram_duration">Last update from Telegram: %1$s ago</string>

View file

@ -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