Skip to content

Piasy/RxComboDetector

Repository files navigation

RxComboDetector

Android view click combo detector with Rx.

ScreenShot

combo-demo.gif

Usage

Add to gradle dependency of your module build.gradle:

repositories {
    jcenter()
}

dependencies {
    compile 'com.github.piasy:rxcombodetector:1.1.0'
}

Use in code:

new RxComboDetector.Builder()
        .detectOn(mBtnCombo)
        .start()
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(new Consumer<Integer>() {
            @Override
            public void accept(Integer combo) throws Exception {
                mTextView.setText(mTextView.getText() + "Combo x " + combo + "\n");
                mScrollView.fullScroll(View.FOCUS_DOWN);
                mYOLOComboView.combo(combo);
            }
        });

See full example for more details.

Acknowledgements

  • ViewClickOnSubscribe and Preconditions classes are grabbed from RxBinding, to reduce dependencies of this library.
  • Thanks for rebound to let me make fancy animation.
  • Thanks for YOLO, the yellow smiling face.