android-autofittextview icon indicating copy to clipboard operation
android-autofittextview copied to clipboard

Konradjanica.heightfitting

Open KonradJanica opened this issue 10 years ago • 4 comments

https://github.com/grantland/android-autofittextview/issues/19

Adds an option to allow text downsizing to fit height.

See methods:

  • setHeightFitting()
  • isHeightFitting()

See members:

  • isHeightFitting
  • heightToFit

Works in project https://github.com/KonradJanica/aMatch

Notes:

  • I did it very quickly and AutofitLayout isn't tested but only one line was added.
  • mIsHeightFitting is a static member due to autofit() being a static method

P.S. sorry about the entire file change, I think my IDE changed something... I suggest maybe leaving it as a new branch until thoroughly tested.

KonradJanica avatar Jun 19 '15 08:06 KonradJanica

This would be an awesome feature to add, however, it is very difficult to review as the entire files are shown as changed. Any chance you can update this with correct diffs?

grantland avatar Jul 14 '15 05:07 grantland

I'll take a look, no guarantees because I'm a bit stretched for time this month. Without thinking I automatically changed tab indenting to 4 space indenting via the android studio prompt. :-(

KonradJanica avatar Jul 20 '15 03:07 KonradJanica

Question 1:

This line:

int targetHeight = view.getHeight() - view.getPaddingTop() - view.getPaddingTop();

Should it not be:

int targetHeight = view.getHeight() - view.getPaddingTop() - view.getPaddingBottom();

Question 2:

These two lines:

float textHeight = getTextHeight(text, paint, targetWidth, size);
textHeight = getTextHeight(text, paint, targetWidth, size);

the second line seems redundant, is it not?

brcolow avatar Nov 22 '15 06:11 brcolow

Hey @grantland. can you merge this please? My specific case needs this badly. Thanks.

shahimclt avatar Mar 24 '16 00:03 shahimclt