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

Commit 0c4187fd authored by Tsung-Mao Fang's avatar Tsung-Mao Fang
Browse files

Create a banner message widget

Based on our ux spec, we create this widget to
let everyone can follow up our spec easily.

Bug: 173184155
Test: Run robotest and apply this widget in Settings and see the ui
Change-Id: I65ebf5f5d9c59e9e52bfb5ad0d8a003a9642303a
parent a74ecc37
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ java_defaults {
        "SettingsLibUtils",
        "SettingsLibEmergencyNumber",
        "SettingsLibTopIntroPreference",
        "SettingsLibBannerMessagePreference",
    ],
}

+13 −0
Original line number Diff line number Diff line
android_library {
    name: "SettingsLibBannerMessagePreference",

    srcs: ["src/**/*.java"],
    resource_dirs: ["res"],

    static_libs: [
          "androidx.preference_preference",
    ],

    sdk_version: "system_current",
    min_sdk_version: "21",
}
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2020 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.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.android.settingslib.widget">

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

</manifest>
+26 −0
Original line number Diff line number Diff line
<!--
  Copyright (C) 2020 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:pathData="M1,21L12,2L23,21H1ZM19.53,19L12,5.99L4.47,19H19.53ZM11,16V18H13V16H11ZM11,10H13V14H11V10Z"
        android:fillColor="?android:attr/colorError"
        android:fillType="evenOdd"/>
</vector>
+73 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingStart="24dp"
    android:paddingEnd="16dp"
    android:paddingTop="24dp"
    android:paddingBottom="8dp"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <ImageView
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:src="@drawable/ic_warning"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="24dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/banner_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="@style/Banner.Text.Title"/>
            <TextView
                android:id="@+id/banner_summary"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="@style/Banner.Text.Summary"/>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="end">
        <Button
            android:id="@+id/banner_negative_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"/>

        <Button
            android:id="@+id/banner_positive_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"/>
    </LinearLayout>
</LinearLayout>
 No newline at end of file
Loading