Fix appying webtoon pull gesture settings
This commit is contained in:
@@ -28,13 +28,21 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
||||
private var isFixingScroll = false
|
||||
|
||||
var isPullGestureEnabled: Boolean = false
|
||||
set(value) {
|
||||
if (field != value) {
|
||||
field = value
|
||||
setEdgeEffectFactory(
|
||||
if (value) {
|
||||
PullEffect.Factory()
|
||||
} else {
|
||||
EdgeEffectFactory()
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
var pullThreshold: Float = 0.3f
|
||||
private var pullListener: OnPullGestureListener? = null
|
||||
|
||||
init {
|
||||
setEdgeEffectFactory(PullEffect.Factory())
|
||||
}
|
||||
|
||||
fun setOnPullGestureListener(listener: OnPullGestureListener?) {
|
||||
pullListener = listener
|
||||
}
|
||||
@@ -248,7 +256,7 @@ class WebtoonRecyclerView @JvmOverloads constructor(
|
||||
|
||||
override fun createEdgeEffect(view: RecyclerView, direction: Int): EdgeEffect {
|
||||
val pullListener = (view as? WebtoonRecyclerView)?.pullListener
|
||||
return if (pullListener != null && view.isPullGestureEnabled) {
|
||||
return if (pullListener != null) {
|
||||
PullEffect(view, direction, view.pullThreshold, pullListener)
|
||||
} else {
|
||||
super.createEdgeEffect(view, direction)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2A10,10 0 1,0 22,12A10,10 0 0,0 12,2Z"
|
||||
android:strokeColor="@android:color/white"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="@android:color/transparent"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,7l-3,3h2v4h2v-4h2z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,17l3,-3h-2v-4h-2v4h-2z"/>
|
||||
</vector>
|
||||
11
app/src/main/res/drawable/ic_gesture_vertical.xml
Normal file
11
app/src/main/res/drawable/ic_gesture_vertical.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M4,3L1,6H3V9H1L4,12L7,9H5V6H7L4,3M11,8A1,1 0 0,0 10,9V19L6.8,17.28H6.58C6.3,17.28 6.03,17.39 5.84,17.6L5.1,18.37L10,22.57C10.26,22.85 10.62,23 11,23H17.5A1.5,1.5 0 0,0 19,21.5V17.14C19,16.56 18.68,16.03 18.15,15.79L13.21,13.6L12,13.47V9A1,1 0 0,0 11,8Z" />
|
||||
</vector>
|
||||
@@ -141,7 +141,7 @@
|
||||
android:text="@string/enable_pull_gesture_title"
|
||||
android:textAppearance="?textAppearanceListItem"
|
||||
android:textColor="?colorOnSurfaceVariant"
|
||||
app:drawableStartCompat="@drawable/ic_gesture" />
|
||||
app:drawableStartCompat="@drawable/ic_gesture_vertical" />
|
||||
|
||||
<org.koitharu.kotatsu.core.ui.widgets.ListItemTextView
|
||||
android:id="@+id/button_screen_rotate"
|
||||
|
||||
Reference in New Issue
Block a user