ui: move default style to Material3 with Dynamic Colors
The TV theme has been kept as-is since Material You guidance around this is a bit scarce at the moment. Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
81c571f0c7
commit
5d14caf3b2
@ -16,6 +16,7 @@ import androidx.datastore.core.DataStore
|
||||
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.wireguard.android.backend.Backend
|
||||
import com.wireguard.android.backend.GoBackend
|
||||
import com.wireguard.android.backend.WgQuickBackend
|
||||
@ -86,6 +87,7 @@ class Application : android.app.Application() {
|
||||
override fun onCreate() {
|
||||
Log.i(TAG, USER_AGENT)
|
||||
super.onCreate()
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
rootShell = RootShell(applicationContext)
|
||||
toolsInstaller = ToolsInstaller(applicationContext, rootShell)
|
||||
preferencesDataStore = PreferenceDataStoreFactory.create { applicationContext.preferencesDataStoreFile("settings") }
|
||||
|
@ -15,6 +15,7 @@ import androidx.databinding.Observable
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.setFragmentResult
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.wireguard.android.BR
|
||||
import com.wireguard.android.R
|
||||
@ -88,7 +89,7 @@ class AppListDialogFragment : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val alertDialogBuilder = AlertDialog.Builder(requireActivity())
|
||||
val alertDialogBuilder = MaterialAlertDialogBuilder(requireActivity())
|
||||
val binding = AppListDialogFragmentBinding.inflate(requireActivity().layoutInflater, null, false)
|
||||
binding.executePendingBindings()
|
||||
alertDialogBuilder.setView(binding.root)
|
||||
|
@ -12,6 +12,7 @@ import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.wireguard.android.Application
|
||||
import com.wireguard.android.R
|
||||
@ -64,7 +65,7 @@ class ConfigNamingDialogFragment : DialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val activity = requireActivity()
|
||||
imm = activity.getSystemService()
|
||||
val alertDialogBuilder = AlertDialog.Builder(activity)
|
||||
val alertDialogBuilder = MaterialAlertDialogBuilder(activity)
|
||||
alertDialogBuilder.setTitle(R.string.import_from_qr_code)
|
||||
binding = ConfigNamingDialogFragmentBinding.inflate(activity.layoutInflater, null, false)
|
||||
binding?.apply {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<style name="WireGuardTheme" parent="Theme.MaterialComponents.DayNight">
|
||||
<style name="WireGuardTheme" parent="Theme.Material3.DayNight">
|
||||
<item name="colorPrimary">@color/primary_color</item>
|
||||
<item name="colorOnPrimary">@color/color_control_normal</item>
|
||||
<item name="colorPrimaryDark">@color/primary_color</item>
|
||||
@ -17,9 +17,6 @@
|
||||
<item name="elevationOverlayEnabled">true</item>
|
||||
<item name="android:statusBarColor">@color/status_bar_color</item>
|
||||
<item name="android:windowBackground">@color/primary_color</item>
|
||||
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
|
||||
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
|
||||
<item name="textInputStyle">@style/TextInputLayoutBase</item>
|
||||
<item name="materialCardViewStyle">@style/AppTheme.MaterialCardView</item>
|
||||
</style>
|
||||
|
||||
@ -32,12 +29,6 @@
|
||||
<item name="cardBackgroundColor">?attr/elevationOverlayColor</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
|
||||
<item name="colorPrimary">@color/secondary_color</item>
|
||||
<item name="colorSecondary">@color/secondary_color</item>
|
||||
<item name="android:windowBackground">?attr/colorBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="BottomSheetDialogTheme" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
<item name="android:navigationBarColor">?attr/colorBackground</item>
|
||||
@ -70,12 +61,4 @@
|
||||
<style name="ThemeOverlay.AppTheme.TextInputEditText.OutlinedBox" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
|
||||
<item name="colorControlActivated">@color/color_control_normal</item>
|
||||
</style>
|
||||
|
||||
<style name="TextInputLayoutBase" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
<item name="boxStrokeColor">?attr/colorSecondary</item>
|
||||
<item name="hintTextColor">?attr/colorOnPrimary</item>
|
||||
<item name="materialThemeOverlay">
|
||||
@style/ThemeOverlay.AppTheme.TextInputEditText.OutlinedBox
|
||||
</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -16,12 +16,26 @@
|
||||
<item name="elevationOverlayEnabled">false</item>
|
||||
<item name="android:statusBarColor">@color/tv_primary_color</item>
|
||||
<item name="android:windowBackground">@color/tv_primary_color</item>
|
||||
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
|
||||
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
|
||||
<item name="alertDialogTheme">@style/TvTheme.Dialog</item>
|
||||
<item name="materialAlertDialogTheme">@style/TvTheme.Dialog</item>
|
||||
<item name="textInputStyle">@style/TextInputLayoutBase</item>
|
||||
<item name="materialCardViewStyle">@style/TvTheme.MaterialCardView</item>
|
||||
</style>
|
||||
|
||||
<style name="TextInputLayoutBase" parent="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
<item name="boxStrokeColor">?attr/colorSecondary</item>
|
||||
<item name="hintTextColor">?attr/colorOnPrimary</item>
|
||||
<item name="materialThemeOverlay">
|
||||
@style/ThemeOverlay.AppTheme.TextInputEditText.OutlinedBox
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="TvTheme.Dialog" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
|
||||
<item name="colorPrimary">@color/secondary_color</item>
|
||||
<item name="colorSecondary">@color/secondary_color</item>
|
||||
<item name="android:windowBackground">?attr/colorBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="TvTheme.MaterialCardView" parent="Widget.MaterialComponents.CardView">
|
||||
<item name="cornerRadius">4dp</item>
|
||||
<item name="cardElevation">8dp</item>
|
||||
|
Loading…
Reference in New Issue
Block a user