Open eucalypto opened 2 years ago
I like the starter code already: it follows clean code principles! (Unlike many other codelabs projects). Only because it wants to show a certain technique, does not mean that common coding practices have to be ignored. :) Otherwise newbies may subconsciously learn that it's OK to put everything in a god-like onCreateView() of a fragment.
I'm using a DialogFragment to get all the automatic features of it. Here, I'm using by activityViewModels()
to share the view model, but I don't want to scope my view model to the activity.
Here's a proposed better solution: https://stackoverflow.com/questions/63225618/android-share-viewmodel-between-fragment-and-dialog-fragment
This concludes Codelab 1: Store data in ViewModel
Project Files
Architecture Components Pathway
Original github repository: https://github.com/google-developer-training/android-basics-kotlin-unscramble-app