Add databinding support
See original GitHub issueHi Márton,
First of all congratulations for your library, it is just a masterpiece that can save hundreds of hours to the community.
I’d like to suggest you to support in some way databinding on RainbowCakeFragment
. I’m using your library on some projects and I think It could be interesting to support this pattern.
I’ve solved it doing that on my project:
class MyFragment : RainbowCakeFragment<MyViewState, MyViewModel>() {
override fun getViewResource() = R.layout.my_fragment
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
super.onCreateView(inflater, container, savedInstanceState) // I'm forced to call super
binding = MyFragmentListBinding.inflate(inflater, container, false)
return binding.root
}
override fun render(viewState: MyViewState) {
TransitionManager.beginDelayedTransition(listFragmentRoot)
binding.viewState = viewState
}
}
As you can see it simplifies a lot the code on the Fragment side, moving the logic to the XML file. Maybe you can find a better way of allowing this on next versions of the library without having to override getViewResource()
method.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Data Binding Library - Android Developers
The Data Binding Library is a support library that allows you to bind UI components in your layouts to data sources in your...
Read more >Using data binding in Android - Tutorial - Vogella.com
Android offers support to write declarative layouts using data binding. This minimizes the necessary code in your application logic to connect to the...
Read more >Databinding Support - IntelliJ IDEA & Android Studio Plugin
Intellij plugin that support Android Data Binding Library. This plugin has following features: Convert non-databinding layout to databinding layout. Add ...
Read more >Applying Data Binding for Views | CodePath Android Cliffnotes
Android has now released a stable data-binding library which allows you to connect views with data in a much more powerful way than...
Read more >Add Android data binding support #2694 - bazelbuild/bazel
Update: After a discussion with @gregestren we've determined that we need to update the aar_import rule to handle the databinding metadata files ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s amazing @zsmb13! A million thanks for the update! 🔝
It’s working fine on 1.2.0. Closing the issue. 😄