Kaynağa Gözat

Worked on Wifi password form screen and completed form UI

Khubaib 4 ay önce
ebeveyn
işleme
00ba000193

+ 80 - 8
app/src/main/java/com/fastest/pass/home/presentation/ui/components/AddBankAccountFormScreen.kt

@@ -58,9 +58,9 @@ fun AddBankAccountFormScreen() {
             .verticalScroll(rememberScrollState())
     ) {
         Spacer(modifier = Modifier.height(20.dp))
-        NameTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, R.string.bank_name)
+        NameTextFieldABAFS(keyboardController = keyboardController, focusManager = focusManager, R.string.bank_name)
         Spacer(modifier = Modifier.height(20.dp))
-        NameTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, R.string.account_type)
+        NameTextFieldABAFS(keyboardController = keyboardController, focusManager = focusManager, R.string.account_type)
         Spacer(modifier = Modifier.height(20.dp))
         NumberTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, R.string.routing_number, "123456789")
         Spacer(modifier = Modifier.height(20.dp))
@@ -72,16 +72,18 @@ fun AddBankAccountFormScreen() {
         Spacer(modifier = Modifier.height(20.dp))
         TextNumberTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, R.string.pin, "1234")
         Spacer(modifier = Modifier.height(20.dp))
-        NameTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, R.string.branch_address)
+        NameTextFieldABAFS(keyboardController = keyboardController, focusManager = focusManager, R.string.branch_address)
         Spacer(modifier = Modifier.height(20.dp))
         PhoneNumberTextFieldAPS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.branch_phone)
+        Spacer(modifier = Modifier.height(20.dp))
+        NotesTextFieldABAFS(keyboardController = keyboardController, focusManager = focusManager)
         Spacer(modifier = Modifier.height(25.dp))
         SaveButtonABAFS(buttonText = R.string.save)
     }
 }
 
 @Composable
-fun ColumnScope.NameTextFieldAPS(
+fun ColumnScope.NameTextFieldABAFS(
     keyboardController: SoftwareKeyboardController?,
     focusManager: FocusManager,
     labelText: Int
@@ -139,7 +141,7 @@ fun ColumnScope.NameTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Text,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -211,7 +213,7 @@ fun ColumnScope.NumberTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Number,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -283,7 +285,7 @@ fun ColumnScope.TextNumberTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Text,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -354,7 +356,7 @@ fun ColumnScope.PhoneNumberTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Phone,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -391,4 +393,74 @@ fun ColumnScope.SaveButtonABAFS(buttonText: Int) {
             textAlign = TextAlign.Center
         )
     }
+}
+
+@Composable
+fun ColumnScope.NotesTextFieldABAFS(
+    keyboardController: SoftwareKeyboardController?,
+    focusManager: FocusManager
+) {
+    var notesText by remember { mutableStateOf("") }
+
+    TextField(
+        value = notesText,
+        onValueChange = {
+            notesText = it
+        },
+        textStyle = MaterialTheme.typography.displayMedium,
+        modifier = Modifier
+            .align(Alignment.Start)
+            .fillMaxWidth()
+            .defaultMinSize(minHeight = 60.dp)
+            .wrapContentHeight()
+            .border(
+                1.dp,
+                color = colorResource(id = R.color.gray_border_textfield),
+                shape = RoundedCornerShape(16.dp)
+            )
+            .background(color = colorResource(id = R.color.transparent))
+        ,
+        shape = RoundedCornerShape(16.dp),
+//        placeholder = {
+//            Text(
+//                text = stringResource(id = R.string.enter_email_address),
+//                color = colorResource(id = R.color.gray_splash),
+//                style = MaterialTheme.typography.displayMedium
+//            )
+//        },
+        label = {
+            Text(text = stringResource(R.string.notes),
+                style = MaterialTheme.typography.titleSmall.copy(
+                    color = colorResource(id = R.color.gray_text)
+                )
+            )
+        },
+//        leadingIcon = {
+//            Image(
+//                painter = painterResource(id = R.drawable.profile_circle),
+//                contentDescription = "Title Logo",
+//                modifier = Modifier
+//                    .size(24.dp, 24.dp)
+//            )
+//        },
+        colors = TextFieldDefaults.colors(
+            focusedLabelColor = colorResource(id = R.color.gray_splash),
+            unfocusedContainerColor = colorResource(id = R.color.transparent),
+            focusedContainerColor = colorResource(id = R.color.transparent),
+            focusedIndicatorColor = colorResource(id = R.color.transparent),
+            disabledIndicatorColor = colorResource(id = R.color.transparent),
+            unfocusedIndicatorColor = colorResource(id = R.color.transparent),
+            cursorColor = colorResource(id = R.color.gray_splash),
+        ),
+        keyboardOptions = KeyboardOptions(
+            keyboardType = KeyboardType.Text,
+            imeAction = ImeAction.Done
+        ),
+        keyboardActions = KeyboardActions(
+            onDone = {
+                focusManager.clearFocus()
+                keyboardController?.hide()
+            }
+        ),
+    )
 }

+ 4 - 4
app/src/main/java/com/fastest/pass/home/presentation/ui/components/AddPasswordFormScreen.kt

@@ -145,7 +145,7 @@ fun ColumnScope.TitleTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Text,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -229,7 +229,7 @@ fun ColumnScope.UrlTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Uri,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -298,7 +298,7 @@ fun ColumnScope.UsernameTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Text,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {
@@ -360,7 +360,7 @@ fun ColumnScope.PasswordTextFieldAPS(
         ),
         keyboardOptions = KeyboardOptions(
             keyboardType = KeyboardType.Password,
-            imeAction = ImeAction.Done
+            imeAction = ImeAction.Next
         ),
         keyboardActions = KeyboardActions(
             onDone = {

+ 317 - 0
app/src/main/java/com/fastest/pass/home/presentation/ui/components/AddPaymentCardFormScreen.kt

@@ -0,0 +1,317 @@
+package com.fastest.pass.home.presentation.ui.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.defaultMinSize
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.wrapContentHeight
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.FocusManager
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalFocusManager
+import androidx.compose.ui.platform.LocalSoftwareKeyboardController
+import androidx.compose.ui.platform.SoftwareKeyboardController
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.fastest.pass.R
+
+@Composable
+fun AddPaymentCardFormScreen() {
+    val keyboardController = LocalSoftwareKeyboardController.current
+    val focusManager = LocalFocusManager.current
+
+    Column(
+        modifier = Modifier
+            .fillMaxSize()
+            .padding(horizontal = 30.dp)
+            .padding(bottom = 15.dp)
+            .background(Color.Transparent)
+            .verticalScroll(rememberScrollState())
+    ) {
+        Spacer(modifier = Modifier.height(20.dp))
+        NameTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.name_on_card)
+        Spacer(modifier = Modifier.height(20.dp))
+        NameTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.type)
+        Spacer(modifier = Modifier.height(20.dp))
+        NumberTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.number, placeholder = "1234 1234 1234 1234")
+        Spacer(modifier = Modifier.height(20.dp))
+        NumberTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.security_code, placeholder = "CVV")
+        Spacer(modifier = Modifier.height(20.dp))
+        NumberTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.start_date, placeholder = "MM/YYYY")
+        Spacer(modifier = Modifier.height(20.dp))
+        NumberTextFieldAPCFS(keyboardController = keyboardController, focusManager = focusManager, labelText = R.string.expiration_date, placeholder = "MM/YYYY")
+        Spacer(modifier = Modifier.height(20.dp))
+        NotesTextFieldAPCFS(keyboardController, focusManager)
+        Spacer(modifier = Modifier.height(25.dp))
+        SaveButtonAPCFS(buttonText = R.string.save)
+    }
+}
+
+@Composable
+fun ColumnScope.NameTextFieldAPCFS(
+    keyboardController: SoftwareKeyboardController?,
+    focusManager: FocusManager,
+    labelText: Int
+) {
+    var text by remember { mutableStateOf("") }
+
+    TextField(
+        value = text,
+        onValueChange = {
+            text = it
+        },
+        textStyle = MaterialTheme.typography.displayMedium,
+        modifier = Modifier
+            .align(Alignment.Start)
+            .fillMaxWidth()
+            .defaultMinSize(minHeight = 60.dp)
+            .wrapContentHeight()
+            .border(
+                1.dp,
+                color = colorResource(id = R.color.gray_border_textfield),
+                shape = RoundedCornerShape(16.dp)
+            )
+            .background(color = colorResource(id = R.color.transparent)),
+        shape = RoundedCornerShape(16.dp),
+//        placeholder = {
+//            Text(
+//                text = stringResource(id = R.string.enter_email_address),
+//                color = colorResource(id = R.color.gray_splash),
+//                style = MaterialTheme.typography.displayMedium
+//            )
+//        },
+        label = {
+            Text(text = stringResource(id = labelText),
+                style = MaterialTheme.typography.titleSmall.copy(
+                    color = colorResource(id = R.color.gray_text)
+                )
+            )
+        },
+//        leadingIcon = {
+//            Image(
+//                painter = painterResource(id = R.drawable.profile_circle),
+//                contentDescription = "Title Logo",
+//                modifier = Modifier
+//                    .size(24.dp, 24.dp)
+//            )
+//        },
+        colors = TextFieldDefaults.colors(
+            focusedLabelColor = colorResource(id = R.color.gray_splash),
+            unfocusedContainerColor = colorResource(id = R.color.transparent),
+            focusedContainerColor = colorResource(id = R.color.transparent),
+            focusedIndicatorColor = colorResource(id = R.color.transparent),
+            disabledIndicatorColor = colorResource(id = R.color.transparent),
+            unfocusedIndicatorColor = colorResource(id = R.color.transparent),
+            cursorColor = colorResource(id = R.color.gray_splash),
+        ),
+        keyboardOptions = KeyboardOptions(
+            keyboardType = KeyboardType.Text,
+            imeAction = ImeAction.Next
+        ),
+        keyboardActions = KeyboardActions(
+            onDone = {
+                focusManager.clearFocus()
+                keyboardController?.hide()
+            }
+        ),
+    )
+}
+
+@Composable
+fun ColumnScope.NumberTextFieldAPCFS(
+    keyboardController: SoftwareKeyboardController?,
+    focusManager: FocusManager,
+    labelText: Int,
+    placeholder: String
+) {
+    var text by remember { mutableStateOf("") }
+
+    TextField(
+        value = text,
+        onValueChange = {
+            text = it
+        },
+        textStyle = MaterialTheme.typography.displayMedium,
+        modifier = Modifier
+            .align(Alignment.Start)
+            .fillMaxWidth()
+            .defaultMinSize(minHeight = 60.dp)
+            .wrapContentHeight()
+            .border(
+                1.dp,
+                color = colorResource(id = R.color.gray_border_textfield),
+                shape = RoundedCornerShape(16.dp)
+            )
+            .background(color = colorResource(id = R.color.transparent)),
+        shape = RoundedCornerShape(16.dp),
+        placeholder = {
+            Text(
+                text = placeholder,
+                style = MaterialTheme.typography.titleSmall.copy(
+                    color = colorResource(id = R.color.gray_text)
+                )
+            )
+        },
+        label = {
+            Text(text = stringResource(id = labelText),
+                style = MaterialTheme.typography.titleSmall.copy(
+                    color = colorResource(id = R.color.gray_text)
+                )
+            )
+        },
+//        leadingIcon = {
+//            Image(
+//                painter = painterResource(id = R.drawable.profile_circle),
+//                contentDescription = "Title Logo",
+//                modifier = Modifier
+//                    .size(24.dp, 24.dp)
+//            )
+//        },
+        colors = TextFieldDefaults.colors(
+            focusedLabelColor = colorResource(id = R.color.gray_splash),
+            unfocusedContainerColor = colorResource(id = R.color.transparent),
+            focusedContainerColor = colorResource(id = R.color.transparent),
+            focusedIndicatorColor = colorResource(id = R.color.transparent),
+            disabledIndicatorColor = colorResource(id = R.color.transparent),
+            unfocusedIndicatorColor = colorResource(id = R.color.transparent),
+            cursorColor = colorResource(id = R.color.gray_splash),
+        ),
+        keyboardOptions = KeyboardOptions(
+            keyboardType = KeyboardType.Number,
+            imeAction = ImeAction.Next
+        ),
+        keyboardActions = KeyboardActions(
+            onDone = {
+                focusManager.clearFocus()
+                keyboardController?.hide()
+            }
+        ),
+    )
+}
+
+@Composable
+fun ColumnScope.NotesTextFieldAPCFS(
+    keyboardController: SoftwareKeyboardController?,
+    focusManager: FocusManager
+) {
+    var notesText by remember { mutableStateOf("") }
+
+    TextField(
+        value = notesText,
+        onValueChange = {
+            notesText = it
+        },
+        textStyle = MaterialTheme.typography.displayMedium,
+        modifier = Modifier
+            .align(Alignment.Start)
+            .fillMaxWidth()
+            .defaultMinSize(minHeight = 60.dp)
+            .wrapContentHeight()
+            .border(
+                1.dp,
+                color = colorResource(id = R.color.gray_border_textfield),
+                shape = RoundedCornerShape(16.dp)
+            )
+            .background(color = colorResource(id = R.color.transparent))
+        ,
+        shape = RoundedCornerShape(16.dp),
+//        placeholder = {
+//            Text(
+//                text = stringResource(id = R.string.enter_email_address),
+//                color = colorResource(id = R.color.gray_splash),
+//                style = MaterialTheme.typography.displayMedium
+//            )
+//        },
+        label = {
+            Text(text = stringResource(R.string.notes),
+                style = MaterialTheme.typography.titleSmall.copy(
+                    color = colorResource(id = R.color.gray_text)
+                )
+            )
+        },
+//        leadingIcon = {
+//            Image(
+//                painter = painterResource(id = R.drawable.profile_circle),
+//                contentDescription = "Title Logo",
+//                modifier = Modifier
+//                    .size(24.dp, 24.dp)
+//            )
+//        },
+        colors = TextFieldDefaults.colors(
+            focusedLabelColor = colorResource(id = R.color.gray_splash),
+            unfocusedContainerColor = colorResource(id = R.color.transparent),
+            focusedContainerColor = colorResource(id = R.color.transparent),
+            focusedIndicatorColor = colorResource(id = R.color.transparent),
+            disabledIndicatorColor = colorResource(id = R.color.transparent),
+            unfocusedIndicatorColor = colorResource(id = R.color.transparent),
+            cursorColor = colorResource(id = R.color.gray_splash),
+        ),
+        keyboardOptions = KeyboardOptions(
+            keyboardType = KeyboardType.Text,
+            imeAction = ImeAction.Done
+        ),
+        keyboardActions = KeyboardActions(
+            onDone = {
+                focusManager.clearFocus()
+                keyboardController?.hide()
+            }
+        ),
+    )
+}
+
+@Composable
+fun ColumnScope.SaveButtonAPCFS(buttonText: Int) {
+    Button(
+        modifier = Modifier
+            .background(colorResource(id = R.color.transparent))
+            .fillMaxWidth()
+            .height(60.dp)
+            .clickable() { },
+        onClick = {},
+        shape = RoundedCornerShape(15.dp),
+//            border = BorderStroke(25.dp, colorResource(id = R.color.black)),
+        colors = ButtonDefaults.buttonColors(
+            contentColor = colorResource(id = R.color.white),
+            containerColor = colorResource(id = R.color.red_login_button),
+        ),
+    )
+    {
+        Text(
+            text = stringResource(id = buttonText),
+            style = MaterialTheme.typography.bodyMedium.copy(
+                fontSize = 20.sp,
+                color = colorResource(id = R.color.white)
+            ),
+            textAlign = TextAlign.Center
+        )
+    }
+}

+ 1 - 0
app/src/main/java/com/fastest/pass/home/presentation/ui/components/NewItemFormScreen.kt

@@ -64,6 +64,7 @@ fun NewItemFormScreen(screenName: String, screenNameType: ClickTypeAddNewItem, c
                 AddBankAccountFormScreen()
             }
             ClickTypeAddNewItem.Payment -> {
+                AddPaymentCardFormScreen()
             }
             ClickTypeAddNewItem.Wifi -> {
             }

+ 6 - 0
app/src/main/res/values/strings.xml

@@ -72,5 +72,11 @@
     <string name="pin">PIN</string>
     <string name="branch_address">Branch Address</string>
     <string name="branch_phone">Branch Phone</string>
+    <string name="name_on_card">Name on Card</string>
+    <string name="type">Type</string>
+    <string name="number">Number</string>
+    <string name="security_code">Security Code</string>
+    <string name="start_date">Start Date</string>
+    <string name="expiration_date">Expiration Date</string>
 
 </resources>