Fix text story keyboard in text stories.

This commit is contained in:
Alex Hart
2023-06-27 11:52:40 -03:00
committed by Nicholas
parent 60e1ee21ed
commit 029c8ba917
3 changed files with 10 additions and 7 deletions

View File

@@ -71,7 +71,7 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
_binding = StoriesTextPostCreationFragmentBinding.bind(view)
binding.storyTextPost.showCloseButton()
binding.storyTextPost.enableCreationMode()
lifecycleDisposable.bindTo(viewLifecycleOwner)
lifecycleDisposable += sharedViewModel.hudCommands.subscribe {
@@ -137,7 +137,7 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
binding.send.isClickable = false
binding.sendInProgressIndicator.visible = true
binding.storyTextPost.hideCloseButton()
binding.storyTextPost.disableCreationMode()
val contacts = (sharedViewModel.destination.getRecipientSearchKeyList() + sharedViewModel.destination.getRecipientSearchKey())
.filterIsInstance(ContactSearchKey::class.java)
@@ -174,7 +174,7 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
override fun onResume() {
super.onResume()
binding.storyTextPost.showCloseButton()
binding.storyTextPost.enableCreationMode()
requireActivity().requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}

View File

@@ -48,7 +48,7 @@ class StoryTextPostView @JvmOverloads constructor(
init {
TextStoryTextWatcher.install(textView)
textView.movementMethod = LongClickMovementMethod.getInstance(context)
disableCreationMode()
}
fun getLinkPreviewThumbnailWidth(useLargeThumbnail: Boolean): Int {
@@ -59,12 +59,14 @@ class StoryTextPostView @JvmOverloads constructor(
return linkPreviewView.getThumbnailViewHeight(useLargeThumbnail)
}
fun showCloseButton() {
fun enableCreationMode() {
linkPreviewView.setCanClose(true)
textView.movementMethod = null
}
fun hideCloseButton() {
fun disableCreationMode() {
linkPreviewView.setCanClose(false)
textView.movementMethod = LongClickMovementMethod.getInstance(context)
}
fun setTypeface(typeface: Typeface) {
@@ -144,7 +146,7 @@ class StoryTextPostView @JvmOverloads constructor(
setTextColor(storyTextPost.textForegroundColor, false)
setTextBackgroundColor(storyTextPost.textBackgroundColor)
hideCloseButton()
disableCreationMode()
postAdjustLinkPreviewTranslationY()
}

View File

@@ -12,6 +12,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import org.thoughtcrime.securesms.R;