Searching chapters collapses manga header

Fixed fade in of chapters on first load of manga details
This commit is contained in:
Jay 2020-03-24 02:47:40 -04:00
parent f57e19a894
commit d361f41b35
5 changed files with 44 additions and 10 deletions

View File

@ -34,13 +34,13 @@ import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
import eu.kanade.tachiyomi.util.view.scrollViewWith
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog
import kotlin.math.max
import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.catalogue_main_controller.*
import kotlinx.android.synthetic.main.extensions_bottom_sheet.*
import kotlinx.android.synthetic.main.main_activity.*
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import kotlin.math.max
/**
* This controller shows and manages the different catalogues enabled by the user.

View File

@ -52,10 +52,10 @@ class MangaDetailsAdapter(
fun performFilter() {
val s = getFilter(String::class.java)
if (s.isNullOrBlank()) {
updateDataSet(items, true)
updateDataSet(items, itemCount != 0)
} else {
updateDataSet(items.filter { it.name.contains(s, true) ||
it.scanlator?.contains(s, true) == true })
it.scanlator?.contains(s, true) == true }, itemCount != 0)
}
}

View File

@ -576,6 +576,10 @@ class MangaDetailsController : BaseController,
setOnQueryTextChangeListener(searchView) {
query = it ?: ""
if (query.isNotEmpty()) {
(recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder)?.collaspe()
} else (recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder)?.expand()
adapter?.setFilter(query)
adapter?.performFilter()
true

View File

@ -20,11 +20,12 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.invisible
import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.visible
import eu.kanade.tachiyomi.util.view.visibleIf
import java.util.Locale
import kotlinx.android.synthetic.main.manga_header_item.*
import java.util.Locale
class MangaHeaderHolder(
private val view: View,
@ -103,11 +104,13 @@ class MangaHeaderHolder(
.no_description)
manga_summary.post {
if ((manga_summary.lineCount < 3 && manga.genre.isNullOrBlank()) ||
less_button.visibility == View.VISIBLE) {
more_button_group.gone()
} else
more_button_group.visible()
if (sub_item_group.visibility != View.GONE) {
if ((manga_summary.lineCount < 3 && manga.genre.isNullOrBlank()) || less_button.visibility == View.VISIBLE) {
more_button_group.gone()
} else more_button_group.visible()
}
if (adapter.hasFilter()) collaspe()
else expand()
}
manga_summary_label.text = itemView.context.getString(R.string.about_this,
itemView.context.getString(
@ -252,6 +255,26 @@ class MangaHeaderHolder(
}
}
fun collaspe() {
sub_item_group.gone()
if (more_button.visibility == View.VISIBLE || more_button.visibility == View.INVISIBLE)
more_button_group.invisible()
else {
less_button.gone()
manga_genres_tags.gone()
}
}
fun expand() {
sub_item_group.visible()
if (more_button.visibility == View.VISIBLE || more_button.visibility == View.INVISIBLE)
more_button_group.visible()
else {
less_button.visible()
manga_genres_tags.visible()
}
}
override fun onLongClick(view: View?): Boolean {
super.onLongClick(view)
return false

View File

@ -274,6 +274,13 @@
android:layout_height="wrap_content"
app:constraint_referenced_ids="more_button,more_bg_gradient,more_bg_solid" />
<androidx.constraintlayout.widget.Group
android:id="@+id/sub_item_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="start_reading_button,
manga_summary,manga_summary_label,button_layout" />
<me.gujun.android.taggroup.TagGroup
android:id="@+id/manga_genres_tags"
style="@style/TagGroup"
@ -339,7 +346,7 @@
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/filters_text"
app:layout_constraintStart_toStartOf="@id/manga_summary_label"
app:layout_constraintStart_toStartOf="@id/cover_card"
app:layout_constraintTop_toBottomOf="@id/start_reading_button" />
<ImageView