summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-08-30 16:31:44 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-08-30 16:31:44 +0000
commitbda5932d34493ad4070f1ab6cc7b83764cec0c50 (patch)
treefb164b3425f6c0205303e0883335d9a682c04c2e
parent0cd62cab6cc65c68e9e265c2c5f596976dc13cff (diff)
parent75e8f17dc9127a9935046640e9cf4804d097f547 (diff)
Merge "SnackBar ActionButton do not apply correc TextColor"
-rw-r--r--res/values/attrs.xml4
-rw-r--r--res/values/styles.xml4
-rw-r--r--src/com/android/documentsui/ui/Snackbars.java7
3 files changed, 15 insertions, 0 deletions
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 4dd75cc6f..84a37b820 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -27,4 +27,8 @@
<attr name="textHandleColor" format="reference" />
<attr name="textCursorColor" format="reference" />
</declare-styleable>
+
+ <declare-styleable name="SnackbarView">
+ <attr name="android:textColor" format="reference" />
+ </declare-styleable>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ffdad0864..0486fe2ff 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -58,4 +58,8 @@
<item name="android:textSize">13sp</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
+
+ <style name="SnackbarButtonStyle" parent="Widget.MaterialComponents.Button.TextButton">
+ <item name="android:textColor">@color/g_light_grey</item>
+ </style>
</resources>
diff --git a/src/com/android/documentsui/ui/Snackbars.java b/src/com/android/documentsui/ui/Snackbars.java
index c587e0053..50602c9e2 100644
--- a/src/com/android/documentsui/ui/Snackbars.java
+++ b/src/com/android/documentsui/ui/Snackbars.java
@@ -18,6 +18,8 @@ package com.android.documentsui.ui;
import androidx.annotation.StringRes;
import android.app.Activity;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.support.design.widget.Snackbar;
import android.view.Gravity;
import android.view.View;
@@ -101,8 +103,13 @@ public final class Snackbars {
public static final Snackbar makeSnackbarWithAction(Activity activity, int docCount,
CharSequence message, int duration, CharSequence actionText,
Consumer<View> action, final Snackbar.Callback callback) {
+ TypedArray ta = activity.obtainStyledAttributes(R.style.SnackbarButtonStyle,
+ R.styleable.SnackbarView);
+ int textColor = ta.getColor(R.styleable.SnackbarView_android_textColor, Color.WHITE);
+ ta.recycle();
return makeSnackbar(activity, message, duration)
.setAction(actionText, action::accept)
+ .setActionTextColor(textColor)
.addCallback(callback);
}