Last active
August 11, 2018 10:50
-
-
Save vorobeij/0592109d2f61dd18ab813570bf4bbe67 to your computer and use it in GitHub Desktop.
Swipe Refresh + OverScrollDecorator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
... | |
implementation 'me.everything:overscroll-decor-android:1.0.4' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/EverythingMe/overscroll-decor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import me.everything.android.ui.overscroll.IOverScrollState | |
import me.everything.android.ui.overscroll.OverScrollDecoratorHelper | |
OverScrollDecoratorHelper | |
.setUpOverScroll(list, OverScrollDecoratorHelper.ORIENTATION_VERTICAL).apply { | |
setOverScrollStateListener { decor, oldState, newState -> | |
when (newState) { | |
IOverScrollState.STATE_IDLE -> { | |
} | |
IOverScrollState.STATE_BOUNCE_BACK -> { | |
model.refresh() | |
} | |
IOverScrollState.STATE_DRAG_END_SIDE -> { | |
} | |
IOverScrollState.STATE_DRAG_START_SIDE -> { | |
swipe_refresh.isRefreshing=true | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment