Aidan Follestad 5 years ago
parent
commit
c3b8240779

+ 0 - 3
bottomsheets/src/main/java/com/afollestad/materialdialogs/bottomsheets/BottomSheet.kt

@@ -184,13 +184,10 @@ class BottomSheet(
   }
 
   override fun setBackgroundColor(
-    context: Context,
-    window: Window,
     view: DialogLayout,
     color: Int,
     cornerRounding: Float
   ) {
-    window.setBackgroundDrawable(null)
     bottomSheetView?.background = GradientDrawable().apply {
       cornerRadii = floatArrayOf(
           cornerRounding, cornerRounding, // top left

+ 2 - 6
core/src/main/java/com/afollestad/materialdialogs/DialogBehavior.kt

@@ -59,8 +59,6 @@ interface DialogBehavior {
 
   /** Sets the root dialog background. */
   fun setBackgroundColor(
-    context: Context,
-    window: Window,
     view: DialogLayout,
     @ColorInt color: Int,
     cornerRounding: Float
@@ -142,16 +140,14 @@ object ModalDialog : DialogBehavior {
   }
 
   override fun setBackgroundColor(
-    context: Context,
-    window: Window,
     view: DialogLayout,
     @ColorInt color: Int,
     cornerRounding: Float
   ) {
-    window.setBackgroundDrawable(GradientDrawable().apply {
+    view.background = GradientDrawable().apply {
       cornerRadius = cornerRounding
       setColor(color)
-    })
+    }
   }
 
   override fun onPreShow(dialog: MaterialDialog) = Unit

+ 3 - 2
core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.kt

@@ -19,7 +19,9 @@ package com.afollestad.materialdialogs
 
 import android.app.Dialog
 import android.content.Context
+import android.graphics.Color.TRANSPARENT
 import android.graphics.Typeface
+import android.graphics.drawable.ColorDrawable
 import android.graphics.drawable.Drawable
 import android.util.TypedValue
 import android.util.TypedValue.COMPLEX_UNIT_DIP
@@ -425,9 +427,8 @@ class MaterialDialog(
     }
     val cornerRadius =
       cornerRadius ?: resolveDimen(windowContext, attr = R.attr.md_corner_radius)
+    window?.setBackgroundDrawable(ColorDrawable(TRANSPARENT))
     dialogBehavior.setBackgroundColor(
-        context = windowContext,
-        window = window!!,
         view = view,
         color = backgroundColor,
         cornerRounding = cornerRadius