This is based on an open source autosizing textview for Android.