[#1591] Send.Form Memo field improvements

- Closes #1591
- Changelog update
This commit is contained in:
Honza Rychnovský 2024-09-18 14:14:57 +02:00 committed by GitHub
parent 3ae3ff8cef
commit d3c29ee710
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 39 deletions

View File

@ -6,6 +6,10 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
## [Unreleased]
### Changed
- The Message text field on the Send Form screen has been updated to provide the Return key on the software keyboard
and make auto-capitalization on the beginning of every sentence or new line.
## [1.2 (731)] - 2024-09-16
### Changed

View File

@ -9,6 +9,10 @@ directly impact users rather than highlighting other key architectural updates.*
## [Unreleased]
### Changed
- The Message text field on the Send Form screen has been updated to provide the Return key on the software keyboard
and make auto-capitalization on the beginning of every sentence or new line.
## [1.2 (731)] - 2024-09-16
### Added

View File

@ -5,7 +5,6 @@ package co.electriccoin.zcash.ui.screen.send.view
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
@ -27,18 +26,13 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusDirection
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.layout.positionInRoot
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.testTag
@ -48,6 +42,7 @@ import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
@ -92,7 +87,6 @@ import co.electriccoin.zcash.ui.screen.send.model.AmountState
import co.electriccoin.zcash.ui.screen.send.model.MemoState
import co.electriccoin.zcash.ui.screen.send.model.RecipientAddressState
import co.electriccoin.zcash.ui.screen.send.model.SendStage
import kotlinx.coroutines.launch
import java.util.Locale
@Composable
@ -349,15 +343,11 @@ private fun SendForm(
) {
val monetarySeparators = MonetarySeparators.current(Locale.getDefault())
val scrollState = rememberScrollState()
val (scrollToFeePixels, setScrollToFeePixels) = rememberSaveable { mutableIntStateOf(0) }
Column(
modifier =
Modifier
.fillMaxHeight()
.verticalScroll(scrollState)
.verticalScroll(rememberScrollState())
.then(modifier),
horizontalAlignment = Alignment.CenterHorizontally
) {
@ -417,8 +407,6 @@ private fun SendForm(
memoState = memoState,
setMemoState = setMemoState,
isMemoFieldAvailable = isMemoFieldAvailable,
scrollState = scrollState,
scrollTo = scrollToFeePixels
)
Spacer(
@ -436,7 +424,6 @@ private fun SendForm(
onCreateZecSend = onCreateZecSend,
recipientAddressState = recipientAddressState,
walletSnapshot = walletSnapshot,
setScrollToFeePixels = setScrollToFeePixels
)
}
}
@ -448,7 +435,6 @@ fun SendButton(
memoState: MemoState,
onCreateZecSend: (ZecSend) -> Unit,
recipientAddressState: RecipientAddressState,
setScrollToFeePixels: (Int) -> Unit,
walletSnapshot: WalletSnapshot,
) {
val context = LocalContext.current
@ -510,10 +496,6 @@ fun SendButton(
DEFAULT_FEE
),
textFontWeight = FontWeight.SemiBold,
modifier =
Modifier.onGloballyPositioned {
setScrollToFeePixels(it.positionInRoot().y.toInt())
}
)
}
}
@ -801,13 +783,7 @@ fun SendFormMemoTextField(
isMemoFieldAvailable: Boolean,
memoState: MemoState,
setMemoState: (MemoState) -> Unit,
scrollState: ScrollState,
scrollTo: Int
) {
val focusManager = LocalFocusManager.current
val scope = rememberCoroutineScope()
val bringIntoViewRequester = remember { BringIntoViewRequester() }
Column(
@ -869,19 +845,8 @@ fun SendFormMemoTextField(
keyboardOptions =
KeyboardOptions(
keyboardType = KeyboardType.Text,
imeAction = ImeAction.Done
),
keyboardActions =
KeyboardActions(
onDone = {
focusManager.clearFocus(true)
// Scroll down to make sure the Send button is visible on small screens
if (scrollTo > 0) {
scope.launch {
scrollState.animateScrollTo(scrollTo)
}
}
}
imeAction = ImeAction.Default,
capitalization = KeyboardCapitalization.Sentences
),
placeholder = {
Text(