TrianguloY / URLCheck

Android app by TrianguloY: URLCheck
Other
969 stars 57 forks source link

Collapse input text module when the text is too big #388

Open Rigerhit047 opened 1 month ago

Rigerhit047 commented 1 month ago

Describe a related problem (optional)

I have been forced to put the input text module on the drawer, since when there is too much text on the link (like with an auth link, a redirection or a link with preferences) it will take all of the URLChecker window or a big part of it, depending on the URL size, therefore making it unsuitable to have it as a non-collapsable module, since it will make the experience worse having to scroll down a lot if it is in the top which is also its default position.

ResizedImage_2024-10-08_20-28-33_2151

Describe your suggested feature

It should collapse after reaching a certain amount of characters, so that it doesn't take all of the screen or a big part of it, since it is not normally needed to see all of the link, and if you want to see it, the user would just tap it to view it in full, or use the Uri parts module.

So if a link has a certain amount of characters, it should collapse it until you enter edit mode. Like this: ResizedImage_2024-10-08_20-37-22_1701

Describe alternatives you've considered for your suggested feature

Other options would be to only collpase the link if it would take a set % of screen size, or when it has taken a certain amount of lines. Maybe introduced by the user itself if it is not easy to calculate.

There is also the minimalist route of just showing the domain highlighted and some paths like a PC browser, and show the rest of the link if you enter edit mode, although I do not know if that idea would be liked, but it would certainly make the input text more clean to look at and not hinder the rest of the modules.

Other details

No response

Acknowledgements

TrianguloY commented 1 month ago

It's made like that on purpose, because I consider that a long link should be reviewed before accessing it, even if it requires some scrolling.

But I can understand why it's not desired, and it should be easy to allow the user to configure a maximum number of lines to show for example (even if by default it will show all).

In edit mode though I think it would be best to show it in full, although having it in a smaller scrollable list could also be a solution (however a scrollable list inside another scrollable list may have some issues in some cases).

If you could edit the application code to be exactly like you want (no settings required) how would you do it?

PabloOQ commented 1 month ago

Some ideas I have thought of:

Rigerhit047 commented 1 month ago

I agree that a long link should be reviewed, the problem is when you come across long links regularly, highlighting the possible case of links with preferences or redirections appended to them that a user comes across daily. I do agree with PabloOQ's ideas, but I would do it a bit differently:

And I would give it priority based on the order they are in, so that would make the non-ASCII and HTTP pattern have priority over the rest by default, another option is that instead of coloring the whole section, it would display an underline instead, that way there can be multiple underlines for each pattern so they are all visible, that could look a bit weird, though and that is probably not easy to implement either.

Even if the module doesn't turn color-coded, it would be useful to have it act like that. That way, it would make sense to the input text to be scrollable if it is in a text box, it would be easy to exit edit view. You cannot exit edit view currently without hidding the module with the banner or if the link changes when checking its status, unshortening it, or using the history module.

With those changes, the input text module would look clean with colors (or just with the gray and black/white) and be informative, will be able to view and manipulate the link without issues, and would allow the user to be able to customize the app further, if there are actually user variables for colors and text limits or at least for screen sizes.

TrianguloY commented 1 month ago

so many ideas 😵

I think for now it's best to start simple and just have the option to limit the number of displayed lines. Since a scrollable 'inside-view' seems to be mentioned a lot, that would probably be the best setup, both in normal and edit mode.

I really like the 'use color instead of bold for the domain' (or even better: both) because with the new 'visual' mode in the edit module the text is less saturated. I'll probably try to implement this...sometime.

As for using color in the visual module, even if that seems useful (and I'm sure it is) I would like to keep modules independent (as much as possible). In fact when I developed the pattern module for the first time, I tried to make it so that the 'invalid characters' pattern would show those invalid characters in the url. But the code to maintain inter-module communication is hard and becomes a mess pretty fast, so as I said I would like to avoid that if possible. Having a separate configuration in the text module just to highlight regex patterns with colors may be a nice idea though. It's true that you will need to 'duplicate' some patterns, but that would be far easier to implement (In fact it could be really easy...I need to think about it).

Anyway, that you so much for your opinion and ideas! Most probably I won't be able to implement most of them, sorry, but still they are interesting to think about, and I may add some of the easy ones. (also, as usual, prs are welcomed! but please try to keep them short :)

Rigerhit047 commented 4 weeks ago

Haha, well, you did ask for how I'd do it, so that's that, but realistically I would just be happy if the module collapses where there it is due and only maybe the domain highlighting as a little extra.

You make a great point, it would really cause problems if the modules stop being, well, modularized, you really make a great point there, I forgot for a moment they were modules. Have a nice day :)

TrianguloY commented 3 weeks ago

I'll add the option to limit the number of lines in the view mode, no problem.

For the edit mode however, I had to replace it with a popup editor (to avoid triggering updates each time a character was entered, otherwise the automation was going crazy). Now, when you click the text, a new popup is opened with the full text (also, the keyboard open automatically). You have the options to accept or discard the changes.

This is a mockup (some things may change in the final version). I personally like this change, but I'm interested in your opinion about it:

https://github.com/user-attachments/assets/30bd2289-e2e6-4794-8702-73398aa9d34f

Rigerhit047 commented 3 weeks ago

I think that is actually perfect! The editor in a popup does makes sense and find it a welcome change. I find the text limit to be juust right and the scrollbar does look really good, many thanks for doing it! :)

TrianguloY commented 2 weeks ago

Turns out that making a scrolling thing inside another scrolling thing in android is almost impossible (on android, the outer scrollview will 'eat' the touch events and the inner scrollview have no chance for reacting to them). There are hacks and workarounds, but I was unable to make them work no matter how much I tried. There is apparently a solution using an external library, but triplicating the app size just for this...I would like to avoid it.

If the outer scrollview is not scrollable (if the height is small) it will work as expected (more or less) but as soon as the outer scroll is long enough...it will just not work. On the video above I tested with a small dialog, that's why it was working (I also hardcoded the height, but I think I can solve that).

So, in order to avoid spending more time on this, I can either leave this feature for the future, or implement a simple maxLines setting that will cut the number of displayed lines, even though you won't be able to scroll to see them, you will need to click the view. What would you prefer?

Sorry for the bad news

Edit: I'll just skip this for now