2018-08-28

2018-08-28  本文已影响0人  Run_4729

RxScreenshotDetector

Android screenshot detector with ContentObserver and Rx.

Note that this library only work as best effort, it won't (and can't I think) cover all corner cases. Good luck with it :)

ScreenShot

[图片上传失败...(image-cfbd3f-1535470492042)]

Usage

Add to gradle dependency of your module build.gradle:

repositories {
    maven {
        url  "http://dl.bintray.com/piasy/maven"
    }
}

dependencies {
    compile 'com.github.piasy:rxscreenshotdetector:1.2.0'
}

Use in code:

RxScreenshotDetector.start(this)
        .compose(bindToLifecycle())
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(path -> mTextView.setText(mTextView.getText() + "\nScreenshot: " + path),
                Throwable::printStackTrace);

To use with RxJava 1.x, see RxJava2Interop.

See full example for more details.

Acknowledgements

上一篇 下一篇

猜你喜欢

热点阅读