Loading packages/SettingsLib/StatusBannerPreference/res/drawable/settingslib_expressive_icon_status_level_off.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="34dp" android:height="42dp" android:viewportWidth="34" android:viewportHeight="42"> <path android:pathData="M0.856,17.569C0.887,19.083 1.004,20.593 1.206,22.094C2.166,28.584 5.804,35.937 15.774,41.089C16.171,41.293 16.61,41.4 17.056,41.4C17.503,41.4 17.942,41.293 18.339,41.089C28.309,35.936 31.947,28.583 32.907,22.093C33.109,20.593 33.226,19.083 33.256,17.569V8.605C33.257,7.919 33.046,7.25 32.652,6.688C32.259,6.127 31.703,5.7 31.059,5.467L18.191,0.8C17.458,0.534 16.655,0.534 15.922,0.8L3.054,5.467C2.41,5.7 1.854,6.127 1.461,6.688C1.067,7.25 0.856,7.919 0.856,8.605V17.569Z" android:fillColor="#D1C2CB"/> <path android:pathData="M15.067,24.333V10.733H18.933V24.333H15.067ZM15.067,31.267V27.433H18.933V31.267H15.067Z" android:fillColor="@color/settingslib_materialColorSurfaceContainerLowest"/> </vector> No newline at end of file packages/SettingsLib/StatusBannerPreference/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ <enum name="low" value="1"/> <enum name="medium" value="2"/> <enum name="high" value="3"/> <enum name="off" value="4"/> </attr> <attr name="buttonLevel" format="enum"> <enum name="generic" value="0"/> Loading packages/SettingsLib/StatusBannerPreference/res/values/colors.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ <color name="settingslib_expressive_color_status_level_medium">#FCBD00</color> <!-- static palette red50 --> <color name="settingslib_expressive_color_status_level_high">#DB372D</color> <color name="settingslib_expressive_color_status_level_off">#D1C2CB</color> </resources> No newline at end of file packages/SettingsLib/StatusBannerPreference/src/com/android/settingslib/widget/StatusBannerPreference.kt +18 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ class StatusBannerPreference @JvmOverloads constructor( GENERIC, LOW, MEDIUM, HIGH HIGH, OFF } var iconLevel: BannerStatus = BannerStatus.GENERIC set(value) { Loading Loading @@ -87,6 +88,7 @@ class StatusBannerPreference @JvmOverloads constructor( 1 -> BannerStatus.LOW 2 -> BannerStatus.MEDIUM 3 -> BannerStatus.HIGH 4 -> BannerStatus.OFF else -> BannerStatus.GENERIC } Loading @@ -104,7 +106,10 @@ class StatusBannerPreference @JvmOverloads constructor( } (holder.findViewById(R.id.status_banner_button) as? MaterialButton)?.apply { setBackgroundColor(getBackgroundColor(buttonLevel)) setBackgroundColor( if (buttonLevel == BannerStatus.OFF) getBackgroundColor(BannerStatus.GENERIC) else getBackgroundColor(buttonLevel) ) text = buttonText setOnClickListener(listener) visibility = if (listener != null) View.VISIBLE else View.GONE Loading Loading @@ -143,6 +148,11 @@ class StatusBannerPreference @JvmOverloads constructor( R.color.settingslib_expressive_color_status_level_high ) BannerStatus.OFF -> ContextCompat.getColor( context, R.color.settingslib_expressive_color_status_level_off ) else -> ContextCompat.getColor( context, com.android.settingslib.widget.theme.R.color.settingslib_materialColorPrimary Loading @@ -167,6 +177,11 @@ class StatusBannerPreference @JvmOverloads constructor( R.drawable.settingslib_expressive_icon_status_level_high ) BannerStatus.OFF -> ContextCompat.getDrawable( context, R.drawable.settingslib_expressive_icon_status_level_off ) else -> null } } Loading @@ -188,6 +203,7 @@ class StatusBannerPreference @JvmOverloads constructor( R.drawable.settingslib_expressive_background_level_high ) // GENERIC and OFF are using the same background drawable. else -> ContextCompat.getDrawable( context, R.drawable.settingslib_expressive_background_generic Loading Loading
packages/SettingsLib/StatusBannerPreference/res/drawable/settingslib_expressive_icon_status_level_off.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="34dp" android:height="42dp" android:viewportWidth="34" android:viewportHeight="42"> <path android:pathData="M0.856,17.569C0.887,19.083 1.004,20.593 1.206,22.094C2.166,28.584 5.804,35.937 15.774,41.089C16.171,41.293 16.61,41.4 17.056,41.4C17.503,41.4 17.942,41.293 18.339,41.089C28.309,35.936 31.947,28.583 32.907,22.093C33.109,20.593 33.226,19.083 33.256,17.569V8.605C33.257,7.919 33.046,7.25 32.652,6.688C32.259,6.127 31.703,5.7 31.059,5.467L18.191,0.8C17.458,0.534 16.655,0.534 15.922,0.8L3.054,5.467C2.41,5.7 1.854,6.127 1.461,6.688C1.067,7.25 0.856,7.919 0.856,8.605V17.569Z" android:fillColor="#D1C2CB"/> <path android:pathData="M15.067,24.333V10.733H18.933V24.333H15.067ZM15.067,31.267V27.433H18.933V31.267H15.067Z" android:fillColor="@color/settingslib_materialColorSurfaceContainerLowest"/> </vector> No newline at end of file
packages/SettingsLib/StatusBannerPreference/res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ <enum name="low" value="1"/> <enum name="medium" value="2"/> <enum name="high" value="3"/> <enum name="off" value="4"/> </attr> <attr name="buttonLevel" format="enum"> <enum name="generic" value="0"/> Loading
packages/SettingsLib/StatusBannerPreference/res/values/colors.xml +1 −0 Original line number Diff line number Diff line Loading @@ -22,4 +22,5 @@ <color name="settingslib_expressive_color_status_level_medium">#FCBD00</color> <!-- static palette red50 --> <color name="settingslib_expressive_color_status_level_high">#DB372D</color> <color name="settingslib_expressive_color_status_level_off">#D1C2CB</color> </resources> No newline at end of file
packages/SettingsLib/StatusBannerPreference/src/com/android/settingslib/widget/StatusBannerPreference.kt +18 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ class StatusBannerPreference @JvmOverloads constructor( GENERIC, LOW, MEDIUM, HIGH HIGH, OFF } var iconLevel: BannerStatus = BannerStatus.GENERIC set(value) { Loading Loading @@ -87,6 +88,7 @@ class StatusBannerPreference @JvmOverloads constructor( 1 -> BannerStatus.LOW 2 -> BannerStatus.MEDIUM 3 -> BannerStatus.HIGH 4 -> BannerStatus.OFF else -> BannerStatus.GENERIC } Loading @@ -104,7 +106,10 @@ class StatusBannerPreference @JvmOverloads constructor( } (holder.findViewById(R.id.status_banner_button) as? MaterialButton)?.apply { setBackgroundColor(getBackgroundColor(buttonLevel)) setBackgroundColor( if (buttonLevel == BannerStatus.OFF) getBackgroundColor(BannerStatus.GENERIC) else getBackgroundColor(buttonLevel) ) text = buttonText setOnClickListener(listener) visibility = if (listener != null) View.VISIBLE else View.GONE Loading Loading @@ -143,6 +148,11 @@ class StatusBannerPreference @JvmOverloads constructor( R.color.settingslib_expressive_color_status_level_high ) BannerStatus.OFF -> ContextCompat.getColor( context, R.color.settingslib_expressive_color_status_level_off ) else -> ContextCompat.getColor( context, com.android.settingslib.widget.theme.R.color.settingslib_materialColorPrimary Loading @@ -167,6 +177,11 @@ class StatusBannerPreference @JvmOverloads constructor( R.drawable.settingslib_expressive_icon_status_level_high ) BannerStatus.OFF -> ContextCompat.getDrawable( context, R.drawable.settingslib_expressive_icon_status_level_off ) else -> null } } Loading @@ -188,6 +203,7 @@ class StatusBannerPreference @JvmOverloads constructor( R.drawable.settingslib_expressive_background_level_high ) // GENERIC and OFF are using the same background drawable. else -> ContextCompat.getDrawable( context, R.drawable.settingslib_expressive_background_generic Loading