Skip to content

Instantly share code, notes, and snippets.

View fhur's full-sized avatar

Fernando Hurtado fhur

View GitHub Profile
@fhur
fhur / PhoneEditText.java
Last active August 29, 2015 14:06
EditText that auto formats it's content in a readable way. Numbers are formatted like this: 1234567890 => 123-456-7890
/**
* {@link TextView} that displays only numbers, formated as a readable phone number.
* Example: 123-234-3456 instead of 1232343456
*
* @author fernandohur
*/
public class PhoneEditText extends EditText implements TextWatcher {
private boolean ignoreTextChange;
@fhur
fhur / FontFitTextView.java
Last active August 29, 2015 14:06
TextView that automatically adjusts it's size to fit the container.
/**
* @author fernandohur but credit goes to <a href="http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview">speedplane</a>
*/
public class FontFitTextView extends TextView {
private Paint mTestPaint;
/**
* The minimum font size in pixels
*/
private float minFontSize;