question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add databinding support

See original GitHub issue

Hi 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jmpayacommented, Oct 30, 2020

That’s amazing @zsmb13! A million thanks for the update! 🔝

0reactions
jmpayacommented, Oct 30, 2020

It’s working fine on 1.2.0. Closing the issue. 😄

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found