mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-15 19:20:53 -04:00
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.DialogInterface
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
@@ -41,7 +40,6 @@ fun Context.showDialog(
|
||||
negativeListener: DialogInterface.OnClickListener?
|
||||
) {
|
||||
runOnUiThread {
|
||||
val backgroundColor: Int = getStyledAttributeColor(android.R.attr.colorBackground)
|
||||
val builder = MaterialAlertDialogBuilder(this).apply {
|
||||
setTitle(title)
|
||||
setMessage(message)
|
||||
@@ -56,7 +54,6 @@ fun Context.showDialog(
|
||||
setNegativeButton(android.R.string.cancel, negativeListener)
|
||||
}
|
||||
|
||||
background = ColorDrawable(backgroundColor)
|
||||
}.create()
|
||||
|
||||
builder.show()
|
||||
@@ -69,4 +66,4 @@ fun Fragment.showDialog(@StringRes titleId: Int, @StringRes messageId: Int) {
|
||||
|
||||
fun Fragment.showDialog(title: String, message: String) {
|
||||
requireContext().showDialog(title, message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
|
||||
package com.aurora.store.view.ui.preferences
|
||||
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import com.aurora.extensions.getStyledAttributeColor
|
||||
import com.aurora.extensions.restartApp
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.databinding.ActivitySettingBinding
|
||||
@@ -144,8 +142,6 @@ class SettingsActivity : BaseActivity(),
|
||||
restartApp()
|
||||
}
|
||||
.setNegativeButton(getString(R.string.action_later)) { dialog, _ -> dialog.dismiss() }
|
||||
val backGroundColor = getStyledAttributeColor(android.R.attr.colorBackground)
|
||||
builder.background = ColorDrawable(backGroundColor)
|
||||
builder.create()
|
||||
builder.show()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user