PatilShreyas / MaterialDialog-Android

📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Apache License 2.0
939 stars 143 forks source link

[BUG] Button not accessible on small screens #44

Closed Awsom3D closed 3 years ago

Awsom3D commented 3 years ago

Hi, thanks for your work on this lib, it's super useful !

Unfortunately, some of my users are complaining that they can't click on the dialog button because it's simply out of the window, in portrait or paysage. I found out that they have relatively small screens (720p or less).

On my larger smartphone, the animation is effectively disabled in paysage to make some more room, but on smaller phones it doesn't work either way.

Is there a way to fix this properly in the lib so users can scroll to the dialog button ?

Thanks for your input,

Awsom3D commented 3 years ago

In case anyone need it, here is my hotfix in kotlin, everytime I build a materialDialog.

if (resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK == Configuration.SCREENLAYOUT_SIZE_SMALL) // If screen is small
    materialDialog.animationView.visibility = View.GONE // remove animation part

But it's not a long term solution since users won't be able to scroll if the text gets longer.

PatilShreyas commented 3 years ago

Thanks @Awsom3D for reporting this issue. Will fix this issue

PatilShreyas commented 3 years ago

@Awsom3D I tested this on the device (emulator) having dimension 3.5" and saw that it's perfectly working fine. Can you give me more details on this?

PatilShreyas commented 3 years ago

@Awsom3D Also, a small recording/snapshot of the issue would be useful.

Awsom3D commented 3 years ago

I think the main difference is that I have a few lines of text (about 7), so my modal may be longer than yours.

What you see below is the version I have hotfix'ed, but you can try the same on your device and see that the behavior will be different, and you won't be able to see the button anymore.

Some of my users have very small screens 😅

Screenshot_20210423-100254

https://user-images.githubusercontent.com/1741288/115840639-2dd67100-a41c-11eb-8a21-742da16636af.mp4

PatilShreyas commented 3 years ago

@Awsom3D Thanks for sharing these references. Now I got the problem.

So you're using this as an informative dialog. I think instead of hiding animation for smaller screens, we should support Scroll-ability for the dialog. I'll take a look at it.

PatilShreyas commented 3 years ago

Thanks, @Awsom3D for this issue. This issue has been fixed in the new version 2.2.1.

PatilShreyas commented 3 years ago

Also, @Awsom3D, as I can see you've included the privacy policy link in the message. The good news is that now you can make it clickable 🎉.

With v2.2.1 now you can add HTML spanned text for the message.

Awsom3D commented 3 years ago

Thank you so much @PatilShreyas ; this is awesome 😍

Awsom3D commented 3 years ago

@PatilShreyas Just so you know, since you switched to HTML, the \n are not displayed correctly in the modal text.

I'll just use <br> for now, but other developers could be confused or see it as a regression.

Screenshot_20210424-181807

PatilShreyas commented 3 years ago

Ok @Awsom3D. As you mentioned, <br> is recommended solution I guess.

Awsom3D commented 3 years ago

If we could get an accessor to the Textview message, maybe we could use Linkify without using HTML.

Linkify.addLinks(textview, Linkify.WEB_URLS)

Awsom3D commented 3 years ago

IMO using the html markup <br> is an hotfix, because if you want the MaterialDialog to be easy to use for users switching from classic AlertDialog, you can't ask them to change all of their translations, and use another language (even if HTML is pretty simple) to make it work.

Maybe keep the way things were before and add an dialog.enableHtml(boolean) ?

PatilShreyas commented 3 years ago

Actually support for HTML is not only to show links. Developers can customise message styling as they want. But whatever you mentioned above makes sense. So I think, instead of directly getting input from Builder, we can have another builder method specific for spanned text like .setMessage(Spanned spannedText) which will be more generic and specific for HTML formatting.