Skip to content

Commit 374a605

Browse files
committed
fix StateMachine error usage
1 parent ccfdea8 commit 374a605

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

ptr-lib/src/main/java/wtf/s1/android/ptr/NSPtrConfig.kt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,10 @@ interface NSPtrConfig {
1515
fun pullFriction(type: Int): Float = 0.56f
1616

1717
fun generateTouchReleaseEvent(): NSPtrLayout.Event? {
18-
return when (requireLayout().stateMachine.state) {
19-
is NSPtrLayout.State.DRAG -> {
20-
if (overToRefreshPosition()) {
21-
NSPtrLayout.Event.ReleaseToRefreshing
22-
} else {
23-
NSPtrLayout.Event.ReleaseToIdle
24-
}
25-
}
26-
is NSPtrLayout.State.REFRESHING -> {
27-
if (!overToRefreshPosition()) {
28-
NSPtrLayout.Event.ReleaseToIdle
29-
} else {
30-
null
31-
}
32-
}
33-
else -> null
18+
return if (overToRefreshPosition()) {
19+
NSPtrLayout.Event.ReleaseToRefreshing
20+
} else {
21+
NSPtrLayout.Event.ReleaseToIdle
3422
}
3523
}
3624

0 commit comments

Comments
 (0)