Add action for empty list state
parent
d7f60fa95a
commit
179b08b96a
@ -1,23 +1,23 @@
|
|||||||
package org.koitharu.kotatsu.list.ui.adapter
|
package org.koitharu.kotatsu.list.ui.adapter
|
||||||
|
|
||||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegate
|
||||||
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.base.ui.widgets.ChipsView
|
import org.koitharu.kotatsu.base.ui.widgets.ChipsView
|
||||||
import org.koitharu.kotatsu.core.model.MangaTag
|
import org.koitharu.kotatsu.core.model.MangaTag
|
||||||
import org.koitharu.kotatsu.databinding.ItemCurrentFilterBinding
|
|
||||||
import org.koitharu.kotatsu.list.ui.model.CurrentFilterModel
|
import org.koitharu.kotatsu.list.ui.model.CurrentFilterModel
|
||||||
import org.koitharu.kotatsu.list.ui.model.ListModel
|
import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||||
|
|
||||||
fun currentFilterAD(
|
fun currentFilterAD(
|
||||||
onTagRemoveClick: (MangaTag) -> Unit,
|
listener: MangaListListener,
|
||||||
) = adapterDelegateViewBinding<CurrentFilterModel, ListModel, ItemCurrentFilterBinding>(
|
) = adapterDelegate<CurrentFilterModel, ListModel>(R.layout.item_current_filter) {
|
||||||
{ inflater, parent -> ItemCurrentFilterBinding.inflate(inflater, parent, false) }
|
|
||||||
) {
|
|
||||||
|
|
||||||
binding.chipsTags.onChipCloseClickListener = ChipsView.OnChipCloseClickListener { chip, data ->
|
val chipGroup = itemView as ChipsView
|
||||||
onTagRemoveClick(data as? MangaTag ?: return@OnChipCloseClickListener)
|
|
||||||
|
chipGroup.onChipCloseClickListener = ChipsView.OnChipCloseClickListener { chip, data ->
|
||||||
|
listener.onTagRemoveClick(data as? MangaTag ?: return@OnChipCloseClickListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
bind {
|
bind {
|
||||||
binding.chipsTags.setChips(item.chips)
|
chipGroup.setChips(item.chips)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package org.koitharu.kotatsu.list.ui.adapter
|
||||||
|
|
||||||
|
import org.koitharu.kotatsu.base.ui.list.OnListItemClickListener
|
||||||
|
import org.koitharu.kotatsu.core.model.Manga
|
||||||
|
import org.koitharu.kotatsu.core.model.MangaTag
|
||||||
|
|
||||||
|
interface MangaListListener : OnListItemClickListener<Manga> {
|
||||||
|
|
||||||
|
fun onRetryClick(error: Throwable)
|
||||||
|
fun onTagRemoveClick(tag: MangaTag)
|
||||||
|
fun onFilterClick()
|
||||||
|
fun onEmptyActionClick()
|
||||||
|
}
|
||||||
@ -1,15 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<HorizontalScrollView
|
<org.koitharu.kotatsu.base.ui.widgets.ChipsView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/chips_tags"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:closeIconEnabled="true" />
|
||||||
<org.koitharu.kotatsu.base.ui.widgets.ChipsView
|
|
||||||
android:id="@+id/chips_tags"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:closeIconEnabled="true"
|
|
||||||
app:singleLine="true" />
|
|
||||||
|
|
||||||
</HorizontalScrollView>
|
|
||||||
Loading…
Reference in New Issue