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

Commit 11ec9ba0 authored by Marie Matheson's avatar Marie Matheson
Browse files

Updates BannerMessagePreference to new style

Updates the style of the BannerMessagePreference in v31 and adds support
for the following new functionality (all optional):
- Use one of three attention level themes: high, medium, and low
(default: high)
- Add an icon (default: alert icon)
- Subtitle (default: hidden)
- Dismiss button (default: hidden)

Icon, subtitle, and theme can also be set via xml attrs.

Adds support for creating a BannerMessage without a title.

Test: make -j80 RunSettingsLibRoboTests
Test: Manually tested all configurations
Bug: 181764215

Change-Id: I73bfc5225d83057e423b6a9d77a6277a656d3b90
parent 6fb4729e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -15,8 +15,9 @@ android_library {

    static_libs: [
        "androidx.preference_preference",
        "SettingsLibSettingsTheme",
    ],

    sdk_version: "system_current",
    min_sdk_version: "21",
    min_sdk_version: "28",
}
+1 −1
Original line number Diff line number Diff line
@@ -18,6 +18,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.settingslib.widget">

    <uses-sdk android:minSdkVersion="21"/>
    <uses-sdk android:minSdkVersion="28"/>

</manifest>
+0 −37
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">

    <issue
        id="NewApi"
        message="`@android:style/Widget.DeviceDefault.Button.Borderless.Colored` requires API level 28 (current min is 21)"
        errorLine1="            style=&quot;@android:style/Widget.DeviceDefault.Button.Borderless.Colored&quot;/>"
        errorLine2="            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SettingsLib/BannerMessagePreference/res/layout/banner_message.xml"
            line="65"
            column="13"/>
    </issue>

    <issue
        id="NewApi"
        message="`@android:style/Widget.DeviceDefault.Button.Borderless.Colored` requires API level 28 (current min is 21)"
        errorLine1="            style=&quot;@android:style/Widget.DeviceDefault.Button.Borderless.Colored&quot;/>"
        errorLine2="            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SettingsLib/BannerMessagePreference/res/layout/banner_message.xml"
            line="71"
            column="13"/>
    </issue>

    <issue
        id="NewApi"
        message="`?android:attr/colorError` requires API level 26 (current min is 21)"
        errorLine1="        android:fillColor=&quot;?android:attr/colorError&quot;"
        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="frameworks/base/packages/SettingsLib/BannerMessagePreference/res/drawable/ic_warning.xml"
            line="24"
            column="9"/>
    </issue>

</issues>
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2021 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.
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="?android:attr/background" />
    <corners android:radius="28dp"/>
</shape>
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
<!--
  Copyright (C) 2021 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="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="?android:attr/textColorSecondary"
        android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12 19,6.41z"/>
</vector>
Loading