Make all Dialogs use @color/backgroundColor as the background color

We wanted the color of the modals used by the dialogs to be the same as our regular background color rather than a lighter grey. This has now been enforced with style attributes in the case of `AlertDialog` and `setBackground` in the case of `BottomSheetDialog`.
This commit is contained in:
PixelyIon 2021-11-11 16:32:21 +05:30
parent 3f3891839e
commit 36a1f2a2ec
9 changed files with 9 additions and 10 deletions

View File

@ -70,6 +70,7 @@ class AppDialog : BottomSheetDialogFragment() {
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(requireContext().getColor(R.color.backgroundColor))
val missingIcon = ContextCompat.getDrawable(requireActivity(), R.drawable.default_icon)!!.toBitmap(256, 256)

View File

@ -48,6 +48,7 @@ class ButtonDialog @JvmOverloads constructor(private val item : ControllerButton
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(requireContext().getColor(R.color.backgroundColor))
if (item != null && context is ControllerActivity) {
val context = requireContext() as ControllerActivity

View File

@ -47,6 +47,7 @@ class RumbleDialog @JvmOverloads constructor(val item : ControllerGeneralViewIte
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(requireContext().getColor(R.color.backgroundColor))
if (item != null && context is ControllerActivity) {
val context = requireContext() as ControllerActivity

View File

@ -225,6 +225,7 @@ class StickDialog @JvmOverloads constructor(val item : ControllerStickViewItem?
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(requireContext().getColor(R.color.backgroundColor))
if (item != null && context is ControllerActivity) {
val context = requireContext() as ControllerActivity

View File

@ -9,6 +9,7 @@ import android.graphics.Rect
import android.os.Bundle
import android.view.*
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import emu.skyline.R
import emu.skyline.databinding.LicenseDialogBinding
/**
@ -34,6 +35,7 @@ class LicenseDialog : BottomSheetDialogFragment() {
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(requireContext().getColor(R.color.backgroundColor))
binding.libraryTitle.text = requireArguments().getString(LicensePreference.LIBRARY_TITLE_ARG)
binding.libraryUrl.text = requireArguments().getString(LicensePreference.LIBRARY_URL_ARG)

View File

@ -3,5 +3,4 @@
<color name="colorPrimary">#FF4285F4</color>
<color name="backgroundColor">#FF121212</color>
<color name="backgroundColorVariant">#323232</color>
<color name="dialogSurface">#FF121213</color>
</resources>

View File

@ -4,5 +4,4 @@
<color name="colorPrimary">#FF1E58F0</color>
<color name="backgroundColor">@android:color/white</color>
<color name="backgroundColorVariant">#F8F8F8</color>
<color name="dialogSurface">@android:color/white</color>
</resources>

View File

@ -18,8 +18,4 @@
<item name="materialThemeOverlay">@style/ChipChoice.Material</item>
<item name="shapeAppearance">@style/ShapeAppearance.MaterialComponents.LargeComponent</item>
</style>
<style name="ModalBottomSheetDialog" parent="Widget.MaterialComponents.BottomSheet.Modal">
<item name="backgroundTint">@color/dialogSurface</item>
</style>
</resources>

View File

@ -9,18 +9,17 @@
<item name="android:statusBarColor">@color/backgroundColor</item>
<item name="android:navigationBarColor">@color/backgroundColor</item>
<item name="android:colorBackground">@color/backgroundColor</item>
<item name="colorBackgroundFloating">@color/backgroundColor</item>
<item name="colorSurface">@color/backgroundColor</item>
<item name="chipChoiceStyle">@style/ChipChoice</item>
<item name="alertDialogTheme">@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.MaterialComponents.BottomSheetDialog</item>
</style>
<style name="AppTheme" parent="BaseAppTheme">
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
</style>
<style name="ThemeOverlay.AppTheme.BottomSheetDialog" parent="ThemeOverlay.MaterialComponents.BottomSheetDialog">
<item name="bottomSheetStyle">@style/ModalBottomSheetDialog</item>
</style>
</resources>