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

Fix FixedPreferencesTitleLength

Open Arthur-Milchior opened this issue 4 months ago • 5 comments

I tried to remove a maxLength="41" and lint was still succesful.

I finally took the time to learn how the linter works, after having years where it is a mystery.

Given that the code was not very clear to me, I added comments, and rewrote part of it.

I then realized that the issue was that, if the string was not found, no error was recorded. Strings may be missing either:

  • because the string is hard coded in English (developer options), in which case I explicitly decided to ignore the strings, or
  • because the string is defined outside of 10-preferences.xml

As far as I can tell, even if the string is not purely a preference, the max length constraint should still be present outside of preferences.

I also updated the string so that, with maxLength less than 41, the lint still works. This is important because some strings are being used in Menu, where the maxLength is even shorter. A future PR should reuse this same code for menus.

I also rewrote slightly the error message, hopefully improving them. Admittedly, given that only developers will see the errors, it was not that important a change.

Finally, of course, I added the maxLength to every strings that were found by the linter.

Arthur-Milchior avatar Oct 10 '24 01:10 Arthur-Milchior