Skip to content

Releases: derysudrajat/inline-view-binding

v1.0.1

15 Aug 05:57
Compare
Choose a tag to compare

Release new Inline ViewBinding

Easy use binding on Activity and Fragment

In Activity

class MainActivity : AppCompatActivity() {

    // just using delegate by view binding to and inflate your layout like this
    private val binding by viewBinding(ActivityMainBinding::inflate)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        // ... do your magic here
    } 
}

In Fragment

// extend your fragment class to BindingFragment with your generic layout
class SampleFragment : BindingFragment<FragmentSampleBinding>() {

    // just using delegate by view binding and inflate your layout like this
    override val binding by viewBinding(FragmentSampleBinding::inflate)

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        // ... do your magic here
    }

}

v1.0.0

15 Aug 04:04
Compare
Choose a tag to compare

Release new Inline ViewBinding

Easy use binding on Activity and Fragment

In Activity

class MainActivity : AppCompatActivity() {

    // just using delegate by view binding to and inflate your layout like this
    private val binding by viewBinding(ActivityMainBinding::inflate)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        // ... do your magic here
    } 
}

In Fragment

// extend your fragment class to BindingFragment with your generic layout
class SampleFragment : BindingFragment<FragmentSampleBinding>() {

    // just using delegate by view binding and inflate your layout like this
    override val binding by viewBinding(FragmentSampleBinding::inflate)

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        // ... do your magic here
    }

}