Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Improve UI of `IncrementerNumberRangePreferenceCompat`

Open david-allison opened this issue 10 months ago • 20 comments

Off the top of my head:

  1. [ ] The borders don't look good
  2. [ ] The + and - text is too small
  3. [ ] buttons do not appear visibly disabled when the min/max is hit
  4. [ ] A user can enter a bad value into the textbox without issue
    • 'OK' still appears enabled
  5. [ ] Textbox isn't using a material theme which provides a visual error display
Screenshot 2026-01-05 at 00 24 05

Originally posted by @david-allison in https://github.com/ankidroid/Anki-Android/issues/20001#issuecomment-3708277944

david-allison avatar Jan 04 '26 17:01 david-allison

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

david-allison avatar Jan 04 '26 17:01 david-allison

Hi, can I work on 1 and 2 and later the other three?

hemampandey avatar Jan 04 '26 20:01 hemampandey

Sure

david-allison avatar Jan 04 '26 20:01 david-allison

@david-allison I see @hemampandey is working on 1 and 2. Can i work on the remaining three tasks?

Akira2206 avatar Jan 04 '26 21:01 Akira2206

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

david-allison avatar Jan 05 '26 01:01 david-allison

Yes, I am fine to wait and also handle any merge conflicts that arise.

Akira2206 avatar Jan 05 '26 08:01 Akira2206

The screenshots are from IncrementerNumberRangePreferenceCompat, aren't they?

BrayanDSO avatar Jan 05 '26 09:01 BrayanDSO

Hi, is this okay?

https://github.com/user-attachments/assets/2425769e-49c8-4128-b9e2-eca1ae62c04a

hemampandey avatar Jan 08 '26 06:01 hemampandey

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 avatar Jan 08 '26 08:01 suhas181

@suhas181 i am still working on this

hemampandey avatar Jan 08 '26 08:01 hemampandey

@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

hemampandey avatar Jan 08 '26 10:01 hemampandey

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
  • The text feels too big
  • Unsure how I feel about the borders, the buttons seem to dominate the dialog too heavily

david-allison avatar Jan 09 '26 04:01 david-allison

Thanks for the reply i will work on this

hemampandey avatar Jan 09 '26 04:01 hemampandey

@Hemampandey Are you still working on this issue? If not I can work on this.

Fandroid745 avatar Jan 15 '26 04:01 Fandroid745

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?

Akira2206 avatar Jan 28 '26 23:01 Akira2206

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

Image

david-allison avatar Jan 29 '26 01:01 david-allison

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?

Akira2206 avatar Jan 30 '26 22:01 Akira2206

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

david-allison avatar Jan 31 '26 11:01 david-allison

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.

ZornHadNoChoice avatar Jan 31 '26 14:01 ZornHadNoChoice

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

david-allison avatar Jan 31 '26 15:01 david-allison