diff options
| author | 2022-01-22 22:43:14 +0000 | |
|---|---|---|
| committer | 2022-01-24 15:37:08 +0000 | |
| commit | a428956913ce8259ee8f91116ffc700ca9ddbbc7 (patch) | |
| tree | ca79c60bd125788d70aa955a2835e22d9a712863 | |
| parent | feb567fa9e2d5886ed498adeb2483c9ada2a03cb (diff) | |
Visual changes made to "profile info" dialog as in go/avatarpicker/
The "profile info" dialog seen when adding a new user or editing an existing
user is updated to match the styling shown at go/avatarpicker.
Bug: 215664450
Test: Manual - visual control by eye
Change-Id: I76515a8ce7a5531cfc2d5049ce7c237da7b5d69f
5 files changed, 78 insertions, 15 deletions
diff --git a/packages/SettingsLib/res/drawable/add_a_photo_circled.xml b/packages/SettingsLib/res/drawable/add_a_photo_circled.xml new file mode 100644 index 000000000000..bcfd221e94c5 --- /dev/null +++ b/packages/SettingsLib/res/drawable/add_a_photo_circled.xml @@ -0,0 +1,28 @@ +<!-- + ~ Copyright (C) 2022 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> + <shape android:shape="oval"> + <solid android:color="?android:attr/colorAccent"/> + </shape> + </item> + <item + android:left="@dimen/add_a_photo_circled_padding" + android:right="@dimen/add_a_photo_circled_padding" + android:top="@dimen/add_a_photo_circled_padding" + android:bottom="@dimen/add_a_photo_circled_padding" + android:drawable="@drawable/ic_add_a_photo"/> +</layer-list> diff --git a/packages/SettingsLib/res/drawable/ic_add_a_photo.xml b/packages/SettingsLib/res/drawable/ic_add_a_photo.xml new file mode 100644 index 000000000000..4e355031befe --- /dev/null +++ b/packages/SettingsLib/res/drawable/ic_add_a_photo.xml @@ -0,0 +1,24 @@ +<!-- + ~ Copyright (C) 2022 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/colorPrimary" + android:pathData="M11.5,17.5q1.875,0 3.188,-1.313Q16,14.876 16,13q0,-1.875 -1.313,-3.188Q13.376,8.5 11.5,8.5q-1.875,0 -3.188,1.313Q7,11.124 7,13q0,1.875 1.313,3.188Q9.624,17.5 11.5,17.5zM3.5,21q-0.825,0 -1.413,-0.587Q1.5,19.825 1.5,19L1.5,7q0,-0.825 0.587,-1.412Q2.675,5 3.5,5h3.15L8.5,3h6v4h-11v12h16v-9h2v9q0,0.825 -0.587,1.413Q20.325,21 19.5,21zM18.5,8L18.5,6h-2L16.5,4h2L18.5,2h2v2h2v2h-2v2zM11.5,13z"/> +</vector> diff --git a/packages/SettingsLib/res/layout/edit_user_info_dialog_content.xml b/packages/SettingsLib/res/layout/edit_user_info_dialog_content.xml index f66ff007fb90..c8ddcc870e46 100644 --- a/packages/SettingsLib/res/layout/edit_user_info_dialog_content.xml +++ b/packages/SettingsLib/res/layout/edit_user_info_dialog_content.xml @@ -18,24 +18,32 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:baselineAligned="false" - android:orientation="horizontal" + android:orientation="vertical" android:padding="16dp"> - <ImageView - android:id="@+id/user_photo" - android:layout_width="56dp" - android:layout_height="56dp" - android:layout_gravity="bottom" - android:contentDescription="@string/user_image_photo_selector" - android:background="@*android:drawable/spinner_background_holo_dark" - android:scaleType="fitCenter"/> + <FrameLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center"> + <ImageView + android:id="@+id/user_photo" + android:layout_width="@dimen/user_photo_size_in_profile_info_dialog" + android:layout_height="@dimen/user_photo_size_in_profile_info_dialog" + android:contentDescription="@string/user_image_photo_selector" + android:scaleType="fitCenter"/> + <ImageView + android:id="@+id/add_a_photo_icon" + android:layout_width="@dimen/add_a_photo_icon_size_in_profile_info_dialog" + android:layout_height="@dimen/add_a_photo_icon_size_in_profile_info_dialog" + android:src="@drawable/add_a_photo_circled" + android:layout_gravity="bottom|right" /> + </FrameLayout> <EditText android:id="@+id/user_name" - android:layout_width="0dp" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:layout_weight="1" + android:layout_gravity="center" android:minWidth="200dp" android:layout_marginStart="6dp" android:minHeight="@dimen/min_tap_target_size" diff --git a/packages/SettingsLib/res/values/dimens.xml b/packages/SettingsLib/res/values/dimens.xml index 9bccc3f1d864..9ee42b648d3d 100644 --- a/packages/SettingsLib/res/values/dimens.xml +++ b/packages/SettingsLib/res/values/dimens.xml @@ -98,4 +98,8 @@ <!-- Minimum width for the popup for updating a user's photo. --> <dimen name="update_user_photo_popup_min_width">300dp</dimen> + <dimen name="add_a_photo_circled_padding">6dp</dimen> + <dimen name="user_photo_size_in_profile_info_dialog">112dp</dimen> + <dimen name="add_a_photo_icon_size_in_profile_info_dialog">32dp</dimen> + </resources> diff --git a/packages/SettingsLib/src/com/android/settingslib/users/EditUserInfoController.java b/packages/SettingsLib/src/com/android/settingslib/users/EditUserInfoController.java index 58599532d9cb..62043363d85f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/users/EditUserInfoController.java +++ b/packages/SettingsLib/src/com/android/settingslib/users/EditUserInfoController.java @@ -143,9 +143,8 @@ public class EditUserInfoController { mEditUserPhotoController = createEditUserPhotoController(activity, activityStarter, userPhotoView); } else { - // some users can't change their photos so we need to remove suggestive - // background from the photoView - userPhotoView.setBackground(null); + // some users can't change their photos, so we need to remove the suggestive icon + content.findViewById(R.id.add_a_photo_icon).setVisibility(View.GONE); } mEditUserInfoDialog = buildDialog(activity, content, userNameView, oldUserIcon, |