All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.easimart.util.ShadowDipsTextView Maven / Gradle / Ivy

package co.easimart.util;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.TextView;

import co.easimart.R;

public class ShadowDipsTextView extends TextView {
    public ShadowDipsTextView(Context context) {
        super(context);
        init(context, null, 0);
    }

    public ShadowDipsTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs, 0);
    }

    public ShadowDipsTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context, attrs, defStyle);
    }

    private void init(Context context, AttributeSet attrs, int defStyle) {
        final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ShadowDipsTextView, defStyle, 0);
        int shadowDx = a.getDimensionPixelSize(R.styleable.ShadowDipsTextView_shadowDx, 0);
        int shadowDy = a.getDimensionPixelSize(R.styleable.ShadowDipsTextView_shadowDy, 0);
        int shadowRadius = a.getDimensionPixelSize(R.styleable.ShadowDipsTextView_shadowRadius, 0);
        int shadowColor = a.getColor(R.styleable.ShadowDipsTextView_shadowColor, 0);
        if (shadowColor != 0) {
            setShadowLayer(shadowRadius, shadowDx, shadowDy, shadowColor);
        }
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy