Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

还有疑问 #48

Closed
weinierfei opened this issue Nov 28, 2017 · 1 comment
Closed

还有疑问 #48

weinierfei opened this issue Nov 28, 2017 · 1 comment

Comments

@weinierfei
Copy link

不好意思,我又来打扰了!
根据咱们的思路,进行项目的组件拆分;拆分的时候遇到了写不太明确的地方,再次提问:
1.某个组件中使用了第三方,需要将主module(app)的主Activity赋值给第三方(third.a=MainActivity.class),这个要怎么拆?(主app对外提供一个服务?如果是的话,主app的ApplicationLike怎么注册)?
2.项目中的数据库,怎么拆?(不同组件可能都会用的数据库,数据库用的greendao)

@mqzhangw
Copy link
Collaborator

1、如果必须这样是使用MainActivity,那只能是app通过服务提供出去,不过如果这种情况出现,是不是这个第三方库应该移到app中呢?主app是没有ApplicationLike的,它直接使用的就是Application,因为主app是在做上层的,只能是向下依赖其他组件,其他组件不能依赖app。所以这种情况下想调试组件,只能是将组件集成到app中来进行。
2、数据库建议封装成一个library库,沉到架构的底层。只有业务(有用户交互)的功能才抽成组件的形式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants