alphamu / PinEntryEditText

An EditText that looks like a pin entry field. It is highly customisable and even animated text.
Apache License 2.0
670 stars 137 forks source link

Custom font family #34

Closed aleksandra-majchrzak closed 5 years ago

aleksandra-majchrzak commented 6 years ago

I'm using PinEntryEditText, and it has been great so far. The only feature I miss is the ability to set custom font family to the PinEntryEditText content. I tried setting it via android:fontFamily property in XML, and inheriting PinEntryEditText to set the typeface in Java code, but neither of these ideas work.

Is there any option to change PinEntryEditText font family?

aleksandra-majchrzak commented 6 years ago

Ok, I've just found that paints rensponsible for text display have protected acces. Heaven bless you for that :D I inherited PinEntryEditText class, set typeface to the paints, and it works now.

alphamu commented 5 years ago

Also, it extends AppComaptTextView, so it should be possible to set the typefaces. I made this widget when Calligraphy was the standard for doing this. Making things protected was a backup sticking with SOLID principles. I'll take a look, honestly the paint object from the textview should be used so in theory you should be able to set the typefaces the same as in any TextView.

alphamu commented 5 years ago

Samples will be added in the master branch on how to make this work.