KotatsuApp / Kotatsu

Manga reader for Android
https://kotatsu.app
GNU General Public License v3.0
3.2k stars 144 forks source link

App update dialog doesn't peoperly display buttons #880

Closed MariusAlbrecht closed 1 month ago

MariusAlbrecht commented 1 month ago

Brief summary

buttons get displayed one per line in a scrollable view, like this:

https://github.com/KotatsuApp/Kotatsu/assets/64852250/8434c91f-94d1-4421-adf9-d34b5c36c4ef

I expect them to all get displayed without the need to scroll (and optimally, side-by-side). That also seems to be the intent the material design has: https://m2.material.io/components/dialogs/android#alert-dialog (tho this example is v2, newer ones also seem to at least suggest keeping all action buttons in view)

I think this is an actual issue because I do not expect a scrollable view with options visible only after scrolling. That essentially hides the neutral button (and partially the negative one) which shouldn't be the case imo.

Steps to reproduce

get the update dialog

Kotatsu version

6.8.3

Android version

12

Device

OnePlus 7 Pro

Acknowledgements

MariusAlbrecht commented 1 month ago

relevant code is here:

fun show(version: AppVersion) {
    latestVersion = version
    val message = buildSpannedString {
        append(activity.getString(R.string.new_version_s, version.name))
        appendLine()
        append(activity.getString(R.string.size_s, FileSize.BYTES.format(activity, version.apkSize)))
        appendLine()
        appendLine()
        append(Markwon.create(activity).toMarkdown(version.description))
    }
    MaterialAlertDialogBuilder(activity, DIALOG_THEME_CENTERED)
        .setTitle(R.string.app_update_available)
        .setMessage(message)
        .setIcon(R.drawable.ic_app_update)
        .setNeutralButton(R.string.open_in_browser) { _, _ ->
            val intent = Intent(Intent.ACTION_VIEW, version.url.toUri())
            activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.open_in_browser)))
        }.setPositiveButton(R.string.update) { _, _ ->
            downloadUpdate()
        }.setNegativeButton(android.R.string.cancel, null)
        .setCancelable(false)
        .create()
        .show()
}

I'll go ahead and assume this happens because the text of all three doesn't fit side-by-side.

I suggest these two possible solutions:

Koitharu commented 1 month ago

I'll try to replace this dialog with an activity