mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Fixes to tracking sheet
Fix back button for A13+ fix keyboard not moving the sheet (as well as others Fixed #1576
This commit is contained in:
parent
60fcbcc2a3
commit
f3f8190bfa
3 changed files with 18 additions and 3 deletions
|
@ -22,7 +22,7 @@ class TrackSearchItem(val trackSearch: TrackSearch) : AbstractItem<TrackSearchIt
|
|||
* Returns the layout resource for this item.
|
||||
*/
|
||||
override val layoutRes: Int = R.layout.track_search_item
|
||||
override var identifier = trackSearch.media_id.toLong()
|
||||
override var identifier = trackSearch.media_id
|
||||
|
||||
override fun getViewHolder(v: View): ViewHolder {
|
||||
return ViewHolder(v)
|
||||
|
@ -47,7 +47,9 @@ class TrackSearchItem(val trackSearch: TrackSearch) : AbstractItem<TrackSearchIt
|
|||
binding.trackSearchSummary.isVisible = track.summary.isNotBlank()
|
||||
binding.trackSearchCover.dispose()
|
||||
if (track.cover_url.isNotEmpty()) {
|
||||
binding.trackSearchCover.load(track.cover_url)
|
||||
binding.trackSearchCover.load(track.cover_url) {
|
||||
allowHardware(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (track.publishing_status.isBlank()) {
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.view.ViewGroup
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
@ -82,6 +83,14 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
|
||||
override var recyclerView: RecyclerView? = binding.trackRecycler
|
||||
|
||||
private val backCallback = object : OnBackPressedCallback(enabled = false) {
|
||||
override fun handleOnBackPressed() {
|
||||
if (searchingItem != null) {
|
||||
hideSearchView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
val insets = activity.window.decorView.rootWindowInsetsCompat?.getInsets(systemBars())
|
||||
val height = insets?.bottom ?: 0
|
||||
|
@ -90,7 +99,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
sheetBehavior.skipCollapsed = true
|
||||
|
||||
binding.searchCloseButton.setOnClickListener {
|
||||
onBackPressed()
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
binding.trackSearchRecycler.adapter = adapter
|
||||
|
@ -99,6 +108,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
trackItem(position)
|
||||
true
|
||||
}
|
||||
onBackPressedDispatcher.addCallback(backCallback)
|
||||
|
||||
searchAdapter.addClickListener<TrackSearchItem.ViewHolder, TrackSearchItem>({ it.binding.linkButton }) { _, _, _, item ->
|
||||
activity.openInBrowser(item.trackSearch.tracking_url)
|
||||
|
@ -248,6 +258,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
|
||||
private fun showSearchView(item: TrackItem) {
|
||||
searchingItem = item
|
||||
backCallback.isEnabled = true
|
||||
val title = presenter.manga.title
|
||||
sheetBehavior.expand()
|
||||
sheetBehavior.isDraggable = false
|
||||
|
@ -265,6 +276,7 @@ class TrackingBottomSheet(private val controller: MangaDetailsController) :
|
|||
binding.trackRecycler.isVisible = true
|
||||
binding.trackSearchConstraintLayout.isVisible = false
|
||||
searchingItem = null
|
||||
backCallback.isEnabled = false
|
||||
}
|
||||
|
||||
private fun search(query: String) {
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
|
||||
<style name="BottomSheetDialogTheme" parent="@style/ThemeOverlay.Material3.BottomSheetDialog">
|
||||
<item name="bottomSheetStyle">@style/BottomSheet.Modal</item>
|
||||
<item name="android:windowSoftInputMode">adjustPan</item>
|
||||
</style>
|
||||
|
||||
<style name="BottomSheet.Modal" parent="Widget.Material3.BottomSheet.Modal">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue