private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        if (attrs == null)
            return;

        final Context context = getContext();
        final Resources resources = getResources();

        // Load attributes
        final TypedArray a = context.obtainStyledAttributes(
                attrs, R.styleable.Button, defStyleAttr, defStyleRes);

        String fontFile = a.getString(R.styleable.Button_gFont);
        int touchEffect = a.getInt(R.styleable.Button_gTouchEffect, EffectFactory.TOUCH_EFFECT_NONE);
        int touchColor = a.getColor(R.styleable.Button_gTouchColor, Ui.TOUCH_PRESS_COLOR);

        // Load clip touch corner radius
        int touchRadius = a.getDimensionPixelOffset(R.styleable.Button_gTouchCornerRadius, resources.getDimensionPixelOffset(R.dimen.g_button_touch_corners_radius));
        int touchRadiusTL = a.getDimensionPixelOffset(R.styleable.Button_gTouchCornerRadiusTL, touchRadius);
        int touchRadiusTR = a.getDimensionPixelOffset(R.styleable.Button_gTouchCornerRadiusTR, touchRadius);
        int touchRadiusBL = a.getDimensionPixelOffset(R.styleable.Button_gTouchCornerRadiusBL, touchRadius);
        int touchRadiusBR = a.getDimensionPixelOffset(R.styleable.Button_gTouchCornerRadiusBR, touchRadius);
        float[] radius = new float[]{touchRadiusTL, touchRadiusTL, touchRadiusTR, touchRadiusTR,
                touchRadiusBR, touchRadiusBR, touchRadiusBL, touchRadiusBL};
        ClipFilletFactory touchFactory = new ClipFilletFactory(radius);
        float touchDurationRate = a.getFloat(R.styleable.Button_gTouchDurationRate, 1.0f);

        // Load intercept event type, the default is intercept click event
        int interceptEvent = a.getInt(R.styleable.Button_gInterceptEvent, 0x0001);

        a.recycle();

        // Initial  TouchEffectDrawable
        if (touchEffect != 0) {
            TouchEffectDrawable touchEffectDrawable = new TouchEffectDrawable();
            touchEffectDrawable.setColor(touchColor);
            touchEffectDrawable.setEffect(EffectFactory.creator(touchEffect));
            touchEffectDrawable.setEnterDuration(touchDurationRate);
            touchEffectDrawable.setExitDuration(touchDurationRate);
            touchEffectDrawable.setInterceptEvent(interceptEvent);
            // Check for IDE preview render to set Touch factory
            if (!this.isInEditMode()) {
                touchEffectDrawable.setClipFactory(touchFactory);
            }
            setTouchDrawable(touchEffectDrawable);
        }

        // Check for IDE preview render to set Font
        if (!this.isInEditMode()) {
            if (fontFile != null && fontFile.length() > 0) {
                Typeface typeface = Ui.getFont(getContext(), fontFile);
                if (typeface != null) setTypeface(typeface);
            }
        }
    }
This is touch effect button
Include 'Auto' 'Ease' 'Press' 'Ripple' effect to touch
And supper custom font
<p>
<p><strong>XML attributes</strong></p>
<p>
See {@link net.qiujuer.genius.ui.R.styleable#Button_gFont Attributes},
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchEffect Attributes},
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchColor Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchCornerRadius Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchCornerRadiusTL Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchCornerRadiusTR Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchCornerRadiusBL Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchCornerRadiusBR Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gTouchDurationRate Attributes}
{@link net.qiujuer.genius.ui.R.styleable#Button_gInterceptEvent Attributes}
caprice/ui/src/main/java/net/qiujuer/genius/ui/widget/Button.java