mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-09 19:55:11 +01:00
Searching chapters collapses manga header
Fixed fade in of chapters on first load of manga details
This commit is contained in:
parent
f57e19a894
commit
d361f41b35
@ -34,13 +34,13 @@ import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
|
|||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
||||||
import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog
|
import eu.kanade.tachiyomi.widget.preference.SourceLoginDialog
|
||||||
|
import kotlin.math.max
|
||||||
import kotlinx.android.parcel.Parcelize
|
import kotlinx.android.parcel.Parcelize
|
||||||
import kotlinx.android.synthetic.main.catalogue_main_controller.*
|
import kotlinx.android.synthetic.main.catalogue_main_controller.*
|
||||||
import kotlinx.android.synthetic.main.extensions_bottom_sheet.*
|
import kotlinx.android.synthetic.main.extensions_bottom_sheet.*
|
||||||
import kotlinx.android.synthetic.main.main_activity.*
|
import kotlinx.android.synthetic.main.main_activity.*
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import kotlin.math.max
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller shows and manages the different catalogues enabled by the user.
|
* This controller shows and manages the different catalogues enabled by the user.
|
||||||
|
@ -52,10 +52,10 @@ class MangaDetailsAdapter(
|
|||||||
fun performFilter() {
|
fun performFilter() {
|
||||||
val s = getFilter(String::class.java)
|
val s = getFilter(String::class.java)
|
||||||
if (s.isNullOrBlank()) {
|
if (s.isNullOrBlank()) {
|
||||||
updateDataSet(items, true)
|
updateDataSet(items, itemCount != 0)
|
||||||
} else {
|
} else {
|
||||||
updateDataSet(items.filter { it.name.contains(s, true) ||
|
updateDataSet(items.filter { it.name.contains(s, true) ||
|
||||||
it.scanlator?.contains(s, true) == true })
|
it.scanlator?.contains(s, true) == true }, itemCount != 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,6 +576,10 @@ class MangaDetailsController : BaseController,
|
|||||||
|
|
||||||
setOnQueryTextChangeListener(searchView) {
|
setOnQueryTextChangeListener(searchView) {
|
||||||
query = it ?: ""
|
query = it ?: ""
|
||||||
|
if (query.isNotEmpty()) {
|
||||||
|
(recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder)?.collaspe()
|
||||||
|
} else (recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder)?.expand()
|
||||||
|
|
||||||
adapter?.setFilter(query)
|
adapter?.setFilter(query)
|
||||||
adapter?.performFilter()
|
adapter?.performFilter()
|
||||||
true
|
true
|
||||||
|
@ -20,11 +20,12 @@ import eu.kanade.tachiyomi.source.model.SManga
|
|||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
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.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import eu.kanade.tachiyomi.util.view.visibleIf
|
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||||
import java.util.Locale
|
|
||||||
import kotlinx.android.synthetic.main.manga_header_item.*
|
import kotlinx.android.synthetic.main.manga_header_item.*
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class MangaHeaderHolder(
|
class MangaHeaderHolder(
|
||||||
private val view: View,
|
private val view: View,
|
||||||
@ -103,11 +104,13 @@ class MangaHeaderHolder(
|
|||||||
.no_description)
|
.no_description)
|
||||||
|
|
||||||
manga_summary.post {
|
manga_summary.post {
|
||||||
if ((manga_summary.lineCount < 3 && manga.genre.isNullOrBlank()) ||
|
if (sub_item_group.visibility != View.GONE) {
|
||||||
less_button.visibility == View.VISIBLE) {
|
if ((manga_summary.lineCount < 3 && manga.genre.isNullOrBlank()) || less_button.visibility == View.VISIBLE) {
|
||||||
more_button_group.gone()
|
more_button_group.gone()
|
||||||
} else
|
} else more_button_group.visible()
|
||||||
more_button_group.visible()
|
}
|
||||||
|
if (adapter.hasFilter()) collaspe()
|
||||||
|
else expand()
|
||||||
}
|
}
|
||||||
manga_summary_label.text = itemView.context.getString(R.string.about_this,
|
manga_summary_label.text = itemView.context.getString(R.string.about_this,
|
||||||
itemView.context.getString(
|
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 {
|
override fun onLongClick(view: View?): Boolean {
|
||||||
super.onLongClick(view)
|
super.onLongClick(view)
|
||||||
return false
|
return false
|
||||||
|
@ -274,6 +274,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:constraint_referenced_ids="more_button,more_bg_gradient,more_bg_solid" />
|
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
|
<me.gujun.android.taggroup.TagGroup
|
||||||
android:id="@+id/manga_genres_tags"
|
android:id="@+id/manga_genres_tags"
|
||||||
style="@style/TagGroup"
|
style="@style/TagGroup"
|
||||||
@ -339,7 +346,7 @@
|
|||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/filters_text"
|
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" />
|
app:layout_constraintTop_toBottomOf="@id/start_reading_button" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
Loading…
Reference in New Issue
Block a user