This file contains 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
/** | |
* Auto Cleaned Value | |
* | |
* This solution auto-clears the lazy property by using Kotlin’s delegated properties. | |
* It will be cleaned when the fragment's view is destroyed, avoiding memory leaks. | |
* | |
* Accessing this variable while the fragment's view is destroyed will throw NPE. | |
* | |
* @see <a href="https://medium.com/scalereal/let-your-delegates-auto-nullify-references-%EF%B8%8F-3ad6d8875497">Delegates auto nullify</a> | |
* @see <a href="https://github.com/android/architecture-components-samples/blob/08416a0aced0e4946e0765751a3b20f9a6222708/GithubBrowserSample/app/src/main/java/com/android/example/github/util/AutoClearedValue.kt">AutoClearedValue</a> |