ui: use M3 theme for TV to prevent crash
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
ee16d1329b
commit
b734f44200
@ -17,6 +17,8 @@ import androidx.datastore.preferences.core.PreferenceDataStoreFactory
|
|||||||
import androidx.datastore.preferences.core.Preferences
|
import androidx.datastore.preferences.core.Preferences
|
||||||
import androidx.datastore.preferences.preferencesDataStoreFile
|
import androidx.datastore.preferences.preferencesDataStoreFile
|
||||||
import com.google.android.material.color.DynamicColors
|
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.Backend
|
||||||
import com.wireguard.android.backend.GoBackend
|
import com.wireguard.android.backend.GoBackend
|
||||||
import com.wireguard.android.backend.WgQuickBackend
|
import com.wireguard.android.backend.WgQuickBackend
|
||||||
@ -87,7 +89,9 @@ class Application : android.app.Application() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
Log.i(TAG, USER_AGENT)
|
Log.i(TAG, USER_AGENT)
|
||||||
super.onCreate()
|
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)
|
rootShell = RootShell(applicationContext)
|
||||||
toolsInstaller = ToolsInstaller(applicationContext, rootShell)
|
toolsInstaller = ToolsInstaller(applicationContext, rootShell)
|
||||||
preferencesDataStore = PreferenceDataStoreFactory.create { applicationContext.preferencesDataStoreFile("settings") }
|
preferencesDataStore = PreferenceDataStoreFactory.create { applicationContext.preferencesDataStoreFile("settings") }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<style name="TvTheme" parent="Theme.MaterialComponents.NoActionBar">
|
<style name="TvTheme" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
<item name="colorPrimary">@color/tv_primary_color</item>
|
<item name="colorPrimary">@color/tv_primary_color</item>
|
||||||
<item name="colorOnPrimary">#fffafafa</item>
|
<item name="colorOnPrimary">#fffafafa</item>
|
||||||
<item name="colorPrimaryDark">@color/tv_primary_color</item>
|
<item name="colorPrimaryDark">@color/tv_primary_color</item>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<item name="materialCardViewStyle">@style/TvTheme.MaterialCardView</item>
|
<item name="materialCardViewStyle">@style/TvTheme.MaterialCardView</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TvTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
|
<style name="TvTheme.Dialog" parent="Theme.Material3.DayNight.Dialog.Alert">
|
||||||
<item name="android:windowBackground">?attr/colorSurface</item>
|
<item name="android:windowBackground">?attr/colorSurface</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user