summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2023-08-16 16:51:15 +0200
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2023-08-23 14:15:10 +0200
commitd704b7780d43a719ec3c687234a983979e8f4cb6 (patch)
tree4cbf809b42275ea0d0781a1a5efc9e3c44e9a37e /android/app/src
parent258a7667e5dab869e7d714fb862ec8f18453907a (diff)
downloadmullvadvpn-d704b7780d43a719ec3c687234a983979e8f4cb6.tar.xz
mullvadvpn-d704b7780d43a719ec3c687234a983979e8f4cb6.zip
Fix usecompatloadingfordrawables baselint issues
Diffstat (limited to 'android/app/src')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLoginBorder.kt25
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt7
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/UrlButton.kt3
3 files changed, 20 insertions, 15 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLoginBorder.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLoginBorder.kt
index c728941264..553ce7a4cf 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLoginBorder.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/AccountLoginBorder.kt
@@ -6,6 +6,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.RelativeLayout
+import androidx.core.content.res.ResourcesCompat
import net.mullvad.mullvadvpn.R
class AccountLoginBorder : RelativeLayout {
@@ -21,30 +22,30 @@ class AccountLoginBorder : RelativeLayout {
// horizontal line, and as a consequence either the horizontal or the vertical borders don't
// show correctly, respectively.
private class StateDrawables(
- val corner: Drawable,
- val horizontalBorder: Drawable,
- val verticalBorder: Drawable
+ val corner: Drawable?,
+ val horizontalBorder: Drawable?,
+ val verticalBorder: Drawable?
)
private val unfocusedDrawables =
StateDrawables(
- resources.getDrawable(R.drawable.account_login_corner, null),
- resources.getDrawable(R.drawable.account_login_border, null),
- resources.getDrawable(R.drawable.account_login_border, null)
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_corner, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border, null)
)
private val focusedDrawables =
StateDrawables(
- resources.getDrawable(R.drawable.account_login_corner_focused, null),
- resources.getDrawable(R.drawable.account_login_border_focused, null),
- resources.getDrawable(R.drawable.account_login_border_focused, null)
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_corner_focused, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border_focused, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border_focused, null)
)
private val errorDrawables =
StateDrawables(
- resources.getDrawable(R.drawable.account_login_corner_error, null),
- resources.getDrawable(R.drawable.account_login_border_error, null),
- resources.getDrawable(R.drawable.account_login_border_error, null)
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_corner_error, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border_error, null),
+ ResourcesCompat.getDrawable(resources, R.drawable.account_login_border_error, null)
)
private val container =
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt
index 42f3f16122..da30945abc 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/NotificationBanner.kt
@@ -11,6 +11,7 @@ import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
+import androidx.core.content.res.ResourcesCompat
import androidx.core.text.HtmlCompat
import androidx.core.view.isVisible
import net.mullvad.mullvadvpn.R
@@ -64,8 +65,10 @@ class NotificationBanner : FrameLayout {
inflater.inflate(R.layout.notification_banner, this)
}
- private val errorImage = resources.getDrawable(R.drawable.icon_notification_error, null)
- private val warningImage = resources.getDrawable(R.drawable.icon_notification_warning, null)
+ private val errorImage =
+ ResourcesCompat.getDrawable(resources, R.drawable.icon_notification_error, null)
+ private val warningImage =
+ ResourcesCompat.getDrawable(resources, R.drawable.icon_notification_warning, null)
private val status: ImageView = container.findViewById(R.id.notification_status)
private val title: TextView = container.findViewById(R.id.notification_title)
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/UrlButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/UrlButton.kt
index db3da99270..f6090bdafa 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/UrlButton.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/widget/UrlButton.kt
@@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.ui.widget
import android.content.Context
import android.util.AttributeSet
+import androidx.appcompat.content.res.AppCompatResources
import net.mullvad.mullvadvpn.R
open class UrlButton : Button {
@@ -17,7 +18,7 @@ open class UrlButton : Button {
init {
super.setEnabled(false)
- super.detailImage = context.getDrawable(R.drawable.icon_extlink)
+ super.detailImage = AppCompatResources.getDrawable(context, R.drawable.icon_extlink)
super.showSpinner = true
}
}