aboutsummaryrefslogtreecommitdiff
path: root/wallet
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-01-05 20:26:54 -0600
committerIván Ávalos <avalos@disroot.org>2023-01-05 20:26:54 -0600
commit02a5ecfb869d7dcd757f667a6073604e19c629c4 (patch)
treeec270796ce799f4f18fb0763a4e85abe07a14953 /wallet
parent6f45cd9e9f4e25df5048854cc421178f1cd66a59 (diff)
downloadtaler-android-02a5ecfb869d7dcd757f667a6073604e19c629c4.tar.gz
taler-android-02a5ecfb869d7dcd757f667a6073604e19c629c4.tar.bz2
taler-android-02a5ecfb869d7dcd757f667a6073604e19c629c4.zip
[wallet] Limit purpose to 100 characters
#0007483
Diffstat (limited to 'wallet')
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt16
-rw-r--r--wallet/src/main/java/net/taler/wallet/peer/OutgoingPushIntroComposable.kt17
-rw-r--r--wallet/src/main/res/values/strings.xml1
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
index 5faea07..e66d628 100644
--- 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
index 915d002..6815565 100644
--- 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
index eb15021..bedec24 100644
--- 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>