Merge "Redesign homepage IA icon" into sc-dev

This commit is contained in:
Jason Chiu
2021-05-13 02:59:29 +00:00
committed by Android (Google) Code Review
31 changed files with 112 additions and 860 deletions

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_about_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_phone_info" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_accessibility_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_accessibility" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_accounts_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_accounts" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_app_and_notification_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_apps" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_battery_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_battery_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_connected_device_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_devices_other" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_display_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_display_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_emergency_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_emergency" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_location_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_location"/>
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_network_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_wireless_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_notification_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_notifications_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_privacy_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_privacy"/>
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_security_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_security_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_sound_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_volume_up_24dp" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_storage_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_storage_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_support_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_help" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_system_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_system_dashboard_white" />
</layer-list>

View File

@@ -1,33 +0,0 @@
<?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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
android:width="@dimen/homepage_image_size"
android:height="@dimen/homepage_image_size"
android:color="@color/homepage_wallpaper_background" />
</item>
<item
android:width="@dimen/dashboard_tile_foreground_image_size"
android:height="@dimen/dashboard_tile_foreground_image_size"
android:start="@dimen/homepage_foreground_image_inset"
android:top="@dimen/homepage_foreground_image_inset"
android:drawable="@drawable/ic_settings_wallpaper_white" />
</layer-list>

View File

@@ -1,75 +0,0 @@
<?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="72dp"
android:gravity="center_vertical"
android:paddingStart="24dp"
android:paddingEnd="24dp"
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:gravity="start|center_vertical"
android:orientation="horizontal"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:layout_marginEnd="16dp">
<androidx.preference.internal.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:maxWidth="48dp"
app:maxHeight="48dp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.HomepagePreferenceTitle"
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_alignLeft="@android:id/title"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="4"/>
</RelativeLayout>
</LinearLayout>

View File

@@ -118,12 +118,6 @@
<!-- Dashboard foreground image inset (from background edge to foreground edge) -->
<dimen name="dashboard_tile_foreground_image_inset">6dp</dimen>
<!-- Homepage image tile size -->
<dimen name="homepage_image_size">48dp</dimen>
<!-- Homepage foreground image inset (from background edge to foreground edge) -->
<dimen name="homepage_foreground_image_inset">12dp</dimen>
<!-- Preference icon foreground image inset (from background edge to foreground edge) -->
<dimen name="preference_icon_foreground_image_inset">12dp</dimen>

View File

@@ -315,12 +315,6 @@
<item name="android:singleLine">true</item>
</style>
<style name="TextAppearance.HomepagePreferenceTitle"
parent="@*android:style/TextAppearance.DeviceDefault">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textSize">20sp</item>
</style>
<style name="TextAppearance.HomepageCardTitle"
parent="@*android:style/TextAppearance.DeviceDefault.Subhead">
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>

View File

@@ -20,154 +20,154 @@
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="top_level_settings_grouped">
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.network.NetworkDashboardFragment"
android:icon="@drawable/ic_homepage_network_v2"
android:icon="@drawable/ic_settings_wireless"
android:key="top_level_network"
android:order="-150"
android:title="@string/network_dashboard_title"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.network.TopLevelNetworkEntryPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"
android:icon="@drawable/ic_homepage_connected_device_v2"
android:icon="@drawable/ic_devices_other"
android:key="top_level_connected_devices"
android:order="-140"
android:title="@string/connected_devices_dashboard_title"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.applications.AppDashboardFragment"
android:icon="@drawable/ic_homepage_apps_v2"
android:icon="@drawable/ic_apps"
android:key="top_level_apps"
android:order="-130"
android:title="@string/apps_dashboard_title"
android:summary="@string/app_and_notification_dashboard_summary"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.notification.ConfigureNotificationSettings"
android:icon="@drawable/ic_homepage_notification_v2"
android:icon="@drawable/ic_notifications"
android:key="top_level_notification"
android:order="-120"
android:title="@string/configure_notification_settings"
android:summary="@string/notification_dashboard_summary"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.fuelgauge.PowerUsageSummary"
android:icon="@drawable/ic_homepage_battery_v2"
android:icon="@drawable/ic_settings_battery_white"
android:key="top_level_battery"
android:order="-110"
android:title="@string/power_usage_summary_title"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.fuelgauge.TopLevelBatteryPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.deviceinfo.StorageDashboardFragment"
android:icon="@drawable/ic_homepage_storage_v2"
android:icon="@drawable/ic_storage_white"
android:key="top_level_storage"
android:order="-100"
android:title="@string/storage_settings"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.deviceinfo.TopLevelStoragePreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.notification.SoundSettings"
android:icon="@drawable/ic_homepage_sound_v2"
android:icon="@drawable/ic_volume_up_24dp"
android:key="top_level_sound"
android:order="-90"
android:title="@string/sound_settings"
android:summary="@string/sound_dashboard_summary"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.DisplaySettings"
android:icon="@drawable/ic_homepage_display_v2"
android:icon="@drawable/ic_settings_display_white"
android:key="top_level_display"
android:order="-80"
android:title="@string/display_settings"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.display.TopLevelDisplayPreferenceController"/>
<com.android.settings.homepage.RestrictedHomepagePreference
android:icon="@drawable/ic_homepage_wallpaper_v2"
<com.android.settingslib.RestrictedTopLevelPreference
android:icon="@drawable/ic_settings_wallpaper_white"
android:key="top_level_wallpaper"
android:order="-70"
android:title="@string/wallpaper_settings_title"
android:summary="@string/wallpaper_dashboard_summary"
settings:controller="com.android.settings.display.TopLevelWallpaperPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.accessibility.AccessibilitySettings"
android:icon="@drawable/ic_homepage_accessibility_v2"
android:icon="@drawable/ic_settings_accessibility"
android:key="top_level_accessibility"
android:order="-60"
android:title="@string/accessibility_settings"
android:summary="@string/accessibility_settings_summary"
settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.security.SecuritySettings"
android:icon="@drawable/ic_homepage_security_v2"
android:icon="@drawable/ic_settings_security_white"
android:key="top_level_security"
android:order="-50"
android:title="@string/security_settings_title"
android:summary="@string/security_dashboard_summary_biometric"
settings:controller="com.android.settings.security.TopLevelSecurityEntryPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.privacy.PrivacyDashboardFragment"
android:icon="@drawable/ic_homepage_privacy_v2"
android:icon="@drawable/ic_settings_privacy"
android:key="top_level_privacy"
android:order="-40"
android:title="@string/privacy_dashboard_title"
android:summary="@string/privacy_dashboard_summary"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.location.LocationSettings"
android:icon="@drawable/ic_homepage_location_v2"
android:icon="@drawable/ic_settings_location"
android:key="top_level_location"
android:order="-30"
android:title="@string/location_settings_title"
android:summary="@string/location_settings_loading_app_permission_stats"
settings:controller="com.android.settings.location.TopLevelLocationPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:key="top_level_emergency"
android:title="@string/emergency_settings_preference_title"
android:summary="@string/emergency_dashboard_summary"
android:icon="@drawable/ic_homepage_emergency_v2"
android:icon="@drawable/ic_settings_emergency"
android:order="-20"
android:fragment="com.android.settings.emergency.EmergencyDashboardFragment"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.accounts.AccountDashboardFragment"
android:icon="@drawable/ic_homepage_accounts_v2"
android:icon="@drawable/ic_settings_accounts"
android:key="top_level_accounts"
android:order="-10"
android:title="@string/account_dashboard_title"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.accounts.TopLevelAccountEntryPreferenceController"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.system.SystemDashboardFragment"
android:icon="@drawable/ic_homepage_system_dashboard_v2"
android:icon="@drawable/ic_settings_system_dashboard_white"
android:key="top_level_system"
android:order="10"
android:title="@string/header_category_system"
android:summary="@string/system_dashboard_summary"/>
<com.android.settings.homepage.HomepagePreference
<Preference
android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"
android:icon="@drawable/ic_homepage_about_v2"
android:icon="@drawable/ic_phone_info"
android:key="top_level_about_device"
android:order="20"
android:title="@string/about_settings"
android:summary="@string/summary_placeholder"
settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/>
<com.android.settings.homepage.HomepagePreference
android:icon="@drawable/ic_homepage_support_v2"
<Preference
android:icon="@drawable/ic_help"
android:key="top_level_support"
android:order="100"
android:title="@string/page_tab_title_support"

View File

@@ -1211,6 +1211,14 @@ public final class Utils extends com.android.settingslib.Utils {
return roundedBitmap;
}
/**
* Returns the color of homepage preference icons.
*/
@ColorInt
public static int getHomepageIconColor(Context context) {
return getColorAttrDefaultColor(context, android.R.attr.textColorPrimary);
}
public static boolean isProviderModelEnabled(Context context) {
return FeatureFlagUtils.isEnabled(context, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL);
}

View File

@@ -59,6 +59,7 @@ import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.core.FeatureFlags;
import com.android.settings.dashboard.profileselector.ProfileSelectDialog;
import com.android.settings.overlay.FeatureFactory;
@@ -401,12 +402,12 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
private void setPreferenceIcon(Preference preference, Tile tile, boolean forceRoundedIcon,
String iconPackage, Icon icon) {
Drawable iconDrawable = icon.loadDrawable(preference.getContext());
if (forceRoundedIcon && !TextUtils.equals(mContext.getPackageName(), iconPackage)) {
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)
&& TextUtils.equals(tile.getCategory(), CategoryKey.CATEGORY_HOMEPAGE)) {
iconDrawable.setTint(Utils.getHomepageIconColor(preference.getContext()));
} else if (forceRoundedIcon && !TextUtils.equals(mContext.getPackageName(), iconPackage)) {
iconDrawable = new AdaptiveIcon(mContext, iconDrawable,
FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)
&& TextUtils.equals(tile.getCategory(), CategoryKey.CATEGORY_HOMEPAGE)
? R.dimen.homepage_foreground_image_inset
: R.dimen.dashboard_tile_foreground_image_inset);
R.dimen.dashboard_tile_foreground_image_inset);
((AdaptiveIcon) iconDrawable).setBackgroundColor(mContext, tile);
}
preference.setIcon(iconDrawable);

View File

@@ -39,13 +39,11 @@ import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerListHelper;
import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.homepage.HomepagePreference;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.ProviderTile;
import com.android.settingslib.drawer.Tile;
@@ -538,10 +536,6 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
@VisibleForTesting
Preference createPreference(Tile tile) {
if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)
&& TextUtils.equals(tile.getCategory(), CategoryKey.CATEGORY_HOMEPAGE)) {
return new HomepagePreference(getPrefContext());
}
return tile instanceof ProviderTile
? new SwitchPreference(getPrefContext())
: tile.hasSwitch()

View File

@@ -25,7 +25,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.preference.Preference;
@@ -33,8 +32,6 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.FeatureFlags;
import com.android.settings.homepage.RestrictedHomepagePreference;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.RestrictedTopLevelPreference;
@@ -92,11 +89,7 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
@Override
public void updateState(Preference preference) {
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
disablePreferenceIfManaged((RestrictedHomepagePreference) preference);
} else {
disablePreferenceIfManaged((RestrictedTopLevelPreference) preference);
}
disablePreferenceIfManaged((RestrictedTopLevelPreference) preference);
}
@Override
@@ -140,18 +133,4 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
}
}
}
private void disablePreferenceIfManaged(RestrictedHomepagePreference pref) {
final String restriction = DISALLOW_SET_WALLPAPER;
if (pref != null) {
pref.setDisabledByAdmin(null);
if (RestrictedLockUtilsInternal.hasBaseUserRestriction(mContext,
restriction, UserHandle.myUserId())) {
// Do not show the admin dialog for system restriction.
pref.setEnabled(false);
} else {
pref.checkRestrictionAndSetDisabled(restriction);
}
}
}
}

View File

@@ -1,49 +0,0 @@
/*
* 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.
*/
package com.android.settings.homepage;
import android.content.Context;
import android.util.AttributeSet;
import androidx.preference.Preference;
import com.android.settings.R;
/** A customized layout for homepage preference. */
public class HomepagePreference extends Preference {
public HomepagePreference(Context context) {
super(context);
setLayoutResource(R.layout.homepage_preference);
}
public HomepagePreference(Context context, AttributeSet attrs) {
super(context, attrs);
setLayoutResource(R.layout.homepage_preference);
}
public HomepagePreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, /* defStyleRes= */ 0);
setLayoutResource(R.layout.homepage_preference);
}
public HomepagePreference(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.homepage_preference);
}
}

View File

@@ -1,48 +0,0 @@
/*
* 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.
*/
package com.android.settings.homepage;
import android.content.Context;
import android.util.AttributeSet;
import androidx.core.content.res.TypedArrayUtils;
import com.android.settings.R;
import com.android.settingslib.RestrictedTopLevelPreference;
/** Homepage preference that can be disabled by a device admin using a user restriction. */
public class RestrictedHomepagePreference extends RestrictedTopLevelPreference {
public RestrictedHomepagePreference(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.homepage_preference);
}
public RestrictedHomepagePreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, /* defStyleRes= */ 0);
}
public RestrictedHomepagePreference(Context context, AttributeSet attrs) {
this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
}
public RestrictedHomepagePreference(Context context) {
this(context, /* attrs= */ null);
}
}

View File

@@ -21,6 +21,7 @@ import static com.android.settingslib.search.SearchIndexable.MOBILE;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.util.FeatureFlagUtils;
@@ -28,8 +29,10 @@ import android.util.FeatureFlagUtils;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
@@ -102,6 +105,31 @@ public class TopLevelSettings extends DashboardFragment implements
return true;
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
if (!FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
return;
}
final PreferenceScreen screen = getPreferenceScreen();
if (screen == null) {
return;
}
// Tint the homepage icons
final int tintColor = Utils.getHomepageIconColor(getContext());
final int count = screen.getPreferenceCount();
for (int i = 0; i < count; i++) {
final Preference preference = screen.getPreference(i);
if (preference == null) {
break;
}
final Drawable icon = preference.getIcon();
if (icon != null) {
icon.setTint(tintColor);
}
}
}
@Override
protected boolean shouldForceRoundedIcon() {
return getContext().getResources()

View File

@@ -48,7 +48,6 @@ import androidx.preference.SwitchPreference;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.homepage.HomepagePreference;
import com.android.settings.slices.BlockingSlicePrefController;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.widget.PrimarySwitchPreference;
@@ -56,7 +55,6 @@ import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.instrumentation.VisibilityLoggerMixin;
import com.android.settingslib.drawer.ActivityTile;
import com.android.settingslib.drawer.CategoryKey;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.ProviderTile;
@@ -337,16 +335,6 @@ public class DashboardFragmentTest {
assertThat(pref).isInstanceOf(PrimarySwitchPreference.class);
}
@Test
public void createPreference_isHomepageTile_returnHomepagePreference() {
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, true);
mActivityTile.setCategory(CategoryKey.CATEGORY_HOMEPAGE);
final Preference pref = mTestFragment.createPreference(mActivityTile);
assertThat(pref).isInstanceOf(HomepagePreference.class);
}
@Test
public void isFeatureFlagAndIsParalleled_runParalleledUpdatePreferenceStates() {
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.CONTROLLER_ENHANCEMENT, true);
@@ -472,7 +460,7 @@ public class DashboardFragmentTest {
return mIsParalleled;
}
public void setUsingControllerEnhancement(boolean isParalleled) {
void setUsingControllerEnhancement(boolean isParalleled) {
mIsParalleled = isParalleled;
}
}

View File

@@ -18,14 +18,24 @@ package com.android.settings.homepage;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.FeatureFlagUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
import org.junit.Test;
@@ -43,6 +53,11 @@ public class TopLevelSettingsTest {
mContext = RuntimeEnvironment.application;
mSettings = spy(new TopLevelSettings());
when(mSettings.getContext()).thenReturn(mContext);
final FakeFeatureFactory featureFactory = FakeFeatureFactory.setupForTest();
when(featureFactory.dashboardFeatureProvider
.getTilesForCategory(nullable(String.class)))
.thenReturn(null);
mSettings.onAttach(mContext);
}
@Test
@@ -62,4 +77,21 @@ public class TopLevelSettingsTest {
assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(
R.xml.top_level_settings_grouped);
}
@Test
public void onCreatePreferences_shouldTintPreferenceIcon() {
final Preference preference = new Preference(mContext);
preference.setTitle(R.string.network_dashboard_title);
final Drawable icon = spy(mContext.getDrawable(R.drawable.ic_settings_wireless));
preference.setIcon(icon);
final PreferenceScreen screen = spy(new PreferenceScreen(mContext, null /* attrs */));
doReturn(1).when(screen).getPreferenceCount();
doReturn(preference).when(screen).getPreference(anyInt());
doReturn(screen).when(mSettings).getPreferenceScreen();
doReturn(0).when(mSettings).getPreferenceScreenResId();
mSettings.onCreatePreferences(new Bundle(), "rootKey");
verify(icon).setTint(anyInt());
}
}