Add authors suggestion and update search suggestion ui
parent
56892aea3c
commit
daa545f3db
@ -0,0 +1,26 @@
|
|||||||
|
package org.koitharu.kotatsu.search.ui.suggestion.adapter
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||||
|
import org.koitharu.kotatsu.R
|
||||||
|
import org.koitharu.kotatsu.databinding.ItemSearchSuggestionQueryHintBinding
|
||||||
|
import org.koitharu.kotatsu.search.ui.suggestion.SearchSuggestionListener
|
||||||
|
import org.koitharu.kotatsu.search.ui.suggestion.model.SearchSuggestionItem
|
||||||
|
|
||||||
|
fun searchSuggestionAuthorAD(
|
||||||
|
listener: SearchSuggestionListener,
|
||||||
|
) = adapterDelegateViewBinding<SearchSuggestionItem.Author, SearchSuggestionItem, ItemSearchSuggestionQueryHintBinding>(
|
||||||
|
{ inflater, parent -> ItemSearchSuggestionQueryHintBinding.inflate(inflater, parent, false) },
|
||||||
|
) {
|
||||||
|
|
||||||
|
val viewClickListener = View.OnClickListener { _ ->
|
||||||
|
listener.onQueryClick(item.name, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.root.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_user, 0, 0, 0)
|
||||||
|
binding.root.setOnClickListener(viewClickListener)
|
||||||
|
|
||||||
|
bind {
|
||||||
|
binding.root.text = item.name
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="?android:windowBackground" />
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/divider_horizontal"
|
||||||
|
android:gravity="top" />
|
||||||
|
</layer-list>
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<size android:height="1dp" />
|
||||||
|
<solid android:color="?colorSurfaceDim" />
|
||||||
|
</shape>
|
||||||
Loading…
Reference in New Issue