Merge "Full-screen user switcher is now scrollable." into tm-qpr-dev
This commit is contained in:
@@ -14,58 +14,84 @@
|
||||
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">
|
||||
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/flow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:flow_horizontalBias="0.5"
|
||||
app:flow_verticalAlign="center"
|
||||
app:flow_wrapMode="chain"
|
||||
app:flow_horizontalGap="@dimen/user_switcher_fullscreen_horizontal_gap"
|
||||
app:flow_verticalGap="44dp"
|
||||
app:flow_horizontalStyle="packed"/>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="wrap_content"
|
||||
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: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" />
|
||||
<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">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add"
|
||||
style="@style/Widget.Dialog.Button.BorderButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="@dimen/user_switcher_fullscreen_button_padding"
|
||||
android:text="@string/add"
|
||||
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>
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/flow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:flow_horizontalBias="0.5"
|
||||
app:flow_verticalAlign="center"
|
||||
app:flow_wrapMode="chain"
|
||||
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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
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"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="@dimen/user_switcher_fullscreen_button_padding"
|
||||
android:text="@string/add"
|
||||
android:textColor="?androidprv:attr/colorAccentPrimary"
|
||||
android:textSize="@dimen/user_switcher_fullscreen_button_text_size"
|
||||
android:visibility="gone"
|
||||
android:minHeight="48dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user