Controls management Minor polish changes

* Change checkbox to star
* Move star to bottom end corner, so it won't collide with text (not a
complete solution).
* Star is 24x24 with touch target 48x48
* Fixed color of zone headers.

Test: manual
Fixes: 149147340
Fixes: 150498623

Change-Id: I78b05ac29cf51ee0acff39c5f41e60b457c367fa
This commit is contained in:
Fabian Kozynski
2020-02-28 14:14:32 -05:00
parent 10398d29f3
commit 443149b213
6 changed files with 100 additions and 8 deletions

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp">
<item android:state_checked="true"
android:drawable="@drawable/star_filled"
android:tint="@color/control_primary_text"/>
<item android:drawable="@drawable/star_outline"
android:tint="@color/control_primary_text"/>
</selector>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 11.99 0.027 L 8.628 8.382 L 0.027 9.15 L 6.559 15.111 L 4.597 23.97 L 11.99 19.27 L 19.383 23.97 L 17.421 15.111 L 23.953 9.15 L 15.352 8.382 Z"
android:fillColor="#FFFFFFFF"/>
</vector>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M 11.99 6.491 L 13.15 9.377 L 13.713 10.776 L 15.148 10.902 L 18.103 11.167 L 15.854 13.221 L 14.766 14.216 L 15.089 15.703 L 15.759 18.74 L 13.222 17.127 L 11.99 16.321 L 10.758 17.102 L 8.222 18.715 L 8.891 15.678 L 9.215 14.191 L 8.126 13.196 L 5.877 11.141 L 8.832 10.877 L 10.267 10.751 L 10.83 9.352 L 11.99 6.491 M 11.99 0.027 L 8.628 8.382 L 0.027 9.15 L 6.559 15.111 L 4.597 23.97 L 11.99 19.27 L 19.383 23.97 L 17.421 15.111 L 23.953 9.15 L 15.352 8.382 Z"
android:fillColor="#FFFFFFFF"/>
</vector>

View File

@@ -59,7 +59,7 @@
android:textAppearance="@style/TextAppearance.Control.Title"
app:layout_constraintBottom_toTopOf="@+id/subtitle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/icon" />
app:layout_constraintTop_toBottomOf="@+id/icon"/>
<TextView
android:id="@+id/subtitle"
@@ -67,13 +67,23 @@
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Control.Subtitle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"/>
<CheckBox
android:id="@+id/favorite"
<FrameLayout
android:id="@+id/favorite_container"
android:visibility="gone"
android:layout_width="48dp"
android:layout_height="48dp"
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>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2019 The Android Open Source Project
~ 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.
@@ -19,7 +19,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Control.Title"
android:textColor="?android:attr/colorPrimary"
android:layout_marginStart="12dp"
android:layout_marginEnd="2dp"
android:layout_marginTop="8dp"

View File

@@ -139,7 +139,10 @@ 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<CheckBox>(R.id.favorite).apply {
private val favorite: CheckBox = itemView.requireViewById<CheckBox>(R.id.favorite)
private val favoriteFrame: ViewGroup = itemView
.requireViewById<ViewGroup>(R.id.favorite_container)
.apply {
visibility = View.VISIBLE
}
@@ -154,6 +157,7 @@ private class ControlHolder(view: View, val favoriteCallback: ModelFavoriteChang
favorite.setOnClickListener {
favoriteCallback(data.control.controlId, favorite.isChecked)
}
favoriteFrame.setOnClickListener { favorite.performClick() }
applyRenderInfo(renderInfo)
}