Added a call to Invalidate in the onSizeChanged method. This was needed to handle the case when the button was being sent onClick messages programmatically and the changes to the button weren't getting updated when the text changed.
Also changed .isEmpty() to .length() to make it compatible with the older APIs.