Created
April 5, 2018 10:42
-
-
Save Nonda95/145c9cfae9780a85d8a3f60c35853aed to your computer and use it in GitHub Desktop.
Add loading image only from cache
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
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
detailImage.load(url, loadOnlyFromCache = true) { | |
supportStartPostponedEnterTransition() | |
} | |
} |
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
fun ImageView.load(url: String, loadOnlyFromCache: Boolean = false, onLoadingFinished: () -> Unit = {}) { | |
... | |
val requestOptions = RequestOptions.placeholderOf(R.drawable.placeholder) | |
.dontTransform() | |
.onlyRetrieveFromCache(loadOnlyFromCache) | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment