Use background from theme for MaterialAlertDialog
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ package com.aurora.extensions
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.graphics.drawable.ColorDrawable
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@@ -41,7 +40,6 @@ fun Context.showDialog(
|
|||||||
negativeListener: DialogInterface.OnClickListener?
|
negativeListener: DialogInterface.OnClickListener?
|
||||||
) {
|
) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
val backgroundColor: Int = getStyledAttributeColor(android.R.attr.colorBackground)
|
|
||||||
val builder = MaterialAlertDialogBuilder(this).apply {
|
val builder = MaterialAlertDialogBuilder(this).apply {
|
||||||
setTitle(title)
|
setTitle(title)
|
||||||
setMessage(message)
|
setMessage(message)
|
||||||
@@ -56,7 +54,6 @@ fun Context.showDialog(
|
|||||||
setNegativeButton(android.R.string.cancel, negativeListener)
|
setNegativeButton(android.R.string.cancel, negativeListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
background = ColorDrawable(backgroundColor)
|
|
||||||
}.create()
|
}.create()
|
||||||
|
|
||||||
builder.show()
|
builder.show()
|
||||||
|
|||||||
@@ -19,12 +19,10 @@
|
|||||||
|
|
||||||
package com.aurora.store.view.ui.preferences
|
package com.aurora.store.view.ui.preferences
|
||||||
|
|
||||||
import android.graphics.drawable.ColorDrawable
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.aurora.extensions.getStyledAttributeColor
|
|
||||||
import com.aurora.extensions.restartApp
|
import com.aurora.extensions.restartApp
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.databinding.ActivitySettingBinding
|
import com.aurora.store.databinding.ActivitySettingBinding
|
||||||
@@ -144,8 +142,6 @@ class SettingsActivity : BaseActivity(),
|
|||||||
restartApp()
|
restartApp()
|
||||||
}
|
}
|
||||||
.setNegativeButton(getString(R.string.action_later)) { dialog, _ -> dialog.dismiss() }
|
.setNegativeButton(getString(R.string.action_later)) { dialog, _ -> dialog.dismiss() }
|
||||||
val backGroundColor = getStyledAttributeColor(android.R.attr.colorBackground)
|
|
||||||
builder.background = ColorDrawable(backGroundColor)
|
|
||||||
builder.create()
|
builder.create()
|
||||||
builder.show()
|
builder.show()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user