Created
February 11, 2018 16:11
-
-
Save zhEdward/ded48613de8711c8283d4241aa5c6dea to your computer and use it in GitHub Desktop.
use rxjava2 implement multiple clicks event detection
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
//triple clicks trigger toast git commit_id | |
Observable<Object> observable = RxView.clicks(stv_version).share(); | |
observable.buffer(observable.debounce(500, TimeUnit.MILLISECONDS)) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.compose(RxHelper.<List<Object>>lifeCycle(this)) | |
.subscribe(new Consumer<List<Object>>() { | |
@Override | |
public void accept(List<Object> objects) throws Exception { | |
if (objects.size() >= 3) { | |
new ToastView(OtherMoreActivity.this, BuildConfig.GIT_SHA).show(); | |
} | |
// ZLog.i(TAG, "accept:" + objects.size()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment