2018-08-28

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

  • Thanks for RxPermissions, for request permission in reactive way.
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,448评论 0 10
  • 很喜欢这样的情景 一盘花生 一杯小酒 两个知心朋友 不是在酒店里觥筹交错 而是在阳台上自斟自饮 一米阳光 一...
    妙鑫乖乖阅读 165评论 1 2
  • 午后秋日的阳光洒满大地,那种暖洋洋的感觉让我想起了我还在村子里的秋天,每年到了这个时间家里的房子的台阶上都堆满了妈...
    启恒数码阅读 183评论 0 0
  • 27岁的你如果还没学会选择,也没学会说“NO”,那么请别抱怨你生活的不如意! 2017年农历八月,27岁零3个月的...
    暖暖一叶舟阅读 162评论 0 0
  • 星期一 晴 每日一我 天蓝云白,太阳明晃晃的透着灿烂。 中午去上尊巴课,身体休息了两天有点乏。 晚上炖牛肚,黄喉,...
    sophietyl阅读 104评论 0 0