From 9b972e8ac6381c638a66afb80524fdf388fbaf5c Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Thu, 26 Mar 2020 14:33:11 -0400 Subject: [PATCH] Fix overlap of text and star in controls This makes sure that the text only extends as far as the star (for subtitle). The title text is constrained to be on top of the star. Also: * Make whole tile clickable * Add ripple to tile on click Test: manual Fixes: 152496155 Change-Id: I284aaf5b8eb3ce761680808f93b19627cb9cc479 --- .../drawable/control_background_ripple.xml | 23 ++++++++++ .../res/layout/controls_base_item.xml | 45 +++++++++++-------- .../controls/management/ControlAdapter.kt | 9 ++-- 3 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 packages/SystemUI/res/drawable/control_background_ripple.xml diff --git a/packages/SystemUI/res/drawable/control_background_ripple.xml b/packages/SystemUI/res/drawable/control_background_ripple.xml new file mode 100644 index 0000000000000..37914e2728117 --- /dev/null +++ b/packages/SystemUI/res/drawable/control_background_ripple.xml @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/packages/SystemUI/res/layout/controls_base_item.xml b/packages/SystemUI/res/layout/controls_base_item.xml index 7708b8e9db6c8..2d54bc839fff5 100644 --- a/packages/SystemUI/res/layout/controls_base_item.xml +++ b/packages/SystemUI/res/layout/controls_base_item.xml @@ -50,6 +50,7 @@ app:layout_constraintBottom_toBottomOf="@+id/icon" app:layout_constraintStart_toEndOf="@+id/icon" /> + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@id/barrier"/> + + + /> - - - - - + app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt index 563c2f677801b..764fda05354cf 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlAdapter.kt @@ -68,6 +68,8 @@ class ControlAdapter( width = ViewGroup.LayoutParams.MATCH_PARENT } elevation = this@ControlAdapter.elevation + background = parent.context.getDrawable( + R.drawable.control_background_ripple) } ) { id, favorite -> model?.changeFavoriteStatus(id, favorite) @@ -137,10 +139,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang private val title: TextView = itemView.requireViewById(R.id.title) private val subtitle: TextView = itemView.requireViewById(R.id.subtitle) private val removed: TextView = itemView.requireViewById(R.id.status) - private val favorite: CheckBox = itemView.requireViewById(R.id.favorite) - private val favoriteFrame: ViewGroup = itemView - .requireViewById(R.id.favorite_container) - .apply { + private val favorite: CheckBox = itemView.requireViewById(R.id.favorite).apply { visibility = View.VISIBLE } @@ -155,7 +154,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang favorite.setOnClickListener { favoriteCallback(data.control.controlId, favorite.isChecked) } - favoriteFrame.setOnClickListener { favorite.performClick() } + itemView.setOnClickListener { favorite.performClick() } applyRenderInfo(renderInfo) }