gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] 01/03: Limit purpose to 100 characters


From: gnunet
Subject: [taler-taler-android] 01/03: Limit purpose to 100 characters
Date: Fri, 06 Jan 2023 18:25:15 +0100

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository taler-android.

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

    Limit purpose to 100 characters
    
    #0007483
---
 .../taler/wallet/peer/OutgoingPullIntroComposable.kt    | 16 ++++++++++++++--
 .../taler/wallet/peer/OutgoingPushIntroComposable.kt    | 17 +++++++++++++++--
 wallet/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
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 = {
@@ -86,6 +90,14 @@ fun OutgoingPullIntroComposable(
         LaunchedEffect(Unit) {
             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 = {
@@ -85,6 +90,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 cb80922..22adefb 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>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]