diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsAdapter.kt index 7489435818..162b9bbbc6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsAdapter.kt @@ -130,6 +130,7 @@ class MangaDetailsAdapter( fun readNextChapter() fun topCoverHeight(): Int fun tagClicked(text: String) + fun globalSearch(text: String) fun showChapterFilter() fun favoriteManga(longPress: Boolean) fun copyToClipboard(content: String, label: Int) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 4f9b371e5a..3ff5a547fa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -94,6 +94,7 @@ import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.ui.source.SourceController +import eu.kanade.tachiyomi.ui.source.global_search.SourceSearchController import eu.kanade.tachiyomi.ui.webview.WebViewActivity import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.system.ThemeUtil @@ -116,6 +117,7 @@ import eu.kanade.tachiyomi.util.view.show import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updatePaddingRelative +import eu.kanade.tachiyomi.util.view.withFadeTransaction import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.manga_details_controller.* import kotlinx.android.synthetic.main.manga_header_item.* @@ -1106,6 +1108,10 @@ class MangaDetailsController : BaseController, } } + override fun globalSearch(text: String) { + router.pushController(SourceSearchController(text).withFadeTransaction()) + } + override fun showChapterFilter() { ChaptersSortBottomSheet(this).show() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt index c34f811ae8..598d5d550a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt @@ -40,8 +40,8 @@ class MangaHeaderHolder( isTablet: Boolean = false ) : BaseFlexibleViewHolder(view, adapter) { - var showReadingButton = true - var showMoreButton = true + private var showReadingButton = true + private var showMoreButton = true init { chapter_layout.setOnClickListener { adapter.delegate.showChapterFilter() } @@ -80,7 +80,7 @@ class MangaHeaderHolder( true } title.setOnClickListener { - title.maxLines = Integer.MAX_VALUE + title.text?.let { adapter.delegate.globalSearch(it.toString()) } } title.setOnLongClickListener { adapter.delegate.copyToClipboard(title.text.toString(), R.string.title) @@ -109,6 +109,7 @@ class MangaHeaderHolder( manga_genres_tags.visible() less_button.visible() more_button_group.gone() + title.maxLines = Integer.MAX_VALUE } } @@ -119,6 +120,7 @@ class MangaHeaderHolder( manga_genres_tags.gone() less_button.gone() more_button_group.visible() + title.maxLines = 4 adapter.recyclerView.post { adapter.delegate.updateScroll() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/SourceSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/SourceSearchController.kt index d42232c48b..f10add9fbf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/SourceSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/global_search/SourceSearchController.kt @@ -14,9 +14,10 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController -import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener -import eu.kanade.tachiyomi.util.view.applyWindowInsetsForController +import eu.kanade.tachiyomi.util.view.scrollViewWith +import eu.kanade.tachiyomi.util.view.updatePaddingRelative import eu.kanade.tachiyomi.util.view.withFadeTransaction +import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.source_global_search_controller.* /** @@ -136,14 +137,17 @@ open class SourceSearchController( */ override fun onViewCreated(view: View) { super.onViewCreated(view) - view.applyWindowInsetsForController() - adapter = SourceSearchAdapter(this) + recycler.updatePaddingRelative( + top = (activity?.toolbar?.height ?: 0) + + (activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0) + ) + // Create recycler and set adapter. recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) recycler.adapter = adapter - recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) + scrollViewWith(recycler, padBottom = true) if (extensionFilter != null) { customTitle = view.context?.getString(R.string.loading) setTitle() diff --git a/app/src/main/res/layout/source_global_search_controller.xml b/app/src/main/res/layout/source_global_search_controller.xml index ed738ba4e9..52e6d69b89 100644 --- a/app/src/main/res/layout/source_global_search_controller.xml +++ b/app/src/main/res/layout/source_global_search_controller.xml @@ -2,7 +2,6 @@