Open THEONE10211024 opened 9 years ago
Are you talking about this line here? https://github.com/grantland/android-autofittextview/blob/master/library/src/main/java/me/grantland/widget/AutofitHelper.java#L80
If what you're saying is correct, we get the pixel size via TypedArray.getDimensionPixelSize()
and then pass that into AutofitHelper.setMinTextSize()
with the unit TypedValue.COMPLEX_UNIT_PX
. So we get the pixel size and state that it's the pixel size when reusing it. Am I completely missing the issue you're trying to convey?
I'm not for sure but I think the
create()
method inAutofitHelper.java
, this linehelper.setMinTextSize(minTextSize).setPrecision(precision);
is not right. You should callsetRawMinTextSize()
rather than callsetMinTextSize()
. And I have reasons for this: I notice thatgetDimensionPixelSize()
method returns size in pixel not insp
ordp
, as we go deep inside, we can find that this method already convertssp
topx
! if you callsetMinTextSize()
method, you will convert it again! So I think this line should be changed to something likehelper.setRawMinTextSize(minTextSize).setPrecision(precision);
Am I right? Thank you!