summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main/java
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2023-03-30 13:40:05 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2023-03-30 13:40:05 +0200
commitb734f44200c40fb630fbc566dd245693145f93ec (patch)
tree1cca8dea966bf271aa14fa15b485293292bfe02e /ui/src/main/java
parentee16d1329b0807d7474bf0e2b4955a99e2a15403 (diff)
ui: use M3 theme for TV to prevent crash
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java')
-rw-r--r--ui/src/main/java/com/wireguard/android/Application.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/src/main/java/com/wireguard/android/Application.kt b/ui/src/main/java/com/wireguard/android/Application.kt
index cac1f8d8..44199d9d 100644
--- a/ui/src/main/java/com/wireguard/android/Application.kt
+++ b/ui/src/main/java/com/wireguard/android/Application.kt
@@ -17,6 +17,8 @@ import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStoreFile
import com.google.android.material.color.DynamicColors
+import com.google.android.material.color.DynamicColorsOptions
+import com.wireguard.android.activity.TvMainActivity
import com.wireguard.android.backend.Backend
import com.wireguard.android.backend.GoBackend
import com.wireguard.android.backend.WgQuickBackend
@@ -87,7 +89,9 @@ class Application : android.app.Application() {
override fun onCreate() {
Log.i(TAG, USER_AGENT)
super.onCreate()
- DynamicColors.applyToActivitiesIfAvailable(this)
+ DynamicColors.applyToActivitiesIfAvailable(this,
+ // TODO: Remove this second argument once the TV theme has a proper M3 color palette.
+ DynamicColorsOptions.Builder().setPrecondition { activity, _ -> activity !is TvMainActivity }.build())
rootShell = RootShell(applicationContext)
toolsInstaller = ToolsInstaller(applicationContext, rootShell)
preferencesDataStore = PreferenceDataStoreFactory.create { applicationContext.preferencesDataStoreFile("settings") }