grantland / android-autofittextview

A TextView that automatically resizes text to fit perfectly within its bounds.
Apache License 2.0
4.27k stars 689 forks source link

Lower minSdkVersion #33

Closed pawelantczak closed 9 years ago

pawelantczak commented 9 years ago

Hello. Is there a chance, that you will reduce minSdkVersion? To 10 for example. Regards.

grantland commented 9 years ago

@olivierg13 did that here: https://github.com/OrangeGangsters/android-autofittextview/commit/efa48edc6cb32acfc29221bb2eb8a3b09ec504b2

I'm not sure what the repercussions are of disabling OnLayoutChangeListener, but it seems like you'd lose the ability to refit the text on layout changes. You could possibly call autofit() from your view's onLayout() method manually in this situation.

oliveeyay commented 9 years ago

Hello @pawelantczak, @grantland

Indeed, our app support SDK version 10 (beurghhhhh ^^), so I was forced to do it. The OnLayoutChangeListener is not anymore called, but we don't really care because we only "support" version 10, so even if the experience is a bit bad, we don't care as soon as it doesn't crash.

If you want to still use it, you can run something like:

if (getView() != null) {
                    getView().post(new Runnable() {
                                       @Override
                                       public void run() {
                                           //TODO refresh autofittextview
                                       }
                                   }
                    );
}

Running a runnable on the view is a way to run a code as soon as the view is visible.

Cheers,

Olivier

pawelantczak commented 9 years ago

Thanks! @grantland for lib @olivierg13 for backport