Added global search back to tapping the title in manga details

This commit is contained in:
Jay 2020-05-02 13:25:30 -04:00
parent ea88c254b9
commit bf72af57a7
5 changed files with 21 additions and 9 deletions

View File

@ -130,6 +130,7 @@ class MangaDetailsAdapter(
fun readNextChapter() fun readNextChapter()
fun topCoverHeight(): Int fun topCoverHeight(): Int
fun tagClicked(text: String) fun tagClicked(text: String)
fun globalSearch(text: String)
fun showChapterFilter() fun showChapterFilter()
fun favoriteManga(longPress: Boolean) fun favoriteManga(longPress: Boolean)
fun copyToClipboard(content: String, label: Int) fun copyToClipboard(content: String, label: Int)

View File

@ -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.reader.ReaderActivity
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
import eu.kanade.tachiyomi.ui.source.SourceController 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.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.storage.getUriCompat import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.ThemeUtil 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.snack
import eu.kanade.tachiyomi.util.view.updateLayoutParams import eu.kanade.tachiyomi.util.view.updateLayoutParams
import eu.kanade.tachiyomi.util.view.updatePaddingRelative 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.main_activity.*
import kotlinx.android.synthetic.main.manga_details_controller.* import kotlinx.android.synthetic.main.manga_details_controller.*
import kotlinx.android.synthetic.main.manga_header_item.* 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() { override fun showChapterFilter() {
ChaptersSortBottomSheet(this).show() ChaptersSortBottomSheet(this).show()
} }

View File

@ -40,8 +40,8 @@ class MangaHeaderHolder(
isTablet: Boolean = false isTablet: Boolean = false
) : BaseFlexibleViewHolder(view, adapter) { ) : BaseFlexibleViewHolder(view, adapter) {
var showReadingButton = true private var showReadingButton = true
var showMoreButton = true private var showMoreButton = true
init { init {
chapter_layout.setOnClickListener { adapter.delegate.showChapterFilter() } chapter_layout.setOnClickListener { adapter.delegate.showChapterFilter() }
@ -80,7 +80,7 @@ class MangaHeaderHolder(
true true
} }
title.setOnClickListener { title.setOnClickListener {
title.maxLines = Integer.MAX_VALUE title.text?.let { adapter.delegate.globalSearch(it.toString()) }
} }
title.setOnLongClickListener { title.setOnLongClickListener {
adapter.delegate.copyToClipboard(title.text.toString(), R.string.title) adapter.delegate.copyToClipboard(title.text.toString(), R.string.title)
@ -109,6 +109,7 @@ class MangaHeaderHolder(
manga_genres_tags.visible() manga_genres_tags.visible()
less_button.visible() less_button.visible()
more_button_group.gone() more_button_group.gone()
title.maxLines = Integer.MAX_VALUE
} }
} }
@ -119,6 +120,7 @@ class MangaHeaderHolder(
manga_genres_tags.gone() manga_genres_tags.gone()
less_button.gone() less_button.gone()
more_button_group.visible() more_button_group.visible()
title.maxLines = 4
adapter.recyclerView.post { adapter.recyclerView.post {
adapter.delegate.updateScroll() adapter.delegate.updateScroll()
} }

View File

@ -14,9 +14,10 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.NucleusController
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener import eu.kanade.tachiyomi.util.view.scrollViewWith
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForController import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.util.view.withFadeTransaction import eu.kanade.tachiyomi.util.view.withFadeTransaction
import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.source_global_search_controller.* import kotlinx.android.synthetic.main.source_global_search_controller.*
/** /**
@ -136,14 +137,17 @@ open class SourceSearchController(
*/ */
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
view.applyWindowInsetsForController()
adapter = SourceSearchAdapter(this) adapter = SourceSearchAdapter(this)
recycler.updatePaddingRelative(
top = (activity?.toolbar?.height ?: 0) +
(activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0)
)
// Create recycler and set adapter. // Create recycler and set adapter.
recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
recycler.adapter = adapter recycler.adapter = adapter
recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) scrollViewWith(recycler, padBottom = true)
if (extensionFilter != null) { if (extensionFilter != null) {
customTitle = view.context?.getString(R.string.loading) customTitle = view.context?.getString(R.string.loading)
setTitle() setTitle()

View File

@ -2,7 +2,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView