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

Commit 90eef240 authored by Jason Chiu's avatar Jason Chiu
Browse files

UI refinement of highlighted menu entry for large screen

- Add a new highlight background drawable
- Add two homepage specific preferences for the new layout design

Fix: 207079684
Test: visual
Change-Id: I20c80da090a03129bffa845d443ee5d1ad13b97b
parent 83a8b76e
Loading
Loading
Loading
Loading
+27 −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.
  -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:insetLeft="@dimen/homepage_menu_entry_padding_horizontal"
       android:insetRight="@dimen/homepage_menu_entry_padding_horizontal">
    <shape android:shape="rectangle">
        <solid
            android:color="?androidprv:attr/colorAccentSecondaryVariant" />
        <corners
            android:radius="@dimen/homepage_menu_entry_corner_radius" />
    </shape>
</inset>
 No newline at end of file
+81 −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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:gravity="center_vertical"
    android:paddingStart="@dimen/homepage_menu_entry_padding_horizontal"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:background="?android:attr/selectableItemBackground"
    android:clipToPadding="false"
    android:baselineAligned="false">

    <LinearLayout
        android:id="@+id/icon_frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="56dp"
        android:gravity="center"
        android:orientation="horizontal"
        android:paddingStart="8dp"
        android:paddingEnd="8dp"
        android:paddingTop="4dp"
        android:paddingBottom="4dp">

        <androidx.preference.internal.PreferenceImageView
            android:id="@android:id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:maxWidth="40dp"
            app:maxHeight="40dp"/>

    </LinearLayout>

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:paddingTop="16dp"
        android:paddingBottom="16dp"
        android:paddingEnd="16dp">

        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceListItem"
            android:ellipsize="marquee"/>

        <TextView
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@android:id/title"
            android:layout_alignStart="@android:id/title"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:attr/textColorSecondary"
            android:maxLines="4"
            style="@style/PreferenceSummaryTextStyle"/>
    </RelativeLayout>
</LinearLayout>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -141,6 +141,10 @@
    <dimen name="homepage_title_margin_bottom">8dp</dimen>
    <dimen name="homepage_title_margin_horizontal">24dp</dimen>

    <!-- Homepage menu entry -->
    <dimen name="homepage_menu_entry_padding_horizontal">16dp</dimen>
    <dimen name="homepage_menu_entry_corner_radius">28dp</dimen>

    <!-- Dimensions for Wifi Assistant Card -->
    <dimen name="wifi_assistant_padding_top_bottom">16dp</dimen>
    <dimen name="wifi_assistant_padding_start_end">16dp</dimen>
+18 −18
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:key="top_level_settings">

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.network.NetworkDashboardFragment"
        android:icon="@drawable/ic_settings_wireless"
        android:key="top_level_network"
@@ -30,7 +30,7 @@
        settings:highlightableMenuKey="@string/menu_key_network"
        settings:controller="com.android.settings.network.TopLevelNetworkEntryPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"
        android:icon="@drawable/ic_devices_other"
        android:key="top_level_connected_devices"
@@ -40,7 +40,7 @@
        settings:highlightableMenuKey="@string/menu_key_connected_devices"
        settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.applications.AppDashboardFragment"
        android:icon="@drawable/ic_apps"
        android:key="top_level_apps"
@@ -49,7 +49,7 @@
        android:summary="@string/app_and_notification_dashboard_summary"
        settings:highlightableMenuKey="@string/menu_key_apps"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.notification.ConfigureNotificationSettings"
        android:icon="@drawable/ic_notifications"
        android:key="top_level_notifications"
@@ -58,7 +58,7 @@
        android:summary="@string/notification_dashboard_summary"
        settings:highlightableMenuKey="@string/menu_key_notifications"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.fuelgauge.PowerUsageSummary"
        android:icon="@drawable/ic_settings_battery_white"
        android:key="top_level_battery"
@@ -68,7 +68,7 @@
        settings:highlightableMenuKey="@string/menu_key_battery"
        settings:controller="com.android.settings.fuelgauge.TopLevelBatteryPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.deviceinfo.StorageDashboardFragment"
        android:icon="@drawable/ic_storage_white"
        android:key="top_level_storage"
@@ -78,7 +78,7 @@
        settings:highlightableMenuKey="@string/menu_key_storage"
        settings:controller="com.android.settings.deviceinfo.TopLevelStoragePreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.notification.SoundSettings"
        android:icon="@drawable/ic_volume_up_24dp"
        android:key="top_level_sound"
@@ -87,7 +87,7 @@
        android:summary="@string/sound_dashboard_summary"
        settings:highlightableMenuKey="@string/menu_key_sound"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.DisplaySettings"
        android:icon="@drawable/ic_settings_display_white"
        android:key="top_level_display"
@@ -97,7 +97,7 @@
        settings:highlightableMenuKey="@string/menu_key_display"
        settings:controller="com.android.settings.display.TopLevelDisplayPreferenceController"/>

    <com.android.settingslib.RestrictedTopLevelPreference
    <com.android.settings.widget.RestrictedHomepagePreference
        android:icon="@drawable/ic_settings_wallpaper_white"
        android:key="top_level_wallpaper"
        android:order="-70"
@@ -106,7 +106,7 @@
        settings:highlightableMenuKey="@string/menu_key_wallpaper"
        settings:controller="com.android.settings.display.TopLevelWallpaperPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.accessibility.AccessibilitySettings"
        android:icon="@drawable/ic_settings_accessibility"
        android:key="top_level_accessibility"
@@ -116,7 +116,7 @@
        settings:highlightableMenuKey="@string/menu_key_accessibility"
        settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.security.SecuritySettings"
        android:icon="@drawable/ic_settings_security_white"
        android:key="top_level_security"
@@ -126,7 +126,7 @@
        settings:highlightableMenuKey="@string/menu_key_security"
        settings:controller="com.android.settings.security.TopLevelSecurityEntryPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.privacy.PrivacyDashboardFragment"
        android:icon="@drawable/ic_settings_privacy"
        android:key="top_level_privacy"
@@ -135,7 +135,7 @@
        android:summary="@string/privacy_dashboard_summary"
        settings:highlightableMenuKey="@string/menu_key_privacy"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.location.LocationSettings"
        android:icon="@drawable/ic_settings_location"
        android:key="top_level_location"
@@ -145,7 +145,7 @@
        settings:highlightableMenuKey="@string/menu_key_location"
        settings:controller="com.android.settings.location.TopLevelLocationPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:key="top_level_emergency"
        android:title="@string/emergency_settings_preference_title"
        android:summary="@string/emergency_dashboard_summary"
@@ -154,7 +154,7 @@
        android:fragment="com.android.settings.emergency.EmergencyDashboardFragment"
        settings:highlightableMenuKey="@string/menu_key_emergency"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.accounts.AccountDashboardFragment"
        android:icon="@drawable/ic_settings_accounts"
        android:key="top_level_accounts"
@@ -164,7 +164,7 @@
        settings:highlightableMenuKey="@string/menu_key_accounts"
        settings:controller="com.android.settings.accounts.TopLevelAccountEntryPreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.system.SystemDashboardFragment"
        android:icon="@drawable/ic_settings_system_dashboard_white"
        android:key="top_level_system"
@@ -173,7 +173,7 @@
        android:summary="@string/system_dashboard_summary"
        settings:highlightableMenuKey="@string/menu_key_system"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
        android:icon="@drawable/ic_phone_info"
        android:key="top_level_about_device"
@@ -183,7 +183,7 @@
        settings:highlightableMenuKey="@string/menu_key_about_device"
        settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>

    <Preference
    <com.android.settings.widget.HomepagePreference
        android:icon="@drawable/ic_help"
        android:key="top_level_support"
        android:order="100"
+1 −2
Original line number Diff line number Diff line
@@ -529,8 +529,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
        mBlockerController.countDown(controller.getPreferenceKey());
    }

    @VisibleForTesting
    Preference createPreference(Tile tile) {
    protected Preference createPreference(Tile tile) {
        return tile instanceof ProviderTile
                ? new SwitchPreference(getPrefContext())
                : tile.hasSwitch()
Loading