Expected Behavior:
When you retrofit existing TextViews and change them to AutoFitTextViews in xml, they should resize correctly as more text is added to field.
Observed Behavior:
TextViews changed to AutoFitTextViews Don't resize correctly to the Default min size (8sp)
Reproducible Test:
In the project sample, remove the following line in main.xml
autofit:minTextSize="8sp"
see screenshot below
This method signature applies SP as no TypedUnit is specified. So, taking my density into account (xxhdpi) the density factor is 3. The min was/should be 24px but then the above method changed it to 72px
Proposed Solution:
change AutoFitHelper.java:80 to
helper.setRawMinTextSize(minTextSize);
helper.setPrecision(precision);
Expected Behavior: When you retrofit existing TextViews and change them to AutoFitTextViews in xml, they should resize correctly as more text is added to field.
Observed Behavior: TextViews changed to AutoFitTextViews Don't resize correctly to the Default min size (8sp)
Reproducible Test: In the project sample, remove the following line in main.xml autofit:minTextSize="8sp" see screenshot below
Reason: AutoFitHelper.java:66 int minTextSize = (int) helper.getMinTextSize(); AutoFitHelper.java:75 minTextSize = ta.getDimensionPixelSize(R.styleable.AutofitTextView_minTextSize, minTextSize);
both of the returned sizes above are in Pixels...
AutoFitHelper.java:80 helper.setMinTextSize(minTextSize)
This method signature applies SP as no TypedUnit is specified. So, taking my density into account (xxhdpi) the density factor is 3. The min was/should be 24px but then the above method changed it to 72px
Proposed Solution: change AutoFitHelper.java:80 to helper.setRawMinTextSize(minTextSize); helper.setPrecision(precision);