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

Commit 5e093f4a authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Android (Google) Code Review
Browse files

Merge "Full-screen user switcher is now scrollable." into tm-qpr-dev

parents 4fd49c55 9c04df4f
Loading
Loading
Loading
Loading
+72 −46
Original line number Diff line number Diff line
@@ -14,15 +14,27 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.systemui.user.UserSwitcherRootView
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/user_switcher_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginVertical="40dp"
    android:layout_marginHorizontal="60dp">
    android:orientation="vertical">

  <ScrollView
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_weight="1"
      android:fillViewport="true">

    <com.android.systemui.user.UserSwitcherRootView
        android:id="@+id/user_switcher_grid_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="40dp"
        android:paddingHorizontal="60dp">

      <androidx.constraintlayout.helper.widget.Flow
          android:id="@+id/flow"
@@ -38,6 +50,16 @@
          app:flow_horizontalGap="@dimen/user_switcher_fullscreen_horizontal_gap"
          app:flow_verticalGap="44dp"
          app:flow_horizontalStyle="packed"/>
    </com.android.systemui.user.UserSwitcherRootView>

  </ScrollView>

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="96dp"
    android:orientation="horizontal"
    android:gravity="center_vertical|end"
    android:paddingEnd="48dp">

    <TextView
        android:id="@+id/cancel"
@@ -45,14 +67,17 @@
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
      app:layout_constraintHeight_min="48dp"
      app:layout_constraintEnd_toStartOf="@+id/add"
      app:layout_constraintBottom_toBottomOf="parent"
        android:minHeight="48dp"
        android:paddingHorizontal="@dimen/user_switcher_fullscreen_button_padding"
        android:textSize="@dimen/user_switcher_fullscreen_button_text_size"
        android:textColor="?androidprv:attr/colorAccentPrimary"
        android:text="@string/cancel" />

    <Space
        android:layout_width="24dp"
        android:layout_height="0dp"
        />

    <TextView
        android:id="@+id/add"
        style="@style/Widget.Dialog.Button.BorderButton"
@@ -65,7 +90,8 @@
        android:textColor="?androidprv:attr/colorAccentPrimary"
        android:textSize="@dimen/user_switcher_fullscreen_button_text_size"
        android:visibility="gone"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintHeight_min="48dp" />
</com.android.systemui.user.UserSwitcherRootView>
        android:minHeight="48dp" />

  </LinearLayout>

</LinearLayout>
+6 −5
Original line number Diff line number Diff line
@@ -61,14 +61,15 @@ object UserSwitcherViewBinder {
        falsingCollector: FalsingCollector,
        onFinish: () -> Unit,
    ) {
        val rootView: UserSwitcherRootView = view.requireViewById(R.id.user_switcher_root)
        val flowWidget: FlowWidget = view.requireViewById(R.id.flow)
        val gridContainerView: UserSwitcherRootView =
            view.requireViewById(R.id.user_switcher_grid_container)
        val flowWidget: FlowWidget = gridContainerView.requireViewById(R.id.flow)
        val addButton: View = view.requireViewById(R.id.add)
        val cancelButton: View = view.requireViewById(R.id.cancel)
        val popupMenuAdapter = MenuAdapter(layoutInflater)
        var popupMenu: UserSwitcherPopupMenu? = null

        rootView.touchHandler =
        gridContainerView.touchHandler =
            object : Gefingerpoken {
                override fun onTouchEvent(ev: MotionEvent?): Boolean {
                    falsingCollector.onTouchEvent(ev)
@@ -134,7 +135,7 @@ object UserSwitcherViewBinder {
                        val viewPool =
                            view.children.filter { it.tag == USER_VIEW_TAG }.toMutableList()
                        viewPool.forEach {
                            view.removeView(it)
                            gridContainerView.removeView(it)
                            flowWidget.removeView(it)
                        }
                        users.forEach { userViewModel ->
@@ -152,7 +153,7 @@ object UserSwitcherViewBinder {
                                    inflatedView
                                }
                            userView.id = View.generateViewId()
                            view.addView(userView)
                            gridContainerView.addView(userView)
                            flowWidget.addView(userView)
                            UserViewBinder.bind(
                                view = userView,