kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix bad donor badge input behaviour.
rodzic
1b471e163d
commit
93e5052d6b
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.badges.gifts.flow
|
||||||
|
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
|
import android.widget.EditText
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
|
@ -109,6 +110,10 @@ class GiftFlowConfirmationFragment :
|
||||||
textInputViewHolder.onAttachedToWindow()
|
textInputViewHolder.onAttachedToWindow()
|
||||||
|
|
||||||
inputAwareLayout.addOnKeyboardShownListener {
|
inputAwareLayout.addOnKeyboardShownListener {
|
||||||
|
if (emojiKeyboard.isEmojiSearchMode) {
|
||||||
|
return@addOnKeyboardShownListener
|
||||||
|
}
|
||||||
|
|
||||||
inputAwareLayout.hideAttachedInput(true)
|
inputAwareLayout.hideAttachedInput(true)
|
||||||
emojiToggle.setImageResource(R.drawable.ic_emoji_smiley_24)
|
emojiToggle.setImageResource(R.drawable.ic_emoji_smiley_24)
|
||||||
}
|
}
|
||||||
|
@ -127,25 +132,9 @@ class GiftFlowConfirmationFragment :
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
lifecycleDisposable += viewModel.state.observeOn(AndroidSchedulers.mainThread()).subscribe { state ->
|
|
||||||
adapter.submitList(getConfiguration(state).toMappingModelList())
|
|
||||||
|
|
||||||
if (state.stage == GiftFlowState.Stage.RECIPIENT_VERIFICATION) {
|
|
||||||
debouncer.publish { verifyingRecipientDonationPaymentDialog.show() }
|
|
||||||
} else {
|
|
||||||
debouncer.clear()
|
|
||||||
verifyingRecipientDonationPaymentDialog.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.stage == GiftFlowState.Stage.PAYMENT_PIPELINE) {
|
|
||||||
processingDonationPaymentDialog.show()
|
|
||||||
} else {
|
|
||||||
processingDonationPaymentDialog.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
textInputViewHolder.bind(
|
textInputViewHolder.bind(
|
||||||
TextInput.MultilineModel(
|
TextInput.MultilineModel(
|
||||||
text = state.additionalMessage,
|
text = viewModel.snapshot.additionalMessage,
|
||||||
hint = DSLSettingsText.from(R.string.GiftFlowConfirmationFragment__add_a_message),
|
hint = DSLSettingsText.from(R.string.GiftFlowConfirmationFragment__add_a_message),
|
||||||
onTextChanged = {
|
onTextChanged = {
|
||||||
viewModel.setAdditionalMessage(it)
|
viewModel.setAdditionalMessage(it)
|
||||||
|
@ -161,6 +150,22 @@ class GiftFlowConfirmationFragment :
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lifecycleDisposable += viewModel.state.observeOn(AndroidSchedulers.mainThread()).subscribe { state ->
|
||||||
|
adapter.submitList(getConfiguration(state).toMappingModelList())
|
||||||
|
|
||||||
|
if (state.stage == GiftFlowState.Stage.RECIPIENT_VERIFICATION) {
|
||||||
|
debouncer.publish { verifyingRecipientDonationPaymentDialog.show() }
|
||||||
|
} else {
|
||||||
|
debouncer.clear()
|
||||||
|
verifyingRecipientDonationPaymentDialog.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.stage == GiftFlowState.Stage.PAYMENT_PIPELINE) {
|
||||||
|
processingDonationPaymentDialog.show()
|
||||||
|
} else {
|
||||||
|
processingDonationPaymentDialog.dismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycleDisposable.bindTo(viewLifecycleOwner)
|
lifecycleDisposable.bindTo(viewLifecycleOwner)
|
||||||
|
@ -249,6 +254,10 @@ class GiftFlowConfirmationFragment :
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onToolbarNavigationClicked() {
|
||||||
|
findNavController().popBackStack()
|
||||||
|
}
|
||||||
|
|
||||||
override fun openEmojiSearch() {
|
override fun openEmojiSearch() {
|
||||||
emojiKeyboard.onOpenEmojiSearch()
|
emojiKeyboard.onOpenEmojiSearch()
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.thoughtcrime.securesms.components.settings.app.subscription.models.Ne
|
||||||
import org.thoughtcrime.securesms.components.settings.configure
|
import org.thoughtcrime.securesms.components.settings.configure
|
||||||
import org.thoughtcrime.securesms.components.settings.models.IndeterminateLoadingCircle
|
import org.thoughtcrime.securesms.components.settings.models.IndeterminateLoadingCircle
|
||||||
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
||||||
|
import org.thoughtcrime.securesms.util.ViewUtil
|
||||||
import org.thoughtcrime.securesms.util.fragments.requireListener
|
import org.thoughtcrime.securesms.util.fragments.requireListener
|
||||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ class GiftFlowStartFragment : DSLSettingsFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
ViewUtil.hideKeyboard(requireContext(), requireView())
|
||||||
|
}
|
||||||
|
|
||||||
private fun getConfiguration(state: GiftFlowState): DSLConfiguration {
|
private fun getConfiguration(state: GiftFlowState): DSLConfiguration {
|
||||||
return configure {
|
return configure {
|
||||||
customPref(
|
customPref(
|
||||||
|
|
|
@ -36,7 +36,7 @@ abstract class DSLSettingsFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar?.setNavigationOnClickListener {
|
toolbar?.setNavigationOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
onToolbarNavigationClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuId != -1) {
|
if (menuId != -1) {
|
||||||
|
@ -67,6 +67,10 @@ abstract class DSLSettingsFragment(
|
||||||
return Material3OnScrollHelper(requireActivity(), toolbar)
|
return Material3OnScrollHelper(requireActivity(), toolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun onToolbarNavigationClicked() {
|
||||||
|
requireActivity().onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
recyclerView = null
|
recyclerView = null
|
||||||
|
|
|
@ -82,6 +82,10 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun transformTo(state: State, animate: Boolean) {
|
private fun transformTo(state: State, animate: Boolean) {
|
||||||
|
if (state == currentState && state == requestedState) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
requestedState = state
|
requestedState = state
|
||||||
if (animator?.isRunning == true) {
|
if (animator?.isRunning == true) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/next"
|
android:id="@+id/next"
|
||||||
style="@style/Signal.Widget.Button.Large.Primary"
|
style="@style/Signal.Widget.Button.Large.Tonal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
android:layout_marginEnd="@dimen/dsl_settings_gutter"
|
||||||
|
|
Ładowanie…
Reference in New Issue