mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 12:21:51 +01:00
Automatic newest chapter placement on recently read to manga chapters
This commit is contained in:
parent
8936138da5
commit
28a4f0e237
@ -43,6 +43,6 @@ class RecentlyReadAdapter(controller: RecentlyReadController)
|
||||
}
|
||||
|
||||
interface OnCoverClickListener {
|
||||
fun onCoverClick(position: Int)
|
||||
fun onCoverClick(position: Int, lastTouchY: Float)
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +102,9 @@ class RecentlyReadController : NucleusController<RecentlyReadPresenter>(),
|
||||
RemoveHistoryDialog(this, manga, history).showDialog(router)
|
||||
}
|
||||
|
||||
override fun onCoverClick(position: Int) {
|
||||
override fun onCoverClick(position: Int, lastTouchY: Float) {
|
||||
val manga = adapter?.getItem(position)?.mch?.manga ?: return
|
||||
router.pushController(MangaController(manga).withFadeTransaction())
|
||||
router.pushController(MangaController(manga, lastTouchY).withFadeTransaction())
|
||||
}
|
||||
|
||||
override fun removeHistory(manga: Manga, history: History, all: Boolean) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.recently_read
|
||||
|
||||
import android.os.Build
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import eu.kanade.tachiyomi.R
|
||||
@ -8,6 +10,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
|
||||
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
|
||||
import kotlinx.android.synthetic.main.recently_read_item.*
|
||||
import java.util.Date
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* Holder that contains recent manga item
|
||||
@ -23,6 +26,7 @@ class RecentlyReadHolder(
|
||||
val adapter: RecentlyReadAdapter
|
||||
) : BaseFlexibleViewHolder(view, adapter) {
|
||||
|
||||
private var lastTouchUpY = 0f
|
||||
init {
|
||||
remove.setOnClickListener {
|
||||
adapter.removeClickListener.onRemoveClick(adapterPosition)
|
||||
@ -33,7 +37,17 @@ class RecentlyReadHolder(
|
||||
}
|
||||
|
||||
cover.setOnClickListener {
|
||||
adapter.coverClickListener.onCoverClick(adapterPosition)
|
||||
adapter.coverClickListener.onCoverClick(adapterPosition, lastTouchUpY)
|
||||
}
|
||||
cover.setOnTouchListener { v, event ->
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val topH = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
v.rootWindowInsets.systemWindowInsetTop else 38
|
||||
lastTouchUpY = max(topH + 175f, event.rawY - topH - 154f)
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user