Fix #5151: Use DialogUtil methods instead of AlertDialog.Builder (#5152)

* Update AboutActivity to use DialogUtil

* Update ProfileActivity to use DialogUtil

* Update AchievementsFragment to use DialogUtil

* Remove wrong message set in ProfileActivity

* Update DialogUtil to accept null instead of empty string
This commit is contained in:
Chan Jun Da 2023-02-24 17:00:58 +08:00 committed by GitHub
parent 968911db32
commit 20100c4960
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 65 deletions

View file

@ -34,8 +34,8 @@ object DialogUtil {
@JvmStatic
fun showAlertDialog(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
onPositiveBtnClick: Runnable?,
onNegativeBtnClick: Runnable?
) {
@ -53,8 +53,8 @@ object DialogUtil {
@JvmStatic
fun showAlertDialog(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
positiveButtonText: String?,
negativeButtonText: String?,
onPositiveBtnClick: Runnable?,
@ -74,8 +74,8 @@ object DialogUtil {
@JvmStatic
fun showAlertDialog(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
onPositiveBtnClick: Runnable?,
onNegativeBtnClick: Runnable?,
customView: View?,
@ -97,8 +97,8 @@ object DialogUtil {
@JvmStatic
fun showAlertDialog(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
positiveButtonText: String?,
negativeButtonText: String?,
onPositiveBtnClick: Runnable?,
@ -122,8 +122,8 @@ object DialogUtil {
@JvmStatic
fun showAlertDialog(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
positiveButtonText: String?,
onPositiveBtnClick: Runnable?,
cancelable: Boolean
@ -152,8 +152,8 @@ object DialogUtil {
*/
private fun createAndShowDialogSafely(
activity: Activity,
title: String,
message: String,
title: String?,
message: String?,
positiveButtonText: String? = null,
negativeButtonText: String? = null,
onPositiveBtnClick: Runnable? = null,
@ -171,8 +171,8 @@ object DialogUtil {
}
showSafely(activity, AlertDialog.Builder(activity).apply {
setTitle(title)
setMessage(message)
title?.also{setTitle(title)}
title?.also{setMessage(message)}
setView(customView)
setCancelable(cancelable)
positiveButtonText?.let {