@@ -0,0 +1,2858 @@
+package xyz.louiscad.reusables.widget;%0A%0Aimport android.annotation.TargetApi;%0Aimport android.content.Context;%0Aimport android.content.res.TypedArray;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.os.Build;%0Aimport android.support.annotation.CallSuper;%0Aimport android.support.annotation.NonNull;%0Aimport android.util.AttributeSet;%0Aimport android.widget.RelativeLayout;%0A%0A/**%0A * RelativeLayout with ripple effect / select foreground when touched%0A */%0A@SuppressWarnings(%22unused%22)%0Apublic abstract class SelectableRelativeLayout extends RelativeLayout %7B%0A%0A    private Drawable mForegroundSelector;%0A%0A    public SelectableRelativeLayout(Context context) %7B%0A        super(context);%0A        init(context);%0A    %7D%0A%0A    public SelectableRelativeLayout(Context context, AttributeSet attrs) %7B%0A        super(context, attrs);%0A        init(context);%0A    %7D%0A%0A    public SelectableRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) %7B%0A        super(context, attrs, defStyleAttr);%0A        init(context);%0A    %7D%0A%0A    @TargetApi(Build.VERSION_CODES.LOLLIPOP)%0A    public SelectableRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) %7B%0A        super(context, attrs, defStyleAttr, defStyleRes);%0A        init(context);%0A    %7D%0A%0A    @CallSuper%0A    @SuppressWarnings(%22WeakerAccess%22)%0A    protected void init(Context context) %7B%0A        TypedArray ta = context.obtainStyledAttributes(new int%5B%5D%7Bandroid.R.attr.selectableItemBackground%7D);%0A        mForegroundSelector = ta.getDrawable(0);%0A        assert mForegroundSelector != null;%0A        mForegroundSelector.setCallback(this);%0A        ta.recycle();%0A        setWillNotDraw(false);%0A    %7D%0A%0A    @Override%0A    protected void drawableStateChanged() %7B%0A        super.drawableStateChanged();%0A        mForegroundSelector.setState(getDrawableState());%0A    %7D%0A%0A    @Override%0A    protected void onSizeChanged(int w, int h, int oldw, int oldh) %7B%0A        super.onSizeChanged(w, h, oldw, oldh);%0A        mForegroundSelector.setBounds(0, 0, w, h);%0A    %7D%0A%0A    @Override%0A    public void draw(Canvas canvas) %7B%0A        super.draw(canvas);%0A        mForegroundSelector.draw(canvas);%0A    %7D%0A%0A    @Override%0A    protected void onDraw(Canvas canvas) %7B%0A        super.onDraw(canvas);%0A        mForegroundSelector.draw(canvas);%0A    %7D%0A%0A    @Override%0A    public void jumpDrawablesToCurrentState() %7B%0A        super.jumpDrawablesToCurrentState();%0A        mForegroundSelector.jumpToCurrentState();%0A    %7D%0A%0A    @Override%0A    protected boolean verifyDrawable(@NonNull Drawable who) %7B%0A        return super.verifyDrawable(who) %7C%7C (who == mForegroundSelector);%0A    %7D%0A%0A    @Override%0A    @TargetApi(Build.VERSION_CODES.LOLLIPOP)%0A    public void dispatchDrawableHotspotChanged(float x, float y) %7B%0A        super.dispatchDrawableHotspotChanged(x, y);%0A        mForegroundSelector.setHotspot(x, y);%0A    %7D%0A%7D%0A

Add SelectableRelativeLayout