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

Commit 01151757 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

Clarify getOnAccentTextColor method name

Bug: 277285099
Test: builds
Change-Id: I89bd9296b09cdf82fd4dc725502f7849b54afb83
parent b7c89a1b
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -5607,7 +5607,8 @@ public class Notification implements Parcelable
            // Use different highlighted colors for conversations' unread count
            if (p.mHighlightExpander) {
                pillColor = Colors.flattenAlpha(getColors(p).getTertiaryAccentColor(), bgColor);
                textColor = Colors.flattenAlpha(getColors(p).getOnAccentTextColor(), pillColor);
                textColor = Colors.flattenAlpha(
                        getColors(p).getOnTertiaryAccentTextColor(), pillColor);
            }
            contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor);
            contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor);
@@ -12833,7 +12834,7 @@ public class Notification implements Parcelable
        private int mPrimaryAccentColor = COLOR_INVALID;
        private int mSecondaryAccentColor = COLOR_INVALID;
        private int mTertiaryAccentColor = COLOR_INVALID;
        private int mOnAccentTextColor = COLOR_INVALID;
        private int mOnTertiaryAccentTextColor = COLOR_INVALID;
        private int mErrorColor = COLOR_INVALID;
        private int mContrastColor = COLOR_INVALID;
        private int mRippleAlpha = 0x33;
@@ -12908,7 +12909,7 @@ public class Notification implements Parcelable
                mPrimaryAccentColor = mPrimaryTextColor;
                mSecondaryAccentColor = mSecondaryTextColor;
                mTertiaryAccentColor = flattenAlpha(mPrimaryTextColor, mBackgroundColor);
                mOnAccentTextColor = mBackgroundColor;
                mOnTertiaryAccentTextColor = mBackgroundColor;
                mErrorColor = mPrimaryTextColor;
                mRippleAlpha = 0x33;
            } else {
@@ -12930,7 +12931,7 @@ public class Notification implements Parcelable
                    mPrimaryAccentColor = getColor(ta, 3, COLOR_INVALID);
                    mSecondaryAccentColor = getColor(ta, 4, COLOR_INVALID);
                    mTertiaryAccentColor = getColor(ta, 5, COLOR_INVALID);
                    mOnAccentTextColor = getColor(ta, 6, COLOR_INVALID);
                    mOnTertiaryAccentTextColor = getColor(ta, 6, COLOR_INVALID);
                    mErrorColor = getColor(ta, 7, COLOR_INVALID);
                    mRippleAlpha = Color.alpha(getColor(ta, 8, 0x33ffffff));
                }
@@ -12955,8 +12956,8 @@ public class Notification implements Parcelable
                if (mTertiaryAccentColor == COLOR_INVALID) {
                    mTertiaryAccentColor = mContrastColor;
                }
                if (mOnAccentTextColor == COLOR_INVALID) {
                    mOnAccentTextColor = ColorUtils.setAlphaComponent(
                if (mOnTertiaryAccentTextColor == COLOR_INVALID) {
                    mOnTertiaryAccentTextColor = ColorUtils.setAlphaComponent(
                            ContrastColorUtil.resolvePrimaryColor(
                                    ctx, mTertiaryAccentColor, nightMode), 0xFF);
                }
@@ -13029,8 +13030,8 @@ public class Notification implements Parcelable
        }
        /** @return the theme's text color to be used on the tertiary accent color. */
        public @ColorInt int getOnAccentTextColor() {
            return mOnAccentTextColor;
        public @ColorInt int getOnTertiaryAccentTextColor() {
            return mOnTertiaryAccentTextColor;
        }
        /**
+4 −3
Original line number Diff line number Diff line
@@ -857,7 +857,8 @@ public class NotificationTest {
            assertEquals(cDay.getPrimaryAccentColor(), cNight.getPrimaryAccentColor());
            assertEquals(cDay.getSecondaryAccentColor(), cNight.getSecondaryAccentColor());
            assertEquals(cDay.getTertiaryAccentColor(), cNight.getTertiaryAccentColor());
            assertEquals(cDay.getOnAccentTextColor(), cNight.getOnAccentTextColor());
            assertEquals(cDay.getOnTertiaryAccentTextColor(),
                    cNight.getOnTertiaryAccentTextColor());
            assertEquals(cDay.getProtectionColor(), cNight.getProtectionColor());
            assertEquals(cDay.getContrastColor(), cNight.getContrastColor());
            assertEquals(cDay.getRippleAlpha(), cNight.getRippleAlpha());
@@ -1830,7 +1831,7 @@ public class NotificationTest {
        assertThat(c.getPrimaryAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getSecondaryAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getTertiaryAccentColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getOnAccentTextColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getOnTertiaryAccentTextColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getErrorColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getContrastColor()).isNotEqualTo(Notification.COLOR_INVALID);
        assertThat(c.getRippleAlpha()).isAtLeast(0x00);
@@ -1848,7 +1849,7 @@ public class NotificationTest {
        assertContrastIsAtLeast(c.getTertiaryAccentColor(), c.getBackgroundColor(), 1);

        // The text that is used within the accent color DOES need to have contrast
        assertContrastIsAtLeast(c.getOnAccentTextColor(), c.getTertiaryAccentColor(), 4.5);
        assertContrastIsAtLeast(c.getOnTertiaryAccentTextColor(), c.getTertiaryAccentColor(), 4.5);
    }

    private void resolveColorsInNightMode(boolean nightMode, Notification.Colors c, int rawColor,