diff --git a/core/java/com/android/internal/widget/NotificationExpandButton.java b/core/java/com/android/internal/widget/NotificationExpandButton.java index 07ee9b5d2ff16..d4dd1e7056533 100644 --- a/core/java/com/android/internal/widget/NotificationExpandButton.java +++ b/core/java/com/android/internal/widget/NotificationExpandButton.java @@ -21,6 +21,8 @@ import android.annotation.Nullable; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.RemotableViewMethod; import android.view.View; @@ -42,7 +44,7 @@ import java.util.Locale; @RemoteViews.RemoteView public class NotificationExpandButton extends FrameLayout { - private View mPillView; + private Drawable mPillDrawable; private TextView mNumberView; private ImageView mIconView; private boolean mExpanded; @@ -73,7 +75,10 @@ public class NotificationExpandButton extends FrameLayout { @Override protected void onFinishInflate() { super.onFinishInflate(); - mPillView = findViewById(R.id.expand_button_pill); + + final View pillView = findViewById(R.id.expand_button_pill); + final LayerDrawable layeredPill = (LayerDrawable) pillView.getBackground(); + mPillDrawable = layeredPill.findDrawableByLayerId(R.id.expand_button_pill_colorized_layer); mNumberView = findViewById(R.id.expand_button_number); mIconView = findViewById(R.id.expand_button_icon); } @@ -156,7 +161,7 @@ public class NotificationExpandButton extends FrameLayout { private void updateColors() { if (shouldShowNumber()) { if (mHighlightPillColor != 0) { - mPillView.setBackgroundTintList(ColorStateList.valueOf(mHighlightPillColor)); + mPillDrawable.setTintList(ColorStateList.valueOf(mHighlightPillColor)); } mIconView.setColorFilter(mHighlightTextColor); if (mHighlightTextColor != 0) { @@ -164,7 +169,7 @@ public class NotificationExpandButton extends FrameLayout { } } else { if (mDefaultPillColor != 0) { - mPillView.setBackgroundTintList(ColorStateList.valueOf(mDefaultPillColor)); + mPillDrawable.setTintList(ColorStateList.valueOf(mDefaultPillColor)); } mIconView.setColorFilter(mDefaultTextColor); if (mDefaultTextColor != 0) { diff --git a/core/res/res/color-night/notification_expand_button_state_tint.xml b/core/res/res/color-night/notification_expand_button_state_tint.xml new file mode 100644 index 0000000000000..a794d53c7e713 --- /dev/null +++ b/core/res/res/color-night/notification_expand_button_state_tint.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/core/res/res/color/notification_expand_button_state_tint.xml b/core/res/res/color/notification_expand_button_state_tint.xml new file mode 100644 index 0000000000000..67b2c2568bb14 --- /dev/null +++ b/core/res/res/color/notification_expand_button_state_tint.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/core/res/res/drawable/expand_button_pill_bg.xml b/core/res/res/drawable/expand_button_pill_bg.xml index f95044a7fe76e..a14d33c9527b0 100644 --- a/core/res/res/drawable/expand_button_pill_bg.xml +++ b/core/res/res/drawable/expand_button_pill_bg.xml @@ -13,7 +13,17 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - - - \ No newline at end of file + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/res/res/layout/notification_expand_button.xml b/core/res/res/layout/notification_expand_button.xml index 8eae064cba1f8..63fe47110c8bf 100644 --- a/core/res/res/layout/notification_expand_button.xml +++ b/core/res/res/layout/notification_expand_button.xml @@ -34,6 +34,7 @@ android:background="@drawable/expand_button_pill_bg" android:gravity="center_vertical" android:layout_gravity="center_vertical" + android:duplicateParentState="true" > +