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

Commit d2ab8f8a authored by Stefan Maftei's avatar Stefan Maftei
Browse files

[Expressive] Preference screen using MenuPreferences crashes if Expressive theme isn't enabeld.

The `MenuPreference` attempts to always use the `settingslib_expressive_preference`
even if the expressive is not enabled. Note it's still possible to use
`settingslib_expressive_preference` even if expressive isn't enabled.

Bug: 443709750
Test: visual verify
Flag: EXEMPT bugfix
Change-Id: If890302bcba6a08744a078d462032b4c6d864444
parent 39bf2614
Loading
Loading
Loading
Loading
+24 −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.
-->

<resources>
    <style name="SettingslibPopupMenuStyle" parent="Widget.AppCompat.PopupMenu">
        <item name="android:popupBackground">@drawable/settingslib_expressive_spinner_dropdown_background</item>
        <item name="android:textAppearance">@style/TextAppearance.SettingsLib.LabelLarge</item>
        <item name="android:dropDownListViewStyle">@style/SettingslibMenuItemStyle</item>
    </style>
</resources>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

<resources>
    <style name="SettingslibPopupMenuStyle" parent="Widget.AppCompat.PopupMenu">
        <item name="android:popupBackground">@drawable/settingslib_expressive_spinner_dropdown_background</item>
        <item name="android:popupBackground">@drawable/settingslib_spinner_dropdown_background</item>
        <item name="android:textAppearance">@style/TextAppearance.SettingsLib.LabelLarge</item>
        <item name="android:dropDownListViewStyle">@style/SettingslibMenuItemStyle</item>
    </style>
+5 −1
Original line number Diff line number Diff line
@@ -42,7 +42,11 @@ class MenuPreference @JvmOverloads constructor(

    init {
        layoutResource =
            if (SettingsThemeHelper.isExpressiveTheme(context)) {
                com.android.settingslib.widget.theme.R.layout.settingslib_expressive_preference
            } else {
                com.android.settingslib.widget.theme.R.layout.settingslib_preference
            }
        widgetLayoutResource = R.layout.settingslib_expressive_button_menu
        if (attrs != null) {
            context.withStyledAttributes(attrs, R.styleable.MenuPreference) {
+2 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2022 The Android Open Source Project
  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.
@@ -28,7 +28,7 @@
            <item>
                <shape>
                    <corners android:radius="10dp"/>
                    <solid android:color="@android:color/system_accent2_100"/>
                    <solid android:color="@color/settingslib_materialColorSecondaryFixed"/>
                </shape>
            </item>
        </layer-list>