Skip to content

Instantly share code, notes, and snippets.

@ZieIony
Created January 7, 2020 20:40
Show Gist options
  • Select an option

  • Save ZieIony/af890540cba643379307b15f66c7770b to your computer and use it in GitHub Desktop.

Select an option

Save ZieIony/af890540cba643379307b15f66c7770b to your computer and use it in GitHub Desktop.
public class ImageView extends android.widget.ImageView {
public ImageView(Context context) {
super(context, null, R.attr.carbon_imageViewStyle);
initImageView(null, R.attr.carbon_imageViewStyle);
}
public ImageView(Context context, AttributeSet attrs) {
super(context, attrs, R.attr.carbon_imageViewStyle);
initImageView(attrs, R.attr.carbon_imageViewStyle);
}
private void initImageView(AttributeSet attrs, int defStyleAttr) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ImageView, defStyleAttr, R.style.carbon_ImageView);
setRippleColor(a.getColorStateList(R.styleable.ImageView_carbon_rippleColor));
setRippleHotspot(a.Boolean(R.styleable.ImageView_carbon_rippleHotspot, false));
setMenu(a.getResourceId(R.styleable.ImageView_android_menu, 0);
a.recycle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment