Merge "Fix overlap of text and star in controls" into rvc-dev am: 9b77b19311
Change-Id: Icb75048a3c6bb3c1e20d12f7efb16ca59dec5d83
This commit is contained in:
23
packages/SystemUI/res/drawable/control_background_ripple.xml
Normal file
23
packages/SystemUI/res/drawable/control_background_ripple.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (C) 2020 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="?android:attr/colorControlHighlight">
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<color android:color="@android:color/white" />
|
||||||
|
</item>
|
||||||
|
<item android:drawable="@drawable/control_background" />
|
||||||
|
</ripple>
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="@+id/icon"
|
app:layout_constraintBottom_toBottomOf="@+id/icon"
|
||||||
app:layout_constraintStart_toEndOf="@+id/icon" />
|
app:layout_constraintStart_toEndOf="@+id/icon" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/status_extra"
|
android:id="@+id/status_extra"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -64,7 +65,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.Control.Title"
|
android:textAppearance="@style/TextAppearance.Control.Title"
|
||||||
android:paddingLeft="@dimen/control_padding_adjustment"
|
android:paddingLeft="@dimen/control_padding_adjustment"
|
||||||
@@ -73,12 +74,20 @@
|
|||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/subtitle"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/barrier"/>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Barrier
|
||||||
|
android:id="@+id/barrier"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:barrierDirection="top"
|
||||||
|
app:constraint_referenced_ids="subtitle,favorite" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subtitle"
|
android:id="@+id/subtitle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="@style/TextAppearance.Control.Subtitle"
|
android:textAppearance="@style/TextAppearance.Control.Subtitle"
|
||||||
android:paddingLeft="@dimen/control_padding_adjustment"
|
android:paddingLeft="@dimen/control_padding_adjustment"
|
||||||
@@ -88,24 +97,22 @@
|
|||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/favorite"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"/>
|
/>
|
||||||
|
|
||||||
<FrameLayout
|
<CheckBox
|
||||||
android:id="@+id/favorite_container"
|
android:id="@+id/favorite"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="48dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:button="@drawable/controls_btn_star"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/subtitle"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/favorite"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end"
|
|
||||||
android:button="@drawable/controls_btn_star"/>
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ class ControlAdapter(
|
|||||||
width = ViewGroup.LayoutParams.MATCH_PARENT
|
width = ViewGroup.LayoutParams.MATCH_PARENT
|
||||||
}
|
}
|
||||||
elevation = this@ControlAdapter.elevation
|
elevation = this@ControlAdapter.elevation
|
||||||
|
background = parent.context.getDrawable(
|
||||||
|
R.drawable.control_background_ripple)
|
||||||
}
|
}
|
||||||
) { id, favorite ->
|
) { id, favorite ->
|
||||||
model?.changeFavoriteStatus(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 title: TextView = itemView.requireViewById(R.id.title)
|
||||||
private val subtitle: TextView = itemView.requireViewById(R.id.subtitle)
|
private val subtitle: TextView = itemView.requireViewById(R.id.subtitle)
|
||||||
private val removed: TextView = itemView.requireViewById(R.id.status)
|
private val removed: TextView = itemView.requireViewById(R.id.status)
|
||||||
private val favorite: CheckBox = itemView.requireViewById<CheckBox>(R.id.favorite)
|
private val favorite: CheckBox = itemView.requireViewById<CheckBox>(R.id.favorite).apply {
|
||||||
private val favoriteFrame: ViewGroup = itemView
|
|
||||||
.requireViewById<ViewGroup>(R.id.favorite_container)
|
|
||||||
.apply {
|
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +154,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang
|
|||||||
favorite.setOnClickListener {
|
favorite.setOnClickListener {
|
||||||
favoriteCallback(data.control.controlId, favorite.isChecked)
|
favoriteCallback(data.control.controlId, favorite.isChecked)
|
||||||
}
|
}
|
||||||
favoriteFrame.setOnClickListener { favorite.performClick() }
|
itemView.setOnClickListener { favorite.performClick() }
|
||||||
applyRenderInfo(renderInfo)
|
applyRenderInfo(renderInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user