We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VBActivity:
import android.os.Bundle import android.view.LayoutInflater import android.view.View import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.ViewModelProvider import dev.icerock.moko.mvvm.viewmodel.ViewModel abstract class VBActivity<VB : Any, VM : ViewModel> : AppCompatActivity() { protected lateinit var viewModel: VM protected lateinit var binding: VB protected abstract val viewModelClass: Class<VM> protected abstract fun viewModelFactory(): ViewModelProvider.Factory protected abstract fun viewBinding(layoutInflater: LayoutInflater): VB protected abstract fun VB.root(): View override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) viewModel = ViewModelProvider(this, viewModelFactory())[viewModelClass] binding = viewBinding(layoutInflater) setContentView(binding.root()) } }
VBEventsActivity:
import android.os.Bundle import dev.icerock.moko.mvvm.dispatcher.EventsDispatcherOwner import dev.icerock.moko.mvvm.viewmodel.ViewModel abstract class VBEventsActivity<VB : Any, VM, Listener : Any> : VBActivity<VB, VM>() where VM: ViewModel, VM : EventsDispatcherOwner<Listener> { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @Suppress("UNCHECKED_CAST") viewModel.eventsDispatcher.bind(this, this as Listener) } }
The text was updated successfully, but these errors were encountered:
#76 view binding base
aef1eb6
#76 android live data extensions for view binding support
d03fca7
#76 ios livedata binding api as on android
a06f7c8
Merge pull request #92 from icerockdev/#76-view-binding
02f0931
#76 view binding
Alex009
Successfully merging a pull request may close this issue.
VBActivity:
VBEventsActivity:
The text was updated successfully, but these errors were encountered: