Improve thumbnails bs
parent
05ffc145be
commit
150699f64d
@ -0,0 +1,21 @@
|
||||
package org.koitharu.kotatsu.utils
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class RecyclerViewScrollCallback(recyclerView: RecyclerView, private val position: Int) : Runnable {
|
||||
|
||||
private val recyclerViewRef = WeakReference(recyclerView)
|
||||
|
||||
override fun run() {
|
||||
val rv = recyclerViewRef.get() ?: return
|
||||
val lm = rv.layoutManager ?: return
|
||||
rv.stopScroll()
|
||||
if (lm is LinearLayoutManager) {
|
||||
lm.scrollToPositionWithOffset(position, 0)
|
||||
} else {
|
||||
lm.scrollToPosition(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package org.koitharu.kotatsu.utils
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class ScrollResetCallback(recyclerView: RecyclerView) : Runnable {
|
||||
|
||||
private val recyclerViewRef = WeakReference(recyclerView)
|
||||
|
||||
override fun run() {
|
||||
recyclerViewRef.get()?.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="?colorBackgroundFloating" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="?colorOutline" />
|
||||
<padding
|
||||
android:bottom="2dp"
|
||||
android:left="2dp"
|
||||
android:right="2dp"
|
||||
android:top="2dp" />
|
||||
</shape>
|
||||
Loading…
Reference in New Issue