diff options
| author | Aleksandr Granin <aleksandr@mullvad.net> | 2021-03-01 10:45:24 +0100 |
|---|---|---|
| committer | Aleksandr Granin <aleksandr@mullvad.net> | 2021-03-02 09:35:05 +0100 |
| commit | 3edda71ec9b13145c7f7a7ae51a9e527066db517 (patch) | |
| tree | 8c193d80ae5d5c7377d27d7ee91e793b75a639b1 /android/src | |
| parent | 1cf43d95481d8ad515dfc400c23fafc15dde1b07 (diff) | |
| download | mullvadvpn-3edda71ec9b13145c7f7a7ae51a9e527066db517.tar.xz mullvadvpn-3edda71ec9b13145c7f7a7ae51a9e527066db517.zip | |
Create NavigationBar painter interface
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? +} |
