Add icon for user switching

Only in the case of changing users, add a horizontal switch icon to
the top of the dialog.

Bug: 219075728
Test: manual (switch users and observe new icon)
Change-Id: I24d328a80c19339e1eef946d9fed69cb68615afb
This commit is contained in:
Matt Pietal
2022-02-15 12:24:15 -05:00
parent 2773ac9c72
commit a7ab4fce87
4 changed files with 41 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 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:color/white"
android:pathData="M17,14L15.6,12.575L18.175,10H11V8H18.175L15.6,5.425L17,4L22,9ZM7,20L2,15L7,10L8.4,11.425L5.825,14H13V16H5.825L8.4,18.575Z" />
</vector>

View File

@@ -18,10 +18,13 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message"
style="?attr/textAppearanceListItem"
android:layout_width="match_parent"
android:background="?attr/colorSurface"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:drawablePadding="12dp"
android:drawableTint="?attr/textColorPrimary"
android:paddingStart="?attr/dialogPreferredPadding"
android:paddingEnd="?attr/dialogPreferredPadding"
android:paddingTop="24dp"
android:paddingBottom="24dp" />
android:paddingBottom="24dp" />

View File

@@ -4762,4 +4762,6 @@
<java-symbol type="bool" name="config_bg_prompt_fgs_with_noti_to_bg_restricted" />
<java-symbol type="integer" name="config_bg_current_drain_exempted_types" />
<java-symbol type="bool" name="config_bg_current_drain_high_threshold_by_bg_location" />
<java-symbol type="drawable" name="ic_swap_horiz" />
</resources>

View File

@@ -91,8 +91,8 @@ class UserSwitchingDialog extends AlertDialog
setCancelable(false);
Resources res = getContext().getResources();
// Custom view due to alignment and font size requirements
View view = LayoutInflater.from(getContext()).inflate(R.layout.user_switching_dialog,
null);
TextView view = (TextView) LayoutInflater.from(getContext()).inflate(
R.layout.user_switching_dialog, null);
String viewMessage = null;
if (UserManager.isSplitSystemUser() && mNewUser.id == UserHandle.USER_SYSTEM) {
@@ -115,9 +115,12 @@ class UserSwitchingDialog extends AlertDialog
if (viewMessage == null) {
viewMessage = res.getString(R.string.user_switching_message, mNewUser.name);
}
view.setCompoundDrawablesWithIntrinsicBounds(null,
getContext().getDrawable(R.drawable.ic_swap_horiz), null, null);
}
view.setAccessibilityPaneTitle(viewMessage);
((TextView) view.findViewById(R.id.message)).setText(viewMessage);
view.setText(viewMessage);
setView(view);
}