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

Commit 903a752b authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Use the accent color for the hairline stroke of smart actions

Bug: 181048615
Test: visual inspection; day/night; colorized
Change-Id: I4bc407bcb9345c6d26551b45fcccaf5f16c49b4c
parent c50c326c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -171,10 +171,10 @@

    <color name="zen_introduction">#ffffffff</color>

    <color name="smart_reply_button_text">@color/GM2_grey_700</color>
    <color name="smart_reply_button_text">@*android:color/notification_primary_text_color_light</color>
    <color name="smart_reply_button_text_dark_bg">@*android:color/notification_primary_text_color_dark</color>
    <color name="smart_reply_button_background">#ffffffff</color>
    <color name="smart_reply_button_stroke">#ffdadce0</color>
    <color name="smart_reply_button_stroke">@*android:color/accent_device_default</color>

    <!-- Biometric dialog colors -->
    <color name="biometric_dialog_dim_color">#80000000</color>              <!-- 50% black -->
+7 −3
Original line number Diff line number Diff line
@@ -877,10 +877,12 @@ public class NotificationContentView extends FrameLayout {

    public void setBackgroundTintColor(int color) {
        if (mExpandedSmartReplyView != null) {
            mExpandedSmartReplyView.setBackgroundTintColor(color);
            boolean colorized = mNotificationEntry.getSbn().getNotification().isColorized();
            mExpandedSmartReplyView.setBackgroundTintColor(color, colorized);
        }
        if (mHeadsUpSmartReplyView != null) {
            mHeadsUpSmartReplyView.setBackgroundTintColor(color);
            boolean colorized = mNotificationEntry.getSbn().getNotification().isColorized();
            mHeadsUpSmartReplyView.setBackgroundTintColor(color, colorized);
        }
    }

@@ -1510,7 +1512,9 @@ public class NotificationContentView extends FrameLayout {
            smartReplyView.addPreInflatedButtons(
                    inflatedSmartReplyViewHolder.getSmartSuggestionButtons());
            // Ensure the colors of the smart suggestion buttons are up-to-date.
            smartReplyView.setBackgroundTintColor(entry.getRow().getCurrentBackgroundTint());
            int backgroundColor = entry.getRow().getCurrentBackgroundTint();
            boolean colorized = mNotificationEntry.getSbn().getNotification().isColorized();
            smartReplyView.setBackgroundTintColor(backgroundColor, colorized);
            smartReplyContainer.setVisibility(View.VISIBLE);
        }
        return smartReplyView;
+11 −5
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public class SmartReplyView extends ViewGroup {
    @ColorInt private int mCurrentStrokeColor;
    @ColorInt private int mCurrentTextColor;
    @ColorInt private int mCurrentRippleColor;
    private boolean mCurrentColorized;
    private int mMaxSqueezeRemeasureAttempts;
    private int mMaxNumActions;
    private int mMinNumSystemGeneratedReplies;
@@ -143,7 +144,7 @@ public class SmartReplyView extends ViewGroup {

        mBreakIterator = BreakIterator.getLineInstance();

        setBackgroundTintColor(mDefaultBackgroundColor);
        setBackgroundTintColor(mDefaultBackgroundColor, false /* colorized */);
        reallocateCandidateButtonQueueForSqueezing();
    }

@@ -182,7 +183,7 @@ public class SmartReplyView extends ViewGroup {
    public void resetSmartSuggestions(View newSmartReplyContainer) {
        mSmartReplyContainer = newSmartReplyContainer;
        removeAllViews();
        setBackgroundTintColor(mDefaultBackgroundColor);
        setBackgroundTintColor(mDefaultBackgroundColor, false /* colorized */);
    }

    /** Add buttons to the {@link SmartReplyView} */
@@ -676,19 +677,24 @@ public class SmartReplyView extends ViewGroup {
        return lp.show && super.drawChild(canvas, child, drawingTime);
    }

    public void setBackgroundTintColor(int backgroundColor) {
        if (backgroundColor == mCurrentBackgroundColor) {
    /**
     * Set the current background color of the notification so that the smart reply buttons can
     * match it, and calculate other colors (e.g. text, ripple, stroke)
     */
    public void setBackgroundTintColor(int backgroundColor, boolean colorized) {
        if (backgroundColor == mCurrentBackgroundColor && colorized == mCurrentColorized) {
            // Same color ignoring.
           return;
        }
        mCurrentBackgroundColor = backgroundColor;
        mCurrentColorized = colorized;

        final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);

        mCurrentTextColor = ContrastColorUtil.ensureTextContrast(
                dark ? mDefaultTextColorDarkBg : mDefaultTextColor,
                backgroundColor | 0xff000000, dark);
        mCurrentStrokeColor = ContrastColorUtil.ensureContrast(
        mCurrentStrokeColor = colorized ? mCurrentTextColor : ContrastColorUtil.ensureContrast(
                mDefaultStrokeColor, backgroundColor | 0xff000000, dark, mMinStrokeContrast);
        mCurrentRippleColor = dark ? mRippleColorDarkBg : mRippleColor;