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

Commit 99ded224 authored by Matt Pietal's avatar Matt Pietal
Browse files

Bouncer - User switcher for large screens

Adds support for a default user icon and user switcher on the
bouncer. In landscape these will appear side by side, in portrait,
stacked on top of one another.

Bug: 206826027
Test: atest KeyguardSecurityContainerControllerTest KeyguardSecurityContainerTest

Change-Id: I1f89c5b9b5a58a456fe3ed192c54b09eca00b39b
parent 6629b4de
Loading
Loading
Loading
Loading
+36 −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.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
            android:paddingMode="stack"
            android:paddingStart="44dp"
            android:paddingEnd="44dp"
            android:paddingLeft="0dp"
            android:paddingRight="0dp">
    <item>
        <shape android:shape="rectangle">
          <solid android:color="?androidprv:attr/colorSurface" />
            <corners android:radius="@dimen/keyguard_user_switcher_corner" />
        </shape>
    </item>
    <item
        android:drawable="@drawable/ic_ksh_key_down"
        android:gravity="end|center_vertical"
        android:width="32dp"
        android:height="32dp"
        android:end="12dp" />
</layer-list>
+22 −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
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
       android:shape="rectangle">
    <solid android:color="?androidprv:attr/colorSurface" />
    <corners android:radius="@dimen/keyguard_user_switcher_popup_corner" />
</shape>
+55 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 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"
    android:id="@+id/keyguard_bouncer_user_switcher"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:orientation="vertical"
    android:gravity="center"
    android:paddingTop="12dp"
    android:importantForAccessibility="yes"> <!-- Needed because TYPE_WINDOW_STATE_CHANGED is sent
                                                  from this view when bouncer is shown -->

  <ImageView
      android:id="@+id/user_icon"
      android:layout_width="@dimen/keyguard_user_switcher_icon_size"
      android:layout_height="@dimen/keyguard_user_switcher_icon_size" />

    <!-- need to keep this outer view in order to have a correctly sized anchor
         for the dropdown menu, as well as dropdown background in the right place -->
    <LinearLayout
        android:id="@+id/user_switcher_anchor"
        android:orientation="horizontal"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginTop="32dp"
        android:minHeight="48dp">
      <TextView
          style="@style/Keyguard.UserSwitcher.Spinner.Header"
          android:clickable="false"
          android:id="@+id/user_switcher_header"
          android:layout_width="@dimen/keyguard_user_switcher_width"
          android:layout_height="wrap_content" />
    </LinearLayout>>

</LinearLayout>
+25 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/Keyguard.UserSwitcher.Spinner.Item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="start"
    android:paddingStart="@dimen/control_menu_horizontal_padding"
    android:paddingEnd="@dimen/control_menu_horizontal_padding"
    android:textDirection="locale"/>
+0 −2
Original line number Diff line number Diff line
@@ -49,8 +49,6 @@
            android:paddingBottom="@dimen/num_pad_entry_row_margin_bottom"
            androidprv:layout_constraintEnd_toEndOf="parent"
            androidprv:layout_constraintStart_toStartOf="parent"

            androidprv:layout_constraintTop_toTopOf="parent"
            androidprv:layout_constraintBottom_toTopOf="@id/key1"
            androidprv:layout_constraintVertical_bias="0.0">

Loading