package apps.xenione.com.swipelayout.example.swipe;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;

import apps.xenione.com.swipelayout.R;
import apps.xenione.com.swipelayout.lib.AbsCoordinatorLayout;
import apps.xenione.com.swipelayout.lib.SwipeLayout;

/**
 * Created on 06/04/16.
 */
public class TwoStepRightCoordinatorLayout extends AbsCoordinatorLayout implements SwipeLayout.OnTranslateChangeListener {

    public interface OnDismissListener {
        void onDismissed();
    }

    private View mDelete;
    private View mAction;
    private SwipeLayout mForegroundView;
    private OnDismissListener mOnDismissListener;

    public Runnable initializeViews = new Runnable() {
        @Override
        public void run() {
            mForegroundView.translateTo(0);
        }
    };

    public TwoStepRightCoordinatorLayout(Context context) {
        super(context);
    }

    public TwoStepRightCoordinatorLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public TwoStepRightCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public TwoStepRightCoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public void doInitialViewsLocation() {
        mForegroundView.anchor(0, mDelete.getRight(), mAction.getRight());
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mForegroundView = (SwipeLayout) findViewById(R.id.foregroundView);
        mDelete = findViewById(R.id.delete);
        mAction = findViewById(R.id.action);
    }

    public void init() {
        if (!isInEditMode()) {
            ViewCompat.postOnAnimation(this, initializeViews);
        }
    }

    @Override
    public void onTranslateChange(float global, int index, float relative) {
    }
}

@@ -134,16 +134,107 @@
 oid.
-os.Build
+graphics.PorterDuff;%0Aimport android.os.Build;%0Aimport android.support.v4.content.res.ResourcesCompat
 ;%0Aim
@@ -333,16 +333,49 @@
 ew.View;
+%0Aimport android.widget.ImageView;
 %0A%0Aimport
@@ -679,16 +679,44 @@
 ener %7B%0A%0A
+    private ImageView mBg;%0A%0A
     publ
@@ -1974,16 +1974,67 @@
 dView);%0A
+        mBg=(ImageView)findViewById(R.id.bg_disc);%0A
         
@@ -2264,32 +2264,32 @@
 %0A%0A    @Override%0A
-
     public void 
@@ -2345,20 +2345,390 @@
 relative) %7B%0A
+        if (index == 0) %7B%0A            mBg.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorAccent, getContext().getTheme()), PorterDuff.Mode.MULTIPLY);%0A        %7D else if (index == 1) %7B%0A            mBg.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorSecondaryAccent, getContext().getTheme()), PorterDuff.Mode.MULTIPLY);%0A        %7D%0A
     %7D%0A%7D%0A

Add color effect on Two step swipe case