diff options
Diffstat (limited to 'android/src')
3 files changed, 18 insertions, 4 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt new file mode 100644 index 0000000000..1047793f6f --- /dev/null +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/NavigationBarPainter.kt @@ -0,0 +1,10 @@ +package net.mullvad.mullvadvpn.ui + +import android.app.Activity +import androidx.annotation.ColorInt + +interface NavigationBarPainter : SystemPainter + +fun NavigationBarPainter.paintNavigationBar(@ColorInt color: Int) { + (getContext() as Activity?)?.window?.navigationBarColor = color +} diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt index bfc66ded33..48f94e17b5 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/StatusBarPainter.kt @@ -1,12 +1,9 @@ package net.mullvad.mullvadvpn.ui import android.app.Activity -import android.content.Context import androidx.annotation.ColorInt -interface StatusBarPainter { - fun getContext(): Context? -} +interface StatusBarPainter : SystemPainter fun StatusBarPainter.paintStatusBar(@ColorInt color: Int) { (getContext() as Activity?)?.window?.statusBarColor = color diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt new file mode 100644 index 0000000000..2f0fc32775 --- /dev/null +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/SystemPainter.kt @@ -0,0 +1,7 @@ +package net.mullvad.mullvadvpn.ui + +import android.content.Context + +interface SystemPainter { + fun getContext(): Context? +} |
