diff --git a/app/src/main/java/cash/z/ecc/android/ui/send/SendFragment.kt b/app/src/main/java/cash/z/ecc/android/ui/send/SendFragment.kt index 1dad6d3..74f1efc 100644 --- a/app/src/main/java/cash/z/ecc/android/ui/send/SendFragment.kt +++ b/app/src/main/java/cash/z/ecc/android/ui/send/SendFragment.kt @@ -26,6 +26,7 @@ import cash.z.ecc.android.sdk.block.CompactBlockProcessor.WalletBalance import cash.z.ecc.android.sdk.ext.* import cash.z.ecc.android.sdk.validate.AddressType import cash.z.ecc.android.ui.base.BaseFragment +import kotlinx.android.synthetic.main.fragment_send.* import kotlinx.coroutines.delay import kotlinx.coroutines.flow.first import kotlinx.coroutines.launch @@ -136,13 +137,23 @@ class SendFragment : BaseFragment(), } private fun onAddressChanged(address: String) { + var isTaddress = false lifecycleScope.launchWhenResumed { val validation = sendViewModel.validateAddress(address) binding.buttonSend.isActivated = !validation.isNotValid var type = when (validation) { - is AddressType.Transparent -> R.string.send_validation_address_valid_taddr to R.color.zcashGreen - is AddressType.Shielded -> R.string.send_validation_address_valid_zaddr to R.color.zcashGreen - is AddressType.Invalid -> R.string.send_validation_address_invalid to R.color.zcashRed + is AddressType.Transparent -> { + isTaddress = true + R.string.send_validation_address_valid_taddr to R.color.zcashGreen + } + is AddressType.Shielded -> { + isTaddress = false + R.string.send_validation_address_valid_zaddr to R.color.zcashGreen + } + is AddressType.Invalid -> { + isTaddress = false + R.string.send_validation_address_invalid to R.color.zcashRed + } } if (address == sendViewModel.synchronizer.getAddress()) type = R.string.send_validation_address_self to R.color.zcashRed @@ -157,6 +168,19 @@ class SendFragment : BaseFragment(), } } } + + // if Taddress, no memo can be included in TX + if(isTaddress) { + text_layout_memo.visibility = View.INVISIBLE + check_include_address.visibility = View.INVISIBLE + text_no_memo.visibility = View.VISIBLE + + }else{ + text_layout_memo.visibility = View.VISIBLE + check_include_address.visibility = View.VISIBLE + text_no_memo.visibility = View.INVISIBLE + } + // if we have the last used address but we're changing it, then clear the selection if (binding.imageLastUsedAddressSelected.isVisible) { loadLastUsedAddress().let { lastAddress -> diff --git a/app/src/main/res/layout/fragment_send.xml b/app/src/main/res/layout/fragment_send.xml index dac1c33..cf65a79 100644 --- a/app/src/main/res/layout/fragment_send.xml +++ b/app/src/main/res/layout/fragment_send.xml @@ -196,13 +196,13 @@ android:layout_height="wrap_content" android:hint="@string/send_address_hint" android:theme="@style/Zcash.Overlay.TextInputLayout" + android:visibility="visible" app:endIconDrawable="@drawable/ic_qr_scan" app:endIconMode="custom" app:helperText="Enter a valid Zcash address" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.08" app:layout_constraintWidth_percent="0.84"> + +