diff --git a/library/src/main/java/com/vlonjatg/progressactivity/ProgressFrameLayout.java b/library/src/main/java/com/vlonjatg/progressactivity/ProgressFrameLayout.java index d97414d..9994606 100644 --- a/library/src/main/java/com/vlonjatg/progressactivity/ProgressFrameLayout.java +++ b/library/src/main/java/com/vlonjatg/progressactivity/ProgressFrameLayout.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; +import android.graphics.LightingColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; @@ -74,6 +75,7 @@ public class ProgressFrameLayout extends FrameLayout { int errorStateTitleTextColor; int errorStateContentTextColor; int errorStateButtonTextColor; + int errorStateButtonBackgroundColor; int errorStateBackgroundColor; private String state = CONTENT; @@ -154,6 +156,9 @@ private void init(AttributeSet attrs) { errorStateButtonTextColor = typedArray.getColor(R.styleable.ProgressActivity_errorButtonTextColor, Color.BLACK); + errorStateButtonBackgroundColor = + typedArray.getColor(R.styleable.ProgressActivity_errorButtonBackgroundColor, Color.WHITE); + errorStateBackgroundColor = typedArray.getColor(R.styleable.ProgressActivity_errorBackgroundColor, Color.TRANSPARENT); @@ -498,6 +503,7 @@ private void setErrorView() { errorStateTitleTextView.setTextColor(errorStateTitleTextColor); errorStateContentTextView.setTextColor(errorStateContentTextColor); errorStateButton.setTextColor(errorStateButtonTextColor); + errorStateButton.getBackground().setColorFilter(new LightingColorFilter(1, errorStateButtonBackgroundColor)); //Set background color if not TRANSPARENT if (errorStateBackgroundColor != Color.TRANSPARENT) { diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index 7ceb9bd..7d5fef5 100644 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -22,6 +22,7 @@ + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_details.xml b/sample/src/main/res/layout/activity_details.xml index 84368df..dae1174 100644 --- a/sample/src/main/res/layout/activity_details.xml +++ b/sample/src/main/res/layout/activity_details.xml @@ -11,6 +11,7 @@ progressActivity:errorButtonTextColor="#FFFFFF" progressActivity:errorContentTextColor="#FFFFFF" progressActivity:errorTitleTextColor="#FFFFFF" + progressActivity:errorButtonBackgroundColor="#9C27B0" progressActivity:loadingBackgroundColor="#FFFFFF" progressActivity:loadingStateProgressBarColor="#9C27B0">