diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ActionableEmptyView.kt b/WordPress/src/main/java/org/wordpress/android/ui/ActionableEmptyView.kt
index 879aca347f55..ed261f859ea7 100644
--- a/WordPress/src/main/java/org/wordpress/android/ui/ActionableEmptyView.kt
+++ b/WordPress/src/main/java/org/wordpress/android/ui/ActionableEmptyView.kt
@@ -64,14 +64,7 @@ class ActionableEmptyView : LinearLayout {
bottomImage = layout.findViewById(R.id.bottom_image)
progressBar = layout.findViewById(R.id.actionable_empty_view_progress_bar)
- attrs.let {
- val typedArray = context.obtainStyledAttributes(
- it,
- R.styleable.ActionableEmptyView,
- 0,
- 0
- )
-
+ context.obtainStyledAttributes(attrs, R.styleable.ActionableEmptyView, 0, 0).use { typedArray ->
val imageResource = typedArray.getResourceId(
R.styleable.ActionableEmptyView_aevImage,
0
@@ -83,6 +76,10 @@ class ActionableEmptyView : LinearLayout {
val titleAttribute = typedArray.getString(R.styleable.ActionableEmptyView_aevTitle)
val subtitleAttribute = typedArray.getString(R.styleable.ActionableEmptyView_aevSubtitle)
val buttonAttribute = typedArray.getString(R.styleable.ActionableEmptyView_aevButton)
+ val buttonStyleAttribute = typedArray.getInt(
+ R.styleable.ActionableEmptyView_aevButtonStyle,
+ BUTTON_STYLE_PRIMARY
+ )
if (imageResource != 0) {
image.setImageResource(imageResource)
@@ -107,7 +104,10 @@ class ActionableEmptyView : LinearLayout {
button.visibility = View.VISIBLE
}
- typedArray.recycle()
+ if (buttonStyleAttribute == BUTTON_STYLE_READER) {
+ button.backgroundTintList = context.getColorStateList(R.color.reader_button_primary_background_selector)
+ button.setTextColor(context.getColorStateList(R.color.reader_button_primary_text))
+ }
}
}
@@ -163,4 +163,9 @@ class ActionableEmptyView : LinearLayout {
announceForAccessibility("${title.text}.$subTitle")
}
+
+ companion object {
+ private const val BUTTON_STYLE_PRIMARY = 0
+ private const val BUTTON_STYLE_READER = 1
+ }
}
diff --git a/WordPress/src/main/res/layout/reader_discover_fragment_layout.xml b/WordPress/src/main/res/layout/reader_discover_fragment_layout.xml
index da67d90b734f..66f22aa0b70a 100644
--- a/WordPress/src/main/res/layout/reader_discover_fragment_layout.xml
+++ b/WordPress/src/main/res/layout/reader_discover_fragment_layout.xml
@@ -38,6 +38,7 @@
app:aevImage="@drawable/illustration_reader_empty"
app:aevSubtitle="@string/reader_discover_no_posts_subscribe_subtitle"
app:aevTitle="@string/reader_discover_no_posts_title"
+ app:aevButtonStyle="reader"
tools:visibility="visible" />
diff --git a/WordPress/src/main/res/layout/reader_fragment_list.xml b/WordPress/src/main/res/layout/reader_fragment_list.xml
index 570725bbf63e..ddbbd461c7f2 100644
--- a/WordPress/src/main/res/layout/reader_fragment_list.xml
+++ b/WordPress/src/main/res/layout/reader_fragment_list.xml
@@ -22,6 +22,7 @@
android:layout_height="match_parent"
android:visibility="gone"
app:aevTitle="@string/reader_no_recommended_blogs_title"
+ app:aevButtonStyle="reader"
tools:visibility="visible" />
diff --git a/WordPress/src/main/res/layout/reader_no_site_to_reblog.xml b/WordPress/src/main/res/layout/reader_no_site_to_reblog.xml
index f9c4e689744c..4089f2a8c409 100644
--- a/WordPress/src/main/res/layout/reader_no_site_to_reblog.xml
+++ b/WordPress/src/main/res/layout/reader_no_site_to_reblog.xml
@@ -14,6 +14,7 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/toolbar_height"
app:aevButton="@string/reader_no_blog_to_reblog_action"
+ app:aevButtonStyle="reader"
app:aevImage="@drawable/illustration_reader_empty"
app:aevImageHiddenInLandscape="true"
app:aevSubtitle="@string/reader_no_blog_to_reblog_detail"
diff --git a/WordPress/src/main/res/values/attrs.xml b/WordPress/src/main/res/values/attrs.xml
index 229f6d3e54a1..c6eec240f04c 100644
--- a/WordPress/src/main/res/values/attrs.xml
+++ b/WordPress/src/main/res/values/attrs.xml
@@ -197,6 +197,11 @@
+
+
+
+
+