Improve UI of `IncrementerNumberRangePreferenceCompat`
Off the top of my head:
- [ ] The borders don't look good
- [ ] The + and - text is too small
- [ ] buttons do not appear visibly disabled when the min/max is hit
- [ ] A user can enter a bad value into the textbox without issue
- 'OK' still appears enabled
- [ ] Textbox isn't using a material theme which provides a visual
errordisplay
Originally posted by @david-allison in https://github.com/ankidroid/Anki-Android/issues/20001#issuecomment-3708277944
Good first issue: pick the issues you want to work on and post it as a comment. No need to tackle all of these at once
Hi, can I work on 1 and 2 and later the other three?
Sure
@david-allison I see @hemampandey is working on 1 and 2. Can i work on the remaining three tasks?
sure, as long as
- you're fine delaying a merge of your PR if theirs is submitted within a reasonable time
- you're happt fixing conflicts from the merge
Yes, I am fine to wait and also handle any merge conflicts that arise.
The screenshots are from IncrementerNumberRangePreferenceCompat, aren't they?
Hi, is this okay?
https://github.com/user-attachments/assets/2425769e-49c8-4128-b9e2-eca1ae62c04a
Hi! I noticed the issue is still open. I plan to:
- focus on
- avoid overlapping with existing work
- share progress before opening a PR
If that sounds good, I’ll start with a draft change. Thanks!
@suhas181 i am still working on this
@david-allison , i have updated the UI as per your checklist and set the buttons to use standard material 3 attributes, but it is falling back to purple as global theme is not defined should i add the mapping to the global AlertDialogStyle? or create a specific IncrementerDialogStyle
please check the above video shared for any changes
Let's move to start work on:
- https://github.com/ankidroid/Anki-Android/issues/18767
Feedback as a non-designer:
- The error color doesn't look good (use the default material error color)
- Edit: why not use a material
TextInputLayout, then you get.error
- Edit: why not use a material
- The text feels too big
- Unsure how I feel about the borders, the buttons seem to dominate the dialog too heavily
Thanks for the reply i will work on this
@Hemampandey Are you still working on this issue? If not I can work on this.
Hi, is this issue still being worked on?
If not, I'd like to pick it up...I switched the layout to XML and used TextInputLayout for the errors. I also managed to fix the purple color issue locally without needing the global theme update
Here are the images:
Let me know if this approach looks alright?
Looks cool! (and yes, you can work on it, thanks!!)
I like the color scheme, but the actual colors don't meet accessibility guidelines for contrast. I think the contrast between the buttons and the background also needs thought
Taking the top-right image:
https://webaim.org/resources/contrastchecker/?fcolor=B2BEBF&bcolor=E4F5FD
Hi @david-allison thanks for the pointer! I actually learned a lot about accessibility guidelines through this, so it was super helpful
I realized i was using the global colorSurface and colorPrimary which is why the colors weren't working well across different themes. I have defined custom attributes for all 4 themes now
Here are the updated images: Enabled buttons:
Error text and disabled buttons:
Regarding the contrast issue you pointed out in the top-right image:
I like the color scheme, but the actual colors don't meet accessibility guidelines for contrast. I think the contrast between the buttons and the background also needs thought
Taking the top-right image:
In that specific image the buttons are actually disabled. Since I wanted that "faded out" look, I checked and it seems okay if we don't strictly apply the contrast ratio there For the enabled buttons I tried my best to maintain 3:1 ratio, but in a couple of places, I couldn't quite hit it without the colors looking a bit weird (either too dark or too washed out). Personally, I think the button shapes are distinguishable enough, and the icons are definitely clear, so I feel this color scheme works well as is
Is it okay to open a pr?
That looks great IMO. I would like to experiment with different "+" colors on the light theme. I think disabled buttons are fine, as this is what isEnabled should do naturally.
We can discuss more on the PR.
I will add in a final request which shouldn't be handled in the PR, unless you really want to.
We should support suffixText on the TextInputLayout. This was recently requested in:
- https://github.com/ankidroid/Anki-Android/issues/18553
I'm MORE than happy to take this on as a follow-up
I missed this issue, so in #18553, I suggested removing the +/- buttons and left aligning the number. I don't see the point in the buttons to be honest.
The +/- is better in our case:
https://www.nngroup.com/articles/input-steppers/
As a simple argument: it removes a tap from incrementing the number by 1,
Most of the input values are centered around a single value, and in many cases (card counts) we want to encourage gradual deviation away from the current value