JS 与 trick 代码的运用及解析全攻略
692
2022-10-22
Slick使用的一个Reactive Android MVP框架
Slick
A Reactive Android MVP Framework which is Slick to use.
Slick how? see it yourself :)
No need to extend anything
public class YourActivity extends AppCompatActivity implements ViewActivity { @Presenter //<-- Just annotate your presenter YourPresenter presenter; @Override protected void onCreate(Bundle savedInstanceState) { //And call bind on the generated class with your presenter args YourPresenter_Slick.bind(this, 123, "foo"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_your); } @Override public showMessage(String message) { }}
The Presenter:
public class YourPresenter extends SlickPresenter
And a simple View interface, no need to extend anything
public interface ActivityView { void showMessage(String message);}
Other View types have the same logic, for more detailed instruction head to Wiki
Features:
Supports Activity, Fragment, CustomView, and Conductor ControllerNo dark magic involved, Just simple debuggable generated codeRetains Presenters in disposable, lifecycle-aware singletonsReactive support inspired by MVI and Elm architectureDo not need to extend any base class for your viewsEasily test presenters on JVM with junitUse multiple Presenter for one viewFully Type-safeDagger ready!
Reactive MVP Features:
Unidirectional Data Flow & Immutable ViewStateAutomatic subscription and disposing of Rxjava2 streams
public class YourPresenterUni extends SlickPresenterUni
For more detailed guide on Reactive Features read the Wiki
Downloads
Packages are available in jcenter
// Base featuresimplementation 'com.mrezanasirloo:slick:1.1.5'// Reactive featuresimplementation 'com.mrezanasirloo:slick-reactive:1.1.5'implementation 'com.mrezanasirloo:slick-conductor:1.1.5'implementation 'com.mrezanasirloo:slick-support-fragment:1.1.5'annotationProcessor 'com.mrezanasirloo:slick-compiler:1.1.5'
Since Slick packages are not tied to a specific dependency you need to provide them.
// Conductorimplementation 'com.bluelinelabs:conductor:2.x.y'// RxJava for Reactive Featuresimplementation 'io.reactivex.rxjava2:rxjava:2.x.y'
If you liked the project don't forget to start it ⭐ == ❤️
Licence
Copyright 2018. M. Reza NasirlooLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~