mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Trampoline call to generate preview if view is not laid out.
This commit is contained in:
committed by
Greyson Parrelli
parent
dddf830e47
commit
5b3899237b
@@ -78,14 +78,24 @@ class StoryTextPostPreviewFragment : Fragment(R.layout.stories_text_post_preview
|
||||
|
||||
private fun loadPreview(storyTextThumb: ImageView, storyTextPreview: StoryTextPostView) {
|
||||
storyTextPreview.doOnNextLayout {
|
||||
storyTextThumb.setImageBitmap(storyTextPreview.drawToBitmap())
|
||||
requireActivity().supportStartPostponedEnterTransition()
|
||||
storyTextThumb.postDelayed({
|
||||
storyTextThumb.visible = false
|
||||
}, 200)
|
||||
if (it.isLaidOut) {
|
||||
actualLoadPreview(storyTextThumb, storyTextPreview)
|
||||
} else {
|
||||
it.post {
|
||||
actualLoadPreview(storyTextThumb, storyTextPreview)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun actualLoadPreview(storyTextThumb: ImageView, storyTextPreview: StoryTextPostView) {
|
||||
storyTextThumb.setImageBitmap(storyTextPreview.drawToBitmap())
|
||||
requireActivity().supportStartPostponedEnterTransition()
|
||||
storyTextThumb.postDelayed({
|
||||
storyTextThumb.visible = false
|
||||
}, 200)
|
||||
}
|
||||
|
||||
@SuppressLint("AlertDialogBuilderUsage")
|
||||
private fun showLinkPreviewTooltip(view: View, linkPreview: LinkPreview) {
|
||||
requireListener<Callback>().setIsDisplayingLinkPreviewTooltip(true)
|
||||
|
||||
Reference in New Issue
Block a user