Misc fixes

This commit is contained in:
Koitharu
2020-03-07 13:01:10 +02:00
parent 7478c8c106
commit 4a4c7108cb
8 changed files with 20 additions and 8 deletions

View File

@@ -12,8 +12,8 @@ abstract class HistoryDao {
* @hide * @hide
*/ */
@Transaction @Transaction
@Query("SELECT * FROM history ORDER BY :orderBy LIMIT :limit OFFSET :offset") @Query("SELECT * FROM history ORDER BY updated_at DESC LIMIT :limit OFFSET :offset")
abstract suspend fun findAll(offset: Int, limit: Int, orderBy: String): List<HistoryWithManga> abstract suspend fun findAll(offset: Int, limit: Int): List<HistoryWithManga>
@Query("SELECT * FROM history WHERE manga_id = :id") @Query("SELECT * FROM history WHERE manga_id = :id")
abstract suspend fun find(id: Long): HistoryEntity? abstract suspend fun find(id: Long): HistoryEntity?

View File

@@ -17,7 +17,7 @@ class HistoryRepository : KoinComponent {
private val db: MangaDatabase by inject() private val db: MangaDatabase by inject()
suspend fun getList(offset: Int): List<Manga> { 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()) } return entities.map { it.manga.toManga(it.tags.map(TagEntity::toMangaTag).toSet()) }
} }

View File

@@ -95,7 +95,7 @@ class MangaDetailsFragment : BaseFragment(R.layout.fragment_details), MangaDetai
button_read.setText(R.string.read) button_read.setText(R.string.read)
button_read.setIconResource(R.drawable.ic_read) button_read.setIconResource(R.drawable.ic_read)
} else { } else {
button_read.setText(R.string.continue_) button_read.setText(R.string._continue)
button_read.setIconResource(R.drawable.ic_play) button_read.setIconResource(R.drawable.ic_play)
} }
button_read.setOnClickListener { button_read.setOnClickListener {

View File

@@ -19,6 +19,9 @@ class WebtoonFrameLayout @JvmOverloads constructor(
} }
fun dispatchVerticalScroll(dy: Int): Int { fun dispatchVerticalScroll(dy: Int): Int {
if (!target.isImageLoaded) {
return dy //consume all scrolling
}
target.getPanRemaining(pan) target.getPanRemaining(pan)
val c = target.center ?: return 0 val c = target.center ?: return 0
val s = target.scale val s = target.scale

View File

@@ -11,6 +11,7 @@ class GridTouchHelper(context: Context, private val listener: OnGridTouchListene
private val detector = GestureDetector(context, this) private val detector = GestureDetector(context, this)
private val width = context.resources.displayMetrics.widthPixels private val width = context.resources.displayMetrics.widthPixels
private val height = context.resources.displayMetrics.heightPixels private val height = context.resources.displayMetrics.heightPixels
private var isDispatching = false
init { init {
detector.setIsLongpressEnabled(false) detector.setIsLongpressEnabled(false)
@@ -18,12 +19,15 @@ class GridTouchHelper(context: Context, private val listener: OnGridTouchListene
} }
fun dispatchTouchEvent(event: MotionEvent) { fun dispatchTouchEvent(event: MotionEvent) {
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
isDispatching = listener.onProcessTouch(event.rawX.toInt(), event.rawY.toInt())
}
detector.onTouchEvent(event) detector.onTouchEvent(event)
} }
override fun onSingleTapConfirmed(event: MotionEvent): Boolean { override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
if (!listener.onProcessTouch(event.rawX.toInt(), event.rawY.toInt())) { if (!isDispatching) {
return false return true
} }
val xIndex = (event.rawX * 2f / width).roundToInt() val xIndex = (event.rawX * 2f / width).roundToInt()
val yIndex = (event.rawY * 2f / height).roundToInt() val yIndex = (event.rawY * 2f / height).roundToInt()

View File

@@ -69,6 +69,7 @@
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:enabled="false" android:enabled="false"
android:text="@string/read" android:text="@string/read"
tools:text="@string/_continue"
app:icon="@drawable/ic_read" app:icon="@drawable/ic_read"
app:iconPadding="12dp" app:iconPadding="12dp"
app:layout_constraintBottom_toBottomOf="@id/imageView_cover" app:layout_constraintBottom_toBottomOf="@id/imageView_cover"
@@ -87,8 +88,10 @@
android:src="@drawable/ic_tag_heart_outline" android:src="@drawable/ic_tag_heart_outline"
app:layout_constraintBottom_toBottomOf="@id/button_read" app:layout_constraintBottom_toBottomOf="@id/button_read"
app:layout_constraintDimensionRatio="1:1" app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintEnd_toStartOf="@id/button_read" app:layout_constraintEnd_toStartOf="@id/button_read"
app:layout_constraintTop_toTopOf="@id/button_read" app:layout_constraintTop_toTopOf="@id/button_read"
app:layout_constraintStart_toStartOf="@id/textView_title"
app:tint="?colorAccent" /> app:tint="?colorAccent" />
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.Barrier

View File

@@ -22,7 +22,6 @@
<string name="nothing_found">Ничего не найдено</string> <string name="nothing_found">Ничего не найдено</string>
<string name="history_is_empty">История пуста</string> <string name="history_is_empty">История пуста</string>
<string name="read">Читать</string> <string name="read">Читать</string>
<string name="continue_">Продолжить</string>
<string name="add_bookmark">Добавить закладку</string> <string name="add_bookmark">Добавить закладку</string>
<string name="you_have_not_favourites_yet">У Вас пока нет избранной манги</string> <string name="you_have_not_favourites_yet">У Вас пока нет избранной манги</string>
<string name="add_to_favourites">Добавить в избранное</string> <string name="add_to_favourites">Добавить в избранное</string>
@@ -90,4 +89,8 @@
<string name="switch_pages">Листание страниц</string> <string name="switch_pages">Листание страниц</string>
<string name="taps_on_edges">Нажатия по краям</string> <string name="taps_on_edges">Нажатия по краям</string>
<string name="volume_buttons">Кнопки громкости</string> <string name="volume_buttons">Кнопки громкости</string>
<string name="_continue">Продолжить</string>
<string name="warning">Предупреждение</string>
<string name="network_consumption_warning">Данная операция может привести к большому расходу траффика</string>
<string name="dont_ask_again">Больше не спрашивать</string>
</resources> </resources>

View File

@@ -23,7 +23,6 @@
<string name="nothing_found">Nothing found</string> <string name="nothing_found">Nothing found</string>
<string name="history_is_empty">History is empty</string> <string name="history_is_empty">History is empty</string>
<string name="read">Read</string> <string name="read">Read</string>
<string name="continue_">Continue</string>
<string name="add_bookmark">Add bookmark</string> <string name="add_bookmark">Add bookmark</string>
<string name="you_have_not_favourites_yet">You have not favourites yet</string> <string name="you_have_not_favourites_yet">You have not favourites yet</string>
<string name="add_to_favourites">Add to favourites</string> <string name="add_to_favourites">Add to favourites</string>