Misc fixes
This commit is contained in:
@@ -12,8 +12,8 @@ abstract class HistoryDao {
|
||||
* @hide
|
||||
*/
|
||||
@Transaction
|
||||
@Query("SELECT * FROM history ORDER BY :orderBy LIMIT :limit OFFSET :offset")
|
||||
abstract suspend fun findAll(offset: Int, limit: Int, orderBy: String): List<HistoryWithManga>
|
||||
@Query("SELECT * FROM history ORDER BY updated_at DESC LIMIT :limit OFFSET :offset")
|
||||
abstract suspend fun findAll(offset: Int, limit: Int): List<HistoryWithManga>
|
||||
|
||||
@Query("SELECT * FROM history WHERE manga_id = :id")
|
||||
abstract suspend fun find(id: Long): HistoryEntity?
|
||||
|
||||
@@ -17,7 +17,7 @@ class HistoryRepository : KoinComponent {
|
||||
private val db: MangaDatabase by inject()
|
||||
|
||||
suspend fun getList(offset: Int): List<Manga> {
|
||||
val entities = db.historyDao().findAll(offset, 20, "updated_at DESC")
|
||||
val entities = db.historyDao().findAll(offset, 20)
|
||||
return entities.map { it.manga.toManga(it.tags.map(TagEntity::toMangaTag).toSet()) }
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class MangaDetailsFragment : BaseFragment(R.layout.fragment_details), MangaDetai
|
||||
button_read.setText(R.string.read)
|
||||
button_read.setIconResource(R.drawable.ic_read)
|
||||
} else {
|
||||
button_read.setText(R.string.continue_)
|
||||
button_read.setText(R.string._continue)
|
||||
button_read.setIconResource(R.drawable.ic_play)
|
||||
}
|
||||
button_read.setOnClickListener {
|
||||
|
||||
@@ -19,6 +19,9 @@ class WebtoonFrameLayout @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun dispatchVerticalScroll(dy: Int): Int {
|
||||
if (!target.isImageLoaded) {
|
||||
return dy //consume all scrolling
|
||||
}
|
||||
target.getPanRemaining(pan)
|
||||
val c = target.center ?: return 0
|
||||
val s = target.scale
|
||||
|
||||
@@ -11,6 +11,7 @@ class GridTouchHelper(context: Context, private val listener: OnGridTouchListene
|
||||
private val detector = GestureDetector(context, this)
|
||||
private val width = context.resources.displayMetrics.widthPixels
|
||||
private val height = context.resources.displayMetrics.heightPixels
|
||||
private var isDispatching = false
|
||||
|
||||
init {
|
||||
detector.setIsLongpressEnabled(false)
|
||||
@@ -18,12 +19,15 @@ class GridTouchHelper(context: Context, private val listener: OnGridTouchListene
|
||||
}
|
||||
|
||||
fun dispatchTouchEvent(event: MotionEvent) {
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
isDispatching = listener.onProcessTouch(event.rawX.toInt(), event.rawY.toInt())
|
||||
}
|
||||
detector.onTouchEvent(event)
|
||||
}
|
||||
|
||||
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
|
||||
if (!listener.onProcessTouch(event.rawX.toInt(), event.rawY.toInt())) {
|
||||
return false
|
||||
if (!isDispatching) {
|
||||
return true
|
||||
}
|
||||
val xIndex = (event.rawX * 2f / width).roundToInt()
|
||||
val yIndex = (event.rawY * 2f / height).roundToInt()
|
||||
|
||||
Reference in New Issue
Block a user