UI improvements
parent
afd56c02e6
commit
bb2294f248
@ -1,23 +1,23 @@
|
|||||||
package org.koitharu.kotatsu.search.ui.suggestion.adapter
|
package org.koitharu.kotatsu.search.ui.suggestion.adapter
|
||||||
|
|
||||||
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegate
|
import com.hannesdorfmann.adapterdelegates4.dsl.adapterDelegateViewBinding
|
||||||
import org.koitharu.kotatsu.R
|
|
||||||
import org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
import org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
||||||
|
import org.koitharu.kotatsu.databinding.ItemSearchSuggestionTagsBinding
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaTag
|
import org.koitharu.kotatsu.parsers.model.MangaTag
|
||||||
import org.koitharu.kotatsu.search.ui.suggestion.SearchSuggestionListener
|
import org.koitharu.kotatsu.search.ui.suggestion.SearchSuggestionListener
|
||||||
import org.koitharu.kotatsu.search.ui.suggestion.model.SearchSuggestionItem
|
import org.koitharu.kotatsu.search.ui.suggestion.model.SearchSuggestionItem
|
||||||
|
|
||||||
fun searchSuggestionTagsAD(
|
fun searchSuggestionTagsAD(
|
||||||
listener: SearchSuggestionListener,
|
listener: SearchSuggestionListener,
|
||||||
) = adapterDelegate<SearchSuggestionItem.Tags, SearchSuggestionItem>(R.layout.item_search_suggestion_tags) {
|
) = adapterDelegateViewBinding<SearchSuggestionItem.Tags, SearchSuggestionItem, ItemSearchSuggestionTagsBinding>(
|
||||||
|
{ layoutInflater, parent -> ItemSearchSuggestionTagsBinding.inflate(layoutInflater, parent, false) },
|
||||||
|
) {
|
||||||
|
|
||||||
val chipGroup = itemView as ChipsView
|
binding.chipsGenres.onChipClickListener = ChipsView.OnChipClickListener { _, data ->
|
||||||
|
|
||||||
chipGroup.onChipClickListener = ChipsView.OnChipClickListener { _, data ->
|
|
||||||
listener.onTagClick(data as? MangaTag ?: return@OnChipClickListener)
|
listener.onTagClick(data as? MangaTag ?: return@OnChipClickListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
bind {
|
bind {
|
||||||
chipGroup.setChips(item.tags)
|
binding.chipsGenres.setChips(item.tags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,34 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<HorizontalScrollView
|
||||||
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:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:scrollbars="none">
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingHorizontal="12dp"
|
|
||||||
android:paddingVertical="8dp"
|
|
||||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.chip.ChipGroup
|
||||||
android:id="@+id/button_create"
|
android:layout_width="wrap_content"
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="?listPreferredItemPaddingStart"
|
||||||
|
android:paddingEnd="?listPreferredItemPaddingEnd"
|
||||||
|
app:singleLine="true">
|
||||||
|
|
||||||
|
<com.google.android.material.chip.Chip
|
||||||
|
android:id="@+id/chip_create"
|
||||||
|
style="@style/Widget.Kotatsu.Chip.Assist"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:ellipsize="end"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="@string/create_category"
|
android:text="@string/create_category"
|
||||||
app:icon="@drawable/ic_add" />
|
app:chipIcon="@drawable/ic_add" />
|
||||||
|
|
||||||
<Button
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/button_manage"
|
android:id="@+id/chip_manage"
|
||||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
style="@style/Widget.Kotatsu.Chip.Assist"
|
||||||
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:text="@string/manage_categories"
|
||||||
android:ellipsize="end"
|
app:chipIcon="@drawable/ic_edit" />
|
||||||
android:singleLine="true"
|
|
||||||
android:text="@string/manage"
|
</com.google.android.material.chip.ChipGroup>
|
||||||
app:icon="@drawable/ic_edit" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</HorizontalScrollView>
|
||||||
|
|||||||
@ -1,9 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
<HorizontalScrollView
|
||||||
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"
|
||||||
|
android:id="@+id/scrollView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<org.koitharu.kotatsu.core.ui.widgets.ChipsView
|
||||||
|
android:id="@+id/chips_genres"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="?listPreferredItemPaddingStart"
|
android:paddingStart="?listPreferredItemPaddingStart"
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:paddingEnd="?listPreferredItemPaddingEnd"
|
android:paddingEnd="?listPreferredItemPaddingEnd"
|
||||||
android:paddingBottom="6dp" />
|
app:singleLine="true" />
|
||||||
|
|
||||||
|
</HorizontalScrollView>
|
||||||
|
|||||||
Loading…
Reference in New Issue