ragdroid / dahaka Goto Github PK
View Code? Open in Web Editor NEWDemo project for Dagger 2
License: Apache License 2.0
Demo project for Dagger 2
License: Apache License 2.0
Great example, but is that correct to inject the activityInjector() from user manager in the application class.
@Override
public AndroidInjector<Activity> activityInjector() {
return userManager.activityInjector();
}
In case of multiple sub components, should we not use the injector from the manager which built the component for that scoped activity. In this example login should have used the application component injector and the home activity could use the android injector from user manager.
We need new presenter on every activity creation anyways. If it is to handle activity recreation then the associated component will also be recreated which in turns results in new presenter object.
public class ProfileFragment extends BaseFragment<ProfileContract.Presenter> implements ProfileContract.View {
@Inject
public ProfileFragment() {
// Required empty public constructor for Injection
}
private FragmentProfileBinding dataBinding;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_profile, container, false);
dataBinding = DataBindingUtil.bind(view);
return view;
}
@Override
public void showModel(ProfileModel model) {
dataBinding.setModel(model);
}
}
The official document does not say that this construction method needs to be added.
Can you explain it for me? thanks!
It is a pretty useful project but switching branch can be a lot of effort. Why not just use different gradle submodules to demo different part of projects?
Hi. I found a problem with Presenter's instances count.
After screen rotation, ProfilePresenter's constructor invoked three times. Also ProfileFragment.onCreateView() invoked at least two times.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.