Git Product home page Git Product logo

stateful.livedata's Introduction

StatefulLiveData

辅助android开发者在中间层向view层传递数据和状态的LiveData,可扩展普通的LiveData为StatefulLiveData。

当前最新版本号:

特性

  • 辅助android开发者在中间层向view层传递数据和状态的LiveData。

  • kotlin协程项目推荐使用

  • 不用考虑在中间层切线程,直接通过postValue方法把数据提交到StatefulLiveData中,观察StatefulLiveData的View层代码会自动切换到主线程处理数据。

  • 在子线程中发生的异常会提交到StatefulLiveData中,由view层进行详尽的分析与处理。

  • 子线程可以随时将自己处理数据的进度与状态提交到StatefulLiveData中,view层可及时做出响应。

  • 在任意一个LiveData上通过toStateful()扩展方法为升级为一个新的StatefulLiveData实例,原LiveData的新数据会通过StatefulLiveDataonSuccess方法响应。

  • 详细用法参考: 掘金-关于LiveData的最佳使用方法

引入

  1. 在你的android工程的根目录下的build.gradle文件中的适当的位置添加以下代码:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. 在你的android工程中对应的android模块的build.gradle文件中的适当位置添加以下代码:
implementation 'cn.numeron:stateful.livedata:latest_version'

stateful.livedata's People

Contributors

xiazunyang avatar

Watchers

 avatar

Forkers

vovien

stateful.livedata's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.