Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bda5932d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SnackBar ActionButton do not apply correc TextColor"

parents 0cd62cab 75e8f17d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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>
+4 −0
Original line number Diff line number Diff line
@@ -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>
+7 −0
Original line number Diff line number Diff line
@@ -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);
    }