mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Add polish to stories link previews.
This commit is contained in:
committed by
Greyson Parrelli
parent
19af68a27c
commit
c7cd261641
@@ -26,6 +26,7 @@ import org.thoughtcrime.securesms.safety.SafetyNumberBottomSheet
|
||||
import org.thoughtcrime.securesms.stories.Stories
|
||||
import org.thoughtcrime.securesms.stories.StoryTextPostView
|
||||
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
||||
import org.thoughtcrime.securesms.util.livedata.LiveDataUtil
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creation_fragment), TextStoryPostTextEntryFragment.Callback, SafetyNumberBottomSheet.Callbacks {
|
||||
@@ -102,8 +103,10 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
|
||||
send.isEnabled = canSend
|
||||
}
|
||||
|
||||
linkPreviewViewModel.linkPreviewState.observe(viewLifecycleOwner) { state ->
|
||||
storyTextPostView.bindLinkPreviewState(state, View.GONE)
|
||||
LiveDataUtil.combineLatest(viewModel.state, linkPreviewViewModel.linkPreviewState) { viewState, linkState ->
|
||||
Pair(viewState.body.isBlank(), linkState)
|
||||
}.observe(viewLifecycleOwner) { (useLargeThumb, linkState) ->
|
||||
storyTextPostView.bindLinkPreviewState(linkState, View.GONE, useLargeThumb)
|
||||
storyTextPostView.postAdjustLinkPreviewTranslationY()
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class TextStoryPostLinkEntryFragment : KeyboardEntryDialogFragment(
|
||||
}
|
||||
|
||||
linkPreviewViewModel.linkPreviewState.observe(viewLifecycleOwner) { state ->
|
||||
linkPreview.bind(state)
|
||||
linkPreview.bind(state, useLargeThumbnail = false)
|
||||
shareALinkGroup.visible = !state.isLoading && !state.linkPreview.isPresent && (state.error == null && state.activeUrlForError == null)
|
||||
confirmButton.isEnabled = state.linkPreview.isPresent || state.activeUrlForError != null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user