package cl.monsoon.s1next.widget;

import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;

public final class StateListDrawableWithTint extends StateListDrawable {

    private final ColorStateList mColorStateList;
    private final PorterDuff.Mode mMode;

    public StateListDrawableWithTint(@DrawableRes Drawable drawable, @NonNull ColorStateList colorStateList, @NonNull PorterDuff.Mode mode) {
        this.mColorStateList = colorStateList;
        this.mMode = mode;

        addState(new int[]{}, drawable);
    }

    @Override
    protected boolean onStateChange(int[] stateSet) {
        int color = mColorStateList.getColorForState(stateSet, Color.TRANSPARENT);
        setColorFilter(color, mMode);

        return super.onStateChange(stateSet);
    }
}

@@ -819,24 +819,188 @@
 stateSet) %7B%0A
+        // mColorStateList is null when constructor invokes super() implicitly%0A        //noinspection ConstantConditions%0A        if (mColorStateList != null) %7B%0A    
         int 
@@ -1078,16 +1078,20 @@
         
+    
 setColor
@@ -1111,16 +1111,26 @@
  mMode);
+%0A        %7D
 %0A%0A      

Fix NullPointerException due to aa05a2716a977f2ce442af61f538496e389ca1b6