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
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<com.android.systemui.user.UserSwitcherRootView
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
android:id="@+id/user_switcher_root"
|
android:id="@+id/user_switcher_root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginVertical="40dp"
|
android:orientation="vertical">
|
||||||
android:layout_marginHorizontal="60dp">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.helper.widget.Flow
|
<ScrollView
|
||||||
android:id="@+id/flow"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_weight="1"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:fillViewport="true">
|
||||||
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"/>
|
|
||||||
|
|
||||||
<TextView
|
<com.android.systemui.user.UserSwitcherRootView
|
||||||
android:id="@+id/cancel"
|
android:id="@+id/user_switcher_grid_container"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:paddingTop="40dp"
|
||||||
android:gravity="center"
|
android:paddingHorizontal="60dp">
|
||||||
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" />
|
|
||||||
|
|
||||||
<TextView
|
<androidx.constraintlayout.helper.widget.Flow
|
||||||
android:id="@+id/add"
|
android:id="@+id/flow"
|
||||||
style="@style/Widget.Dialog.Button.BorderButton"
|
android:layout_width="0dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_gravity="center"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:gravity="center"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:paddingHorizontal="@dimen/user_switcher_fullscreen_button_padding"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:text="@string/add"
|
app:flow_horizontalBias="0.5"
|
||||||
android:textColor="?androidprv:attr/colorAccentPrimary"
|
app:flow_verticalAlign="center"
|
||||||
android:textSize="@dimen/user_switcher_fullscreen_button_text_size"
|
app:flow_wrapMode="chain"
|
||||||
android:visibility="gone"
|
app:flow_horizontalGap="@dimen/user_switcher_fullscreen_horizontal_gap"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:flow_verticalGap="44dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:flow_horizontalStyle="packed"/>
|
||||||
app:layout_constraintHeight_min="48dp" />
|
</com.android.systemui.user.UserSwitcherRootView>
|
||||||
</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,
|
falsingCollector: FalsingCollector,
|
||||||
onFinish: () -> Unit,
|
onFinish: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val rootView: UserSwitcherRootView = view.requireViewById(R.id.user_switcher_root)
|
val gridContainerView: UserSwitcherRootView =
|
||||||
val flowWidget: FlowWidget = view.requireViewById(R.id.flow)
|
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 addButton: View = view.requireViewById(R.id.add)
|
||||||
val cancelButton: View = view.requireViewById(R.id.cancel)
|
val cancelButton: View = view.requireViewById(R.id.cancel)
|
||||||
val popupMenuAdapter = MenuAdapter(layoutInflater)
|
val popupMenuAdapter = MenuAdapter(layoutInflater)
|
||||||
var popupMenu: UserSwitcherPopupMenu? = null
|
var popupMenu: UserSwitcherPopupMenu? = null
|
||||||
|
|
||||||
rootView.touchHandler =
|
gridContainerView.touchHandler =
|
||||||
object : Gefingerpoken {
|
object : Gefingerpoken {
|
||||||
override fun onTouchEvent(ev: MotionEvent?): Boolean {
|
override fun onTouchEvent(ev: MotionEvent?): Boolean {
|
||||||
falsingCollector.onTouchEvent(ev)
|
falsingCollector.onTouchEvent(ev)
|
||||||
@@ -134,7 +135,7 @@ object UserSwitcherViewBinder {
|
|||||||
val viewPool =
|
val viewPool =
|
||||||
view.children.filter { it.tag == USER_VIEW_TAG }.toMutableList()
|
view.children.filter { it.tag == USER_VIEW_TAG }.toMutableList()
|
||||||
viewPool.forEach {
|
viewPool.forEach {
|
||||||
view.removeView(it)
|
gridContainerView.removeView(it)
|
||||||
flowWidget.removeView(it)
|
flowWidget.removeView(it)
|
||||||
}
|
}
|
||||||
users.forEach { userViewModel ->
|
users.forEach { userViewModel ->
|
||||||
@@ -152,7 +153,7 @@ object UserSwitcherViewBinder {
|
|||||||
inflatedView
|
inflatedView
|
||||||
}
|
}
|
||||||
userView.id = View.generateViewId()
|
userView.id = View.generateViewId()
|
||||||
view.addView(userView)
|
gridContainerView.addView(userView)
|
||||||
flowWidget.addView(userView)
|
flowWidget.addView(userView)
|
||||||
UserViewBinder.bind(
|
UserViewBinder.bind(
|
||||||
view = userView,
|
view = userView,
|
||||||
|
|||||||
Reference in New Issue
Block a user