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

Typeface #17

Closed ehsan1010ed closed 5 years ago

ehsan1010ed commented 6 years ago

we couldn't set a typeface for number pinEntryEditText?

mohammad-zr commented 6 years ago

Is there a way to change TypeFace of this control?

gajicm93 commented 6 years ago
public class CustomPinEditText extends PinEntryEditText {

    public CustomPinEditText(Context context) {
        super(context);
        mCharPaint.setTypeface(TastlyApplication.nexaBold);
        mSingleCharPaint.setTypeface(TastlyApplication.nexaBold);
        mLastCharPaint.setTypeface(TastlyApplication.nexaBold);
    }

    public CustomPinEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        mCharPaint.setTypeface(TastlyApplication.nexaBold);
        mSingleCharPaint.setTypeface(TastlyApplication.nexaBold);
        mLastCharPaint.setTypeface(TastlyApplication.nexaBold);
    }

    public CustomPinEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mCharPaint.setTypeface(TastlyApplication.nexaBold);
        mSingleCharPaint.setTypeface(TastlyApplication.nexaBold);
        mLastCharPaint.setTypeface(TastlyApplication.nexaBold);
    }

    public CustomPinEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mCharPaint.setTypeface(TastlyApplication.nexaBold);
        mSingleCharPaint.setTypeface(TastlyApplication.nexaBold);
        mLastCharPaint.setTypeface(TastlyApplication.nexaBold);
    }
}

Here if somebody needs an immediate fix. But dev should fix this properly definitely.

alphamu commented 5 years ago

This feature was added, both fontFamily and setTypeface are now supported. There is an example in the sample app on how to do this.