From c407b4f69d5f939512dfd2ed153c9d1b297fb3a7 Mon Sep 17 00:00:00 2001 From: pokkst Date: Wed, 6 Dec 2023 20:19:27 -0600 Subject: [PATCH] 0.5.1: Accessibility fixes for sending transactions --- app/build.gradle | 4 ++-- .../wallet/fragment/send/SendFragment.kt | 20 +++++++++++++++---- app/src/main/res/layout/fragment_send.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d7c1230..b129f21 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "net.mynero.wallet" minSdkVersion 21 targetSdkVersion 34 - versionCode 50000 - versionName "0.5.0 'Fluorine Fermi'" + versionCode 50100 + versionName "0.5.1 'Fluorine Fermi'" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { diff --git a/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt b/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt index c93562a..7b9bb0d 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt +++ b/app/src/main/java/net/mynero/wallet/fragment/send/SendFragment.kt @@ -16,6 +16,7 @@ import android.widget.TextView import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.view.ViewCompat import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider import com.google.zxing.client.android.Intents @@ -142,12 +143,23 @@ class SendFragment : Fragment() { sendTxSlider?.onSlideCompleteListener = object : OnSlideCompleteListener { override fun onSlideComplete(view: SlideToActView) { - val pendingTx = mViewModel?.pendingTransaction?.value ?: return - Toast.makeText(activity, getString(R.string.sending_tx), Toast.LENGTH_SHORT) - .show() - sendTx(pendingTx) + confirmSlider() } } + + sendTxSlider?.let { slideToActView -> + ViewCompat.addAccessibilityAction(slideToActView, getString(R.string.approve_the_transaction)) { _, _ -> + confirmSlider() + return@addAccessibilityAction true + } + } + } + + private fun confirmSlider() { + val pendingTx = mViewModel?.pendingTransaction?.value ?: return + Toast.makeText(activity, getString(R.string.sending_tx), Toast.LENGTH_SHORT) + .show() + sendTx(pendingTx) } private fun checkDestsValidity(sendAll: Boolean): Boolean { diff --git a/app/src/main/res/layout/fragment_send.xml b/app/src/main/res/layout/fragment_send.xml index dd5357b..f5fb4cf 100644 --- a/app/src/main/res/layout/fragment_send.xml +++ b/app/src/main/res/layout/fragment_send.xml @@ -213,6 +213,7 @@ android:layout_marginBottom="24dp" android:elevation="6dp" android:visibility="gone" + android:importantForAccessibility="yes" app:area_margin="10dp" app:border_radius="20dp" app:inner_color="@android:color/white" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e6a662b..588e0da 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -155,5 +155,6 @@ Copy transaction address 16 words instead of 25; just as secure, but not supported in as many wallets right now. In Mysu, seed passphrase is enforced for these wallets. Older, 25 word seed; supported in all Monero wallets. In Mysu, seed passphrase is not enforced for these wallets. + Send transaction