Skip to content

Commit e7d1c18

Browse files
author
Dev_Wang
committed
reade me 待续
1 parent 915fb38 commit e7d1c18

File tree

4 files changed

+74
-1
lines changed

4 files changed

+74
-1
lines changed

README.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,74 @@
1-
# PureMVC_AppFacade_Android
1+
# PureMVC_AppFacade_Android
2+
3+
#####<font color="#272727" size = "3px">这是库是一个轻量级MVC为Android软件从头开始架构的,特点是轻、解耦、模块化,业务分离,简单实用</font>
4+
5+
#####<font color="#4590a3" size = "3px">This library is a lightweight MVC architecture for Android software from the ground up, featuring light, decoupling, modular, business separation, simple and practical.</font>
6+
7+
#####<font color="#272727" size = "3px">该库的设计主要有 Facade、Observer等,以及热插拔特性,充分给了我开发者注重业务开发逻辑注意力,而不用在意逻辑的分离与耦合</font>
8+
9+
#####<font color="#4590a3" size = "3px">The design of the library are Facade, Observer, etc., and hot-swap features, and give me the full attention of developers focus on business development logic, rather than care about the separation and coupling logic.</font>
10+
11+
####<font color="#000000" size = "6px">Usage:</font>
12+
#####<font color="#4590a3" size = "4px">第一步 初始化自定义模块控制类:用于注册模块和解注册模块</font>
13+
14+
#### <a name="AppModuleController">AppModuleController:</a>
15+
######初始化和创建 <font color="#4590a3" size = "3px">AppModuleController</font>, 它继承自 <font color="#4590a3" size = "3px">Controller</font>
16+
```
17+
public class AppModuleController extends Controller {
18+
@Override
19+
public void registerAllModules() {
20+
super.registerAllModules();
21+
//这里注册对应模块
22+
this.addOnceModuleClass(RunsUserLoginModule.class);
23+
this.addOnceModuleClass(RunsHomePageModule.class);
24+
}
25+
26+
@Override
27+
public void unRegisterAllModules() {
28+
super.unRegisterAllModules();
29+
//这里解注册对应模块(最好位置与注册对应)
30+
this.removeModule(RunsUserLoginModule.class.getName());
31+
this.removeModule(RunsHomePageModule.class.getName());
32+
}
33+
}
34+
```
35+
```
36+
public class MainActivity extends AppCompatActivity {
37+
private ActivityMainBinding activityMainBinding = null;
38+
public MainActivity() {
39+
super();
40+
//初始化调用 注册模块到模块管理类
41+
Facade.getInstance().init(new AppModuleController());
42+
}
43+
}
44+
```
45+
46+
#####<font color="#4590a3" size = "4px">第二步 创建模块文件夹目录(如图)</font>
47+
48+
######至于每个模块分别是什么职责一目了然
49+
50+
![F04F6A3FB1343515D617810B1681E63F.jpg](./puremvc_appfacade/image/F04F6A3FB1343515D617810B1681E63F.jpg)
51+
52+
![QQ20170206-120213.png](./puremvc_appfacade/image/QQ20170206-120213.png)
53+
54+
#####<font color="#4590a3" size = "4px">第三步 创建对应的功能模块,比如登录、主页等</font>
55+
#### <a name="RunsUserLoginModule">RunsUserLoginModule</a>
56+
######初始化和创建 <font color="#4590a3" size = "3px">RunsUserLoginModule</font>, 它继承自 <font color="#4590a3" size = "3px">Module</font>, 注册该模块需要的<font color="#4590a3" size = "3px">Mediator,ViewModel</font>, 以及移除解注册.
57+
```
58+
public class RunsUserLoginModule extends Module {
59+
60+
@Override
61+
public void onRegister() {
62+
this.registerMediatorClass(RunsUserLoginMediator.class);
63+
this.registerMediatorClass(RunsUserRegisterMediator.class);
64+
//
65+
this.registerViewModelClass(RunsUserLoginViewModel.class);
66+
}
67+
68+
@Override
69+
public void onRemove() {
70+
this.removeAllMediator();
71+
this.removeAllViewModel();
72+
}
73+
}
74+
```
181 KB
Loading
22.3 KB
Loading
42.2 KB
Loading

0 commit comments

Comments
 (0)