Created
June 26, 2021 08:02
-
-
Save orcchg/c0ba4f3b9cba45a5cf009289d3fa4a7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class StockListDemoActivity : AppCompatActivity() { | |
@Inject lateinit var stockListAdapter: StockListAdapter | |
@Inject lateinit var factory: StockListViewModelFactory | |
private val binding by viewBindings(StockActivityDemoBinding::inflate) | |
private val viewModel by viewModels<StockListViewModel> { factory } | |
override fun onCreate(savedInstanceState: Bundle?) { | |
// HERE ! | |
DaggerStockListDemoActivityComponent.factory() | |
.create(featureApi = DaggerFakeStockListFeatureComponent.create()) | |
.inject(this) | |
super.onCreate(savedInstanceState) | |
// ---- | |
binding.rvItems.adapter = stockListAdapter | |
observe(viewModel.stocks, stockListAdapter::update) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment