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

Commit e4314893 authored by Evan Laird's avatar Evan Laird
Browse files

Add the user switcher chip to the status bar

Add a StatusBarUserSwitcherContainer (plus a view controller) which can
show the current user information and present the user switcher when
tapped. This CL also aggregates all of the current user information into
the StatusBarUserInfoTracker so that the view controllers are
lightweight and reusable in the keyguard and unlocked statusbar.

Test: atest SystemUITests; manual
Bug: 217250837
Change-Id: I5fffb01e191d7bcd95d3a0651208bf0ca8eb45f8
parent bf10ca05
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/system_neutral1_800" />
    <corners android:radius="@dimen/ongoing_call_chip_corner_radius" />
</shape>
+26 −1
Original line number Diff line number Diff line
@@ -30,14 +30,39 @@
        android:id="@+id/status_icon_area"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/system_icons_super_container_margin_start"
        android:paddingTop="@dimen/status_bar_padding_top"
        android:layout_alignParentEnd="true"
        android:gravity="center_vertical|end" >
        <com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer
            android:id="@+id/user_switcher_container"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal"
            android:paddingTop="4dp"
            android:paddingBottom="4dp"
            android:paddingStart="8dp"
            android:paddingEnd="8dp"
            android:background="@drawable/status_bar_user_chip_bg"
            android:visibility="visible" >
            <ImageView android:id="@+id/current_user_avatar"
                android:layout_width="@dimen/multi_user_avatar_keyguard_size"
                android:layout_height="@dimen/multi_user_avatar_keyguard_size"
                android:scaleType="centerInside"
                android:paddingEnd="4dp" />

            <TextView android:id="@+id/current_user_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="@style/TextAppearance.StatusBar.Clock"
                />
        </com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>

        <FrameLayout android:id="@+id/system_icons_container"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:layout_marginStart="@dimen/system_icons_super_container_margin_start"
            android:layout_marginEnd="@dimen/status_bar_padding_end"
            android:gravity="center_vertical|end">
            <include layout="@layout/system_icons" />
+26 −0
Original line number Diff line number Diff line
@@ -119,6 +119,32 @@
            android:gravity="center_vertical|end"
            >

            <com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer
                android:id="@+id/user_switcher_container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal"
                android:paddingTop="4dp"
                android:paddingBottom="4dp"
                android:paddingStart="8dp"
                android:paddingEnd="8dp"
                android:layout_marginEnd="16dp"
                android:background="@drawable/status_bar_user_chip_bg"
                android:visibility="visible" >
                <ImageView android:id="@+id/current_user_avatar"
                    android:layout_width="@dimen/multi_user_avatar_keyguard_size"
                    android:layout_height="@dimen/multi_user_avatar_keyguard_size"
                    android:scaleType="centerInside"
                    android:paddingEnd="4dp" />

                <TextView android:id="@+id/current_user_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="@style/TextAppearance.StatusBar.Clock"
                    />
            </com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer>

            <include layout="@layout/system_icons" />
        </com.android.keyguard.AlphaOptimizedLinearLayout>
    </LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/system_icons"
    android:layout_width="match_parent"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="center_vertical">

+4 −0
Original line number Diff line number Diff line
@@ -32,4 +32,8 @@

    <bool name="flag_smartspace">false</bool>

    <!--  Whether the user switcher chip shows in the status bar. When true, the multi user
      avatar will no longer show on the lockscreen -->
    <bool name="flag_user_switcher_chip">false</bool>

</resources>
Loading