diff options
| author | Albin <albin@mullvad.net> | 2021-11-25 16:17:16 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2021-11-26 15:00:40 +0100 |
| commit | 566c7b9cd0f0c60d5b333626067e422a078338f5 (patch) | |
| tree | 7a514971d3e68384c39c06bab56127aafba218c3 /android/src | |
| parent | 56643fd78c098dc6b4abb4563b474a0f526d5b9b (diff) | |
| download | mullvadvpn-566c7b9cd0f0c60d5b333626067e422a078338f5.tar.xz mullvadvpn-566c7b9cd0f0c60d5b333626067e422a078338f5.zip | |
Fix banner sometimes incorrectly showing
Diffstat (limited to 'android/src')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt index 46f738258e..bd4974be1e 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt @@ -10,6 +10,7 @@ import android.view.View import android.widget.FrameLayout import android.widget.ImageView import android.widget.TextView +import androidx.core.view.isVisible import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.ui.notification.InAppNotification import net.mullvad.mullvadvpn.ui.notification.InAppNotificationController @@ -158,19 +159,15 @@ class NotificationBanner : FrameLayout { private fun animateChange() { val notification = notifications.current + val hasOngoingHideAnimation = animation.isRunning && reversedAnimation - if (notification != null && visibility == View.INVISIBLE) { - // Banner is not currently shown but must be shown + if (isVisible.not() && notification != null) { reversedAnimation = false update(notification) animation.start() - } else if (visibility == View.VISIBLE && (!animation.isRunning() || !reversedAnimation)) { - // Either the banner is shown or it is in the process of being shown, but the - // notification must be hidden or replaced + } else if (hasOngoingHideAnimation.not()) { reversedAnimation = true animation.reverse() } - // If the banner is animating to be hidden, it will automatically start showing when the - // hide animation ends } } |
