Tweak track search dialog list item paddings

This commit is contained in:
arkon 2020-07-16 23:01:24 -04:00
parent 13a5662a84
commit 148f8e6d11
3 changed files with 10 additions and 27 deletions

View File

@ -17,10 +17,10 @@ import java.util.concurrent.TimeUnit
import kotlinx.android.synthetic.main.track_search_dialog.view.progress import kotlinx.android.synthetic.main.track_search_dialog.view.progress
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search import kotlinx.android.synthetic.main.track_search_dialog.view.track_search
import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list import kotlinx.android.synthetic.main.track_search_dialog.view.track_search_list
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.android.widget.itemClicks import reactivecircus.flowbinding.android.widget.itemClicks
import reactivecircus.flowbinding.android.widget.textChanges import reactivecircus.flowbinding.android.widget.textChanges
@ -96,13 +96,13 @@ class TrackSearchDialog : DialogController {
adapter = null adapter = null
} }
@FlowPreview
override fun onAttach(view: View) { override fun onAttach(view: View) {
super.onAttach(view) super.onAttach(view)
dialogView!!.track_search.textChanges() dialogView!!.track_search.textChanges()
.debounce(TimeUnit.SECONDS.toMillis(1)) .debounce(TimeUnit.SECONDS.toMillis(1))
.map { it.toString() }
.filter { it.isNotBlank() } .filter { it.isNotBlank() }
.onEach { search(it) } .onEach { search(it.toString()) }
.launchIn(trackController.scope) .launchIn(trackController.scope)
} }

View File

@ -52,8 +52,6 @@
android:footerDividersEnabled="true" android:footerDividersEnabled="true"
android:headerDividersEnabled="true" android:headerDividersEnabled="true"
android:listSelector="@drawable/list_item_selector" android:listSelector="@drawable/list_item_selector"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:scrollbars="none" android:scrollbars="none"
android:visibility="invisible" android:visibility="invisible"
tools:listitem="@layout/track_search_item" tools:listitem="@layout/track_search_item"
@ -61,9 +59,4 @@
</FrameLayout> </FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/divider" />
</LinearLayout> </LinearLayout>

View File

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="@style/Theme.Widget.CardView.Item" style="@style/Theme.Widget.CardView.Item"
android:layout_margin="0dp"
android:padding="0dp"> android:padding="0dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -16,10 +17,6 @@
android:id="@+id/track_search_cover" android:id="@+id/track_search_cover"
android:layout_width="135dp" android:layout_width="135dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:contentDescription="@string/description_cover" android:contentDescription="@string/description_cover"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -32,7 +29,7 @@
android:id="@+id/track_search_title" android:id="@+id/track_search_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:maxLines="3" android:maxLines="3"
@ -47,7 +44,7 @@
android:id="@+id/track_search_type" android:id="@+id/track_search_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="16dp"
android:maxLines="1" android:maxLines="1"
android:text="@string/track_type" android:text="@string/track_type"
android:textAppearance="@style/TextAppearance.Regular.Body1.Bold" android:textAppearance="@style/TextAppearance.Regular.Body1.Bold"
@ -71,7 +68,7 @@
android:id="@+id/track_search_start" android:id="@+id/track_search_start"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="16dp"
android:maxLines="1" android:maxLines="1"
android:text="@string/track_start_date" android:text="@string/track_start_date"
android:textAppearance="@style/TextAppearance.Regular.Body1.Bold" android:textAppearance="@style/TextAppearance.Regular.Body1.Bold"
@ -95,7 +92,7 @@
android:id="@+id/track_search_status" android:id="@+id/track_search_status"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="16dp"
android:maxLines="1" android:maxLines="1"
android:text="@string/track_status" android:text="@string/track_status"
android:textAppearance="@style/TextAppearance.Regular.Body1.Bold" android:textAppearance="@style/TextAppearance.Regular.Body1.Bold"
@ -119,9 +116,9 @@
android:id="@+id/track_search_summary" android:id="@+id/track_search_summary"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="8dp" android:layout_marginStart="16dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="7" android:maxLines="7"
@ -135,13 +132,6 @@
app:layout_constraintVertical_bias="0.333" app:layout_constraintVertical_bias="0.333"
tools:text="This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits " /> tools:text="This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits This is the summary of the manga that fits " />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="150dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>