android / architecture-samples

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.
Apache License 2.0
44.47k stars 11.65k forks source link

dev-todo-mvvm-live should not be resolving strings in ViewModel #574

Open karczews opened 6 years ago

karczews commented 6 years ago

ViewModel should not be resolving strings from resources as shown in https://github.com/googlesamples/android-architecture/blob/dev-todo-mvvm-live/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/statistics/StatisticsViewModel.java

If user changes locale on device, activity/fragment will be recreated but ViewModel will be retained with data, that might be invalid for new configuration/locale. Because this is sample referenced by official google documentation, it should not be showcasing invalid ViewModel usage.

ref. https://issuetracker.google.com/u/1/issues/111961971

JoseAlcerreca commented 5 years ago

@karczews thanks, fixed.