Created
May 25, 2018 17:59
-
-
Save joseprl89/be0dbdf512603b61f49c1c6f34b13c2a to your computer and use it in GitHub Desktop.
How ViewModelStores.of works for https://medium.com/@josep.rodriguez/internals-of-android-architecture-components-part-i-the-viewmodel-d893e362a0d9
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
public static ViewModelStore of(@NonNull Fragment fragment) { | |
if (fragment instanceof ViewModelStoreOwner) { | |
return ((ViewModelStoreOwner) fragment).getViewModelStore(); | |
} | |
return holderFragmentFor(fragment).getViewModelStore(); | |
} | |
... | |
public static HolderFragment holderFragmentFor(Fragment fragment) { | |
return sHolderFragmentManager.holderFragmentFor(fragment); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment