taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

commit 026c566a7619d31e4c4e68dd8538dd6771fa971a
parent 84377ba0b58277bc964f8c04af2af6142384e785
Author: Iván Ávalos <avalos@disroot.org>
Date:   Thu,  5 Jan 2023 20:26:54 -0600

Limit purpose to 100 characters

#0007483

Diffstat:
Mwallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt | 16++++++++++++++--
Mwallet/src/main/java/net/taler/wallet/peer/OutgoingPushIntroComposable.kt | 17+++++++++++++++--
Mwallet/src/main/res/values/strings.xml | 1+
3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt @@ -41,6 +41,7 @@ import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -67,11 +68,14 @@ fun OutgoingPullIntroComposable( val exchangeItem = exchangeState.value OutlinedTextField( modifier = Modifier - .padding(16.dp) + .fillMaxWidth() + .padding(top = 16.dp, start = 16.dp, end = 16.dp) .focusRequester(focusRequester), + singleLine = true, value = subject, onValueChange = { input -> - subject = input + if (input.length <= 100) + subject = input }, isError = subject.isBlank(), label = { @@ -87,6 +91,14 @@ fun OutgoingPullIntroComposable( focusRequester.requestFocus() } Text( + modifier = Modifier + .fillMaxWidth() + .padding(top = 5.dp, end = 16.dp), + color = if (subject.isBlank()) colorResource(R.color.red) else Color.Unspecified, + text = stringResource(R.string.char_count, subject.length, 100), + textAlign = TextAlign.End, + ) + Text( modifier = Modifier.padding(horizontal = 16.dp), text = stringResource(id = R.string.amount_chosen), ) diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushIntroComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPushIntroComposable.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import net.taler.common.Amount @@ -70,10 +71,14 @@ fun OutgoingPushIntroComposable( var subject by rememberSaveable { mutableStateOf("") } OutlinedTextField( - modifier = Modifier.padding(horizontal = 16.dp), + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + singleLine = true, value = subject, onValueChange = { input -> - subject = input + if (input.length <= 100) + subject = input }, isError = subject.isBlank(), label = { @@ -86,6 +91,14 @@ fun OutgoingPushIntroComposable( } ) Text( + modifier = Modifier + .fillMaxWidth() + .padding(top = 5.dp, end = 16.dp), + color = if (subject.isBlank()) colorResource(R.color.red) else Color.Unspecified, + text = stringResource(R.string.char_count, subject.length, 100), + textAlign = TextAlign.End, + ) + Text( modifier = Modifier.padding(top = 16.dp, start = 16.dp, end = 16.dp), text = stringResource(R.string.send_peer_warning), ) diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml @@ -56,6 +56,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="menu">Menu</string> <string name="or">or</string> <string name="currency">Currency</string> + <string name="char_count">%1$d/%2$d</string> <string name="offline">Operation requires internet access. Please ensure your internet connection works and try again.</string> <string name="error_unsupported_uri">Error: This Taler URI is not supported.</string>