一个MVP架构利器。自动生成接口文件,且不需要实现接口。
- View层使用@MvpView注解,标注为view。
- Presenter层使用@MvpView注解,标注为presenter。
- 使用@ExtractItf注解标注方法,此方法将会被抽取到接口中。
dependencies {
implementation 'com.linuxpara:edgemvp:1.0.4'
annotationProcessor 'com.linuxpara:edgemvp-complier:1.0.4'
}
-
@MvpView使用
-
@MvpPresenter使用
-
view层中创建presenter对象。
private ILoginPresenter mPresenter; ..... mPresenter = EdgeMvp.createPresenter(this); mPresenter.login("test", "12345");
-
presenter层中获取view对象。
((ILoginView) EdgeMvp.getViewProxy(LoginPresenter.this));
- 注解标注完,需要编译才能生成生成需要的文件。
- createPresenter()、getViewProxy()需要生成代码后,调用才会有效,并且需要强转。
该项目还存在不足的地方,各位大神有什么好的想法或者建议,望不吝赐教。
最后,都看这里了,给点个星呗。(^∀^)
Email: zhanyang.chen@gmail.com
Licensed 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://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed 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 and
limitations under the License.