fresco
fresco copied to clipboard
Control Placeholder when updating SimpleDraweeView
We use GitHub Issues for bugs.
If you have a non-bug question, please ask on Stack Overflow: http://stackoverflow.com/questions/tagged/fresco
--- Please use this template, and delete everything above this line before submitting your issue ---
Description
When there is an Image already loaded into the SimpleDraweeView and I update it, the placeholder is shown and it "breaks" the transition. What I would like to achieve is to update the image, without seeing the Placeholder.
Reproduction
Can reproduce this in a sample project. The Activity layout has the SimpleDraweeView and a Button The core code is:
` private val draweeView by lazy { findViewById<SimpleDraweeView>(R.id.draweeView) } private val button by lazy { findViewById<Button>(R.id.button) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//Load the Starting Image
draweeView.setImageURI(
Uri.parse(initialImage)
)
button.setOnClickListener {
//Update the Images
updateImage()
}
}
private fun updateImage() {
val controller = Fresco.newDraweeControllerBuilder()
.setOldController(draweeView.controller)
.setLowResImageRequest(
ImageRequestBuilder.newBuilderWithSource(Uri.parse(finalImageLowRes))
.disableDiskCache().build()
)
.setImageRequest(
ImageRequestBuilder.newBuilderWithSource(Uri.parse(finalImageHighRes))
.disableDiskCache().build()
)
.setRetainImageOnFailure(true)
.build()
draweeView.controller = controller
}
`
Solution
What I would like to have, is a way to specify in my Controller some way to tell Fresco to not display the Placeholder when Load the Image.
The Flow would be: When No Image Loaded -> New Request -> Show Placeholder -> Update with the Image When Image is already Loaded -> New Request -> Update with the Image
Additional Information
- Fresco version: [2.6.0]
- Platform version: [Reproduces from Api 29 to 31]. Did not test on other versions
For the moment, I uploaded my sample project into github: https://github.com/wlmirand/FrescoTest