Add arrow to source search headers

This commit is contained in:
arkon 2020-06-05 09:33:42 -04:00
parent 0fdb19c07d
commit ec7297f8c2
3 changed files with 33 additions and 13 deletions

View File

@ -10,6 +10,7 @@ import kotlinx.android.synthetic.main.global_search_controller_card.progress
import kotlinx.android.synthetic.main.global_search_controller_card.recycler
import kotlinx.android.synthetic.main.global_search_controller_card.source_card
import kotlinx.android.synthetic.main.global_search_controller_card.title
import kotlinx.android.synthetic.main.global_search_controller_card.title_wrapper
/**
* Holder that binds the [GlobalSearchItem] containing catalogue cards.
@ -32,7 +33,7 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
recycler.layoutManager = LinearLayoutManager(view.context, LinearLayoutManager.HORIZONTAL, false)
recycler.adapter = mangaAdapter
title.setOnClickListener {
title_wrapper.setOnClickListener {
adapter.getItem(bindingAdapterPosition)?.let {
adapter.titleClickListener.onTitleClick(it.source)
}
@ -48,7 +49,7 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
val source = item.source
val results = item.results
val titlePrefix = if (item.highlighted) "" else ""
val titlePrefix = if (item.highlighted) " " else ""
val langSuffix = if (source.lang.isNotEmpty()) " (${source.lang})" else ""
// Set Title with country code if available.
@ -101,12 +102,12 @@ class GlobalSearchHolder(view: View, val adapter: GlobalSearchAdapter) :
}
private fun showHolder() {
title.visible()
title_wrapper.visible()
source_card.visible()
}
private fun hideHolder() {
title.gone()
title_wrapper.gone()
source_card.gone()
}
}

View File

@ -1,9 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8 -8,-8z"/>
<path
android:fillColor="#000000"
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8 -8,-8z" />
</vector>

View File

@ -1,17 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.SubHeading"
<RelativeLayout
android:id="@+id/title_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
tools:text="Title" />
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
tools:text="Title" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
app:srcCompat="@drawable/ic_arrow_forward_24dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="ContentDescription" />
</RelativeLayout>
<androidx.cardview.widget.CardView
android:id="@+id/source_card"