jakubkinst / Android-ViewModelBinding

A lightweight library aiming to speed up Android app development by leveraging the new Android Data Binding together with the Model-View-ViewModel design pattern.
294 stars 32 forks source link

Usage with Fragment? Enhancement tips. #15

Open zayo opened 8 years ago

zayo commented 8 years ago

I like to use these VM, but there is some use cases where it is hard to use IT.

For example: Activity -> Fragment -> VM -> ViewPager

If i want to have Fragments in ViewPager i have to use childFragmentManager(), it is accessible from Fragment, but not from VM. Also if i have VM i could get parent activity, but not parent Fragment. When i got tablet application, i would use fragments. Of course i want to use arguments for fragments. But i cannot obtain them from VM directly, especialy in onViewAttached, where I should. How to deal with this problems? Will it be fixed?

Another Enhancement question: Why is BaseActivity extends AppCompatActivity, but BaseViewModel getActivity() returns Activity?

I am not fully familiar with pull request, so that is the reason why i write here, instead of code. Thanks