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

父类@Autowared注解问题 #54

Closed
l511809934 opened this issue Feb 9, 2023 · 3 comments
Closed

父类@Autowared注解问题 #54

l511809934 opened this issue Feb 9, 2023 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@l511809934
Copy link

l511809934 commented Feb 9, 2023

该框架对单Activity模式项目不太友好。建议可以封装一下fragment相关路由。包括fragment栈管理。跳转传参返回等。

@l511809934 l511809934 changed the title @autowared不支持Fragment(@LayoutRes int contentLayoutId)构造 @Autowared不支持Fragment(@LayoutRes int contentLayoutId)构造 Feb 9, 2023
@kymjs
Copy link
Collaborator

kymjs commented Feb 9, 2023

  1. fragment是指单Activity吗?个人不推荐单Activity模式开发,低内存时的回收和生命周期管理极易错乱。如果使用,也建议使用androidx提供的NavigationFragmentFactory来统一管理。
  2. Fragment(int)也支持@Autowared的,在FragmentonViewCreated()中调用TheRouter.inject(this)即可。

@kymjs kymjs added the help wanted Extra attention is needed label Feb 9, 2023
@l511809934
Copy link
Author

父类fragment使用@Autowared接受公共字段接受不到。或者说子类获取不到父类定义的@Autowared字段,只能自己重新定义注解接受@kymjs

@l511809934 l511809934 changed the title @Autowared不支持Fragment(@LayoutRes int contentLayoutId)构造 父类@Autowared注解问题 Feb 9, 2023
@kymjs
Copy link
Collaborator

kymjs commented Feb 9, 2023

参考 #49

@kymjs kymjs closed this as completed Feb 9, 2023
@kymjs kymjs added duplicate This issue or pull request already exists and removed help wanted Extra attention is needed labels Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants