|
@@ -4,15 +4,12 @@ import android.content.Intent
|
|
|
import android.content.res.Configuration
|
|
|
import android.location.Location
|
|
|
import android.util.Log
|
|
|
-import android.widget.Toast
|
|
|
import androidx.compose.foundation.Image
|
|
|
import androidx.compose.foundation.background
|
|
|
import androidx.compose.foundation.border
|
|
|
import androidx.compose.foundation.gestures.detectTapGestures
|
|
|
-import androidx.compose.foundation.isSystemInDarkTheme
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
-import androidx.compose.foundation.layout.BoxScope
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
import androidx.compose.foundation.layout.ColumnScope
|
|
|
import androidx.compose.foundation.layout.Row
|
|
@@ -24,20 +21,14 @@ import androidx.compose.foundation.layout.height
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.foundation.text.ClickableText
|
|
|
import androidx.compose.foundation.text.KeyboardActions
|
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
-import androidx.compose.material.icons.filled.Done
|
|
|
-import androidx.compose.material.icons.filled.DoneOutline
|
|
|
-import androidx.compose.material.icons.filled.Email
|
|
|
-import androidx.compose.material.icons.filled.Lock
|
|
|
-import androidx.compose.material.icons.filled.Visibility
|
|
|
-import androidx.compose.material.icons.filled.VisibilityOff
|
|
|
import androidx.compose.material.icons.filled.Warning
|
|
|
import androidx.compose.material.icons.outlined.Visibility
|
|
|
-import androidx.compose.material.icons.sharp.Visibility
|
|
|
import androidx.compose.material3.Button
|
|
|
import androidx.compose.material3.ButtonDefaults
|
|
|
import androidx.compose.material3.CircularProgressIndicator
|
|
@@ -64,7 +55,6 @@ import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.draw.alpha
|
|
|
import androidx.compose.ui.draw.paint
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
-import androidx.compose.ui.graphics.vector.ImageVector
|
|
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
|
import androidx.compose.ui.layout.ContentScale
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
@@ -72,16 +62,13 @@ import androidx.compose.ui.platform.LocalFocusManager
|
|
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
import androidx.compose.ui.res.colorResource
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
-import androidx.compose.ui.res.vectorResource
|
|
|
import androidx.compose.ui.text.AnnotatedString
|
|
|
import androidx.compose.ui.text.TextStyle
|
|
|
-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.KeyboardType
|
|
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
|
-import androidx.compose.ui.text.style.LineHeightStyle
|
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
import androidx.compose.ui.unit.dp
|
|
@@ -93,7 +80,6 @@ import com.vpn.fastestvpnservice.R
|
|
|
import com.vpn.fastestvpnservice.beans.Server
|
|
|
import com.vpn.fastestvpnservice.beans.filterList
|
|
|
import com.vpn.fastestvpnservice.beans.isDarkTheme
|
|
|
-import com.vpn.fastestvpnservice.beans.themesList
|
|
|
import com.vpn.fastestvpnservice.constants.smartConnect
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
import com.vpn.fastestvpnservice.sealedClass.Screen
|
|
@@ -134,31 +120,50 @@ fun SignUp(navHostController: NavHostController) {
|
|
|
contentScale = ContentScale.FillBounds
|
|
|
)
|
|
|
.alpha(if (isSignUpEnabled!!) 0.6F else 1F)
|
|
|
-// .background(
|
|
|
-// if (isSystemInDarkTheme()) Color.Black
|
|
|
-// else Color.Transparent
|
|
|
-// )
|
|
|
+ .padding(padding)
|
|
|
.fillMaxSize()
|
|
|
.pointerInput(Unit) {
|
|
|
detectTapGestures {
|
|
|
focusManager.clearFocus()
|
|
|
keyboardController?.hide()
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
) {
|
|
|
ShowCustomSnackBar(snackBarState)
|
|
|
+ if (signUpViewModel.liveDataSignUpStatus.value == true) {
|
|
|
+ var progress by remember { mutableFloatStateOf(0.1F) }
|
|
|
+
|
|
|
+ LaunchedEffect(key1 = Unit) {
|
|
|
+ while (true) {
|
|
|
+ for (i in 1..100) {
|
|
|
+ progress = i.toFloat() / 100F
|
|
|
+ delay(150)
|
|
|
+ }
|
|
|
+ progress = 0.1F
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- Column (
|
|
|
+ CircularProgressIndicator(
|
|
|
+ progress = { progress },
|
|
|
+ modifier = Modifier
|
|
|
+ .align(Alignment.Center)
|
|
|
+ .size(50.dp),
|
|
|
+ color = colorResource(id = R.color.yellow_text),
|
|
|
+ strokeWidth = 5.dp,
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1st
|
|
|
+ Column(
|
|
|
modifier = Modifier
|
|
|
- .fillMaxHeight()
|
|
|
.fillMaxWidth()
|
|
|
- ,
|
|
|
- verticalArrangement = Arrangement.Top,
|
|
|
- horizontalAlignment = Alignment.CenterHorizontally
|
|
|
+ .wrapContentHeight()
|
|
|
+ .background(Color.Transparent)
|
|
|
+ .align(Alignment.TopCenter)
|
|
|
+ .padding(bottom = 10.dp),
|
|
|
+ verticalArrangement = Arrangement.SpaceBetween
|
|
|
) {
|
|
|
-
|
|
|
- Spacer(modifier = Modifier.height(50.dp))
|
|
|
-
|
|
|
IconButton(
|
|
|
onClick = {
|
|
|
if (!isSignUpEnabled) {
|
|
@@ -166,74 +171,98 @@ fun SignUp(navHostController: NavHostController) {
|
|
|
}
|
|
|
},
|
|
|
modifier = Modifier
|
|
|
- .padding(start = 16.dp, top = 25.dp)
|
|
|
+ .padding(start = 16.dp, top = 8.dp)
|
|
|
.align(Alignment.Start)
|
|
|
)
|
|
|
{
|
|
|
- Icon(painter = painterResource(
|
|
|
- id = R.drawable.back_arrow3x),
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(
|
|
|
+ id = R.drawable.back_arrow3x
|
|
|
+ ),
|
|
|
contentDescription = "Back Button",
|
|
|
tint = colorResource(id = R.color.white),
|
|
|
modifier = Modifier
|
|
|
.height(36.dp)
|
|
|
.width(36.dp)
|
|
|
- .align(Alignment.Start),
|
|
|
+ .align(Alignment.CenterHorizontally),
|
|
|
)
|
|
|
}
|
|
|
- Spacer(modifier = Modifier.height(44.dp))
|
|
|
-
|
|
|
+ Spacer(modifier = Modifier.height(0.dp))
|
|
|
Image(
|
|
|
painter = painterResource(id = R.drawable.fastestapp_logo3x),
|
|
|
contentDescription = "FastestVPN",
|
|
|
modifier = Modifier
|
|
|
.size(75.dp, 102.dp)
|
|
|
.background(Color.Transparent)
|
|
|
- .padding(top = 0.dp),
|
|
|
+ .padding(top = 0.dp)
|
|
|
+ .align(Alignment.CenterHorizontally),
|
|
|
)
|
|
|
- Spacer(modifier = Modifier.height(50.dp))
|
|
|
- Text(
|
|
|
- modifier = Modifier
|
|
|
- .padding(start = 15.dp)
|
|
|
- .align(Alignment.Start)
|
|
|
- ,
|
|
|
- style = MaterialTheme.typography.displayLarge,
|
|
|
- text = "Hello There!",
|
|
|
- color = Color.White,
|
|
|
- )
|
|
|
- Text(
|
|
|
- modifier = Modifier
|
|
|
- .padding(start = 15.dp)
|
|
|
- .align(Alignment.Start)
|
|
|
- .alpha(0.6F),
|
|
|
- style = MaterialTheme.typography.customTypography.labelLarge,
|
|
|
- text = "Please register your account.",
|
|
|
- color = colorResource(id = R.color.white),
|
|
|
- )
|
|
|
- Spacer(modifier = Modifier.height(20.dp))
|
|
|
+ }
|
|
|
|
|
|
- val colorEmail = if (showErrorEmail || showErrorEmail2) {
|
|
|
- colorResource(id = R.color.red)
|
|
|
- } else {
|
|
|
- colorResource(id = R.color.white)
|
|
|
- }
|
|
|
+ Spacer(modifier = Modifier.height(0.dp))
|
|
|
+ // 2nd
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .wrapContentHeight()
|
|
|
+ .background(Color.Transparent)
|
|
|
+ .align(Alignment.Center)
|
|
|
+ .padding(top = 12.dp),
|
|
|
+ verticalArrangement = Arrangement.Center,
|
|
|
+ horizontalAlignment = Alignment.CenterHorizontally
|
|
|
+ ) {
|
|
|
|
|
|
- TextField(
|
|
|
- value = textChanged,
|
|
|
- onValueChange = {
|
|
|
- textChanged = it
|
|
|
- },
|
|
|
- readOnly = isSignUpEnabled,
|
|
|
- textStyle = MaterialTheme.typography.customTypography.bodyMedium,
|
|
|
+ Column(
|
|
|
modifier = Modifier
|
|
|
- .padding(start = 15.dp, end = 15.dp, top = 10.dp)
|
|
|
- .align(Alignment.Start)
|
|
|
.fillMaxWidth()
|
|
|
- .height(60.dp)
|
|
|
- .border(
|
|
|
- 1.dp,
|
|
|
- color = colorEmail,
|
|
|
- shape = RoundedCornerShape(16.dp)
|
|
|
- ),
|
|
|
+ .wrapContentHeight(),
|
|
|
+ verticalArrangement = Arrangement.Center
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp, top = 2.dp)
|
|
|
+ .align(Alignment.Start)
|
|
|
+ ,
|
|
|
+ style = MaterialTheme.typography.displayLarge,
|
|
|
+ text = "Hello There!",
|
|
|
+ color = Color.White,
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp, top = 4.dp)
|
|
|
+ .align(Alignment.Start)
|
|
|
+ .alpha(0.6F),
|
|
|
+ style = MaterialTheme.typography.customTypography.labelLarge,
|
|
|
+ text = "Please register your account.",
|
|
|
+ color = colorResource(id = R.color.white),
|
|
|
+ )
|
|
|
+ Spacer(modifier = Modifier.height(8.dp))
|
|
|
+
|
|
|
+ val colorEmail = if (showErrorEmail || showErrorEmail2) {
|
|
|
+ colorResource(id = R.color.red)
|
|
|
+ } else {
|
|
|
+ colorResource(id = R.color.white)
|
|
|
+ }
|
|
|
+
|
|
|
+ TextField(
|
|
|
+ value = textChanged,
|
|
|
+ onValueChange = {
|
|
|
+ textChanged = it
|
|
|
+ },
|
|
|
+ readOnly = isSignUpEnabled,
|
|
|
+ textStyle = MaterialTheme.typography.customTypography.bodyMedium,
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp, end = 15.dp, top = 10.dp)
|
|
|
+ .align(Alignment.Start)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(60.dp)
|
|
|
+ .border(
|
|
|
+ 1.dp,
|
|
|
+ color = colorEmail,
|
|
|
+ shape = RoundedCornerShape(16.dp)
|
|
|
+ ),
|
|
|
+ shape = RoundedCornerShape(16.dp),
|
|
|
+
|
|
|
|
|
|
// placeholder = {
|
|
|
// Text(text = "Enter email address",
|
|
@@ -241,285 +270,298 @@ fun SignUp(navHostController: NavHostController) {
|
|
|
// fontSize = 14.sp,
|
|
|
// )
|
|
|
// },
|
|
|
- label = {
|
|
|
- Text(text = "Email",
|
|
|
- style = MaterialTheme.typography.customTypography.bodySmall
|
|
|
- )
|
|
|
- },
|
|
|
- leadingIcon = {
|
|
|
- Icon(
|
|
|
- painter = painterResource(id = R.drawable.sms3x),
|
|
|
- contentDescription = "Email Logo",
|
|
|
- tint = colorResource(id = R.color.white),
|
|
|
- modifier = Modifier
|
|
|
- .size(24.dp, 24.dp)
|
|
|
- )
|
|
|
- },
|
|
|
- maxLines = 1,
|
|
|
- colors = TextFieldDefaults.colors(
|
|
|
- focusedLabelColor = Color.Blue,
|
|
|
- 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.white)
|
|
|
- ),
|
|
|
- keyboardOptions = KeyboardOptions(
|
|
|
- keyboardType = KeyboardType.Email,
|
|
|
- imeAction = ImeAction.Done
|
|
|
- ),
|
|
|
- keyboardActions = KeyboardActions(
|
|
|
- onDone = {
|
|
|
- focusManager.clearFocus()
|
|
|
- keyboardController?.hide()
|
|
|
- }
|
|
|
- ),
|
|
|
- )
|
|
|
+ label = {
|
|
|
+ Text(text = "Email",
|
|
|
+ style = MaterialTheme.typography.customTypography.bodySmall
|
|
|
+ )
|
|
|
+ },
|
|
|
+ leadingIcon = {
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.sms3x),
|
|
|
+ contentDescription = "Email Logo",
|
|
|
+ tint = colorResource(id = R.color.white),
|
|
|
+ modifier = Modifier
|
|
|
+ .size(24.dp, 24.dp)
|
|
|
+ )
|
|
|
+ },
|
|
|
+ maxLines = 1,
|
|
|
+ colors = TextFieldDefaults.colors(
|
|
|
+ focusedLabelColor = Color.Blue,
|
|
|
+ unfocusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
|
+ focusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ disabledIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ unfocusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ cursorColor = colorResource(id = R.color.white)
|
|
|
+ ),
|
|
|
+ keyboardOptions = KeyboardOptions(
|
|
|
+ keyboardType = KeyboardType.Email,
|
|
|
+ imeAction = ImeAction.Done
|
|
|
+ ),
|
|
|
+ keyboardActions = KeyboardActions(
|
|
|
+ onDone = {
|
|
|
+ focusManager.clearFocus()
|
|
|
+ keyboardController?.hide()
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ )
|
|
|
|
|
|
- if (showErrorEmail) {
|
|
|
- ShowErrorRow(errorText = "Email is Empty")
|
|
|
- }
|
|
|
- else if (showErrorEmail2) {
|
|
|
- ShowErrorRow(errorText = "Email format incorrect")
|
|
|
- }
|
|
|
+// if (showErrorEmail) {
|
|
|
+// ShowErrorRow(errorText = "Email is Empty")
|
|
|
+// }
|
|
|
+// else if (showErrorEmail2) {
|
|
|
+// ShowErrorRow(errorText = "Email format incorrect")
|
|
|
+// }
|
|
|
|
|
|
- Spacer(modifier = Modifier.height(20.dp))
|
|
|
+ Spacer(modifier = Modifier.height(20.dp))
|
|
|
|
|
|
- val colorPass = if (showErrorPass1 || showErrorPass2) {
|
|
|
- colorResource(id = R.color.red)
|
|
|
- } else {
|
|
|
- MaterialTheme.colorScheme.secondaryContainer
|
|
|
- }
|
|
|
-
|
|
|
- TextField(
|
|
|
- value = passwordChanged,
|
|
|
- onValueChange = {
|
|
|
- Log.d("onClick_test", "onValueChange -> ")
|
|
|
- passwordChanged = it
|
|
|
- },
|
|
|
- readOnly = isSignUpEnabled,
|
|
|
- textStyle = MaterialTheme.typography.customTypography.bodyMedium,
|
|
|
- modifier = Modifier
|
|
|
- .padding(start = 15.dp, end = 15.dp)
|
|
|
- .align(Alignment.Start)
|
|
|
- .fillMaxWidth()
|
|
|
- .height(60.dp)
|
|
|
- .border(
|
|
|
- 1.dp,
|
|
|
- color = colorPass,
|
|
|
- shape = RoundedCornerShape(16.dp)
|
|
|
- )
|
|
|
- .background(color = colorResource(id = R.color.transparent)),
|
|
|
+ val colorPass = if (showErrorPass1 || showErrorPass2) {
|
|
|
+ colorResource(id = R.color.red)
|
|
|
+ } else {
|
|
|
+ colorResource(id = R.color.white)
|
|
|
+ }
|
|
|
|
|
|
- shape = RoundedCornerShape(15.dp),
|
|
|
+ TextField(
|
|
|
+ value = passwordChanged,
|
|
|
+ onValueChange = {
|
|
|
+ Log.d("onClick_test", "onValueChange -> ")
|
|
|
+ passwordChanged = it
|
|
|
+ },
|
|
|
+ readOnly = isSignUpEnabled,
|
|
|
+ textStyle = MaterialTheme.typography.customTypography.bodyMedium,
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp, end = 15.dp)
|
|
|
+ .align(Alignment.Start)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(60.dp)
|
|
|
+ .border(
|
|
|
+ 1.dp,
|
|
|
+ color = colorPass,
|
|
|
+ shape = RoundedCornerShape(16.dp)
|
|
|
+ )
|
|
|
+ .background(color = colorResource(id = R.color.transparent)),
|
|
|
+
|
|
|
+ shape = RoundedCornerShape(16.dp),
|
|
|
// placeholder = {
|
|
|
// Text(text = "Enter password",
|
|
|
// color = colorResource(id = R.color.white))
|
|
|
// },
|
|
|
- label = {
|
|
|
- Text(text = "Password",
|
|
|
- style = MaterialTheme.typography.customTypography.bodyLarge
|
|
|
- )
|
|
|
- },
|
|
|
- leadingIcon = {
|
|
|
- Icon(
|
|
|
- painter = painterResource(id = R.drawable.lock3x),
|
|
|
- contentDescription = "Password Logo",
|
|
|
- tint = colorResource(id = R.color.white),
|
|
|
- modifier = Modifier
|
|
|
- .size(24.dp, 24.dp)
|
|
|
- )
|
|
|
- },
|
|
|
- maxLines = 1,
|
|
|
- colors = TextFieldDefaults.colors(
|
|
|
- focusedLabelColor = Color.Blue,
|
|
|
- unfocusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
|
- focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
|
- focusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
- disabledIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
- unfocusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
- cursorColor = colorResource(id = R.color.white)
|
|
|
- ),
|
|
|
- keyboardOptions = KeyboardOptions(
|
|
|
- keyboardType = KeyboardType.Password,
|
|
|
- imeAction = ImeAction.Done
|
|
|
- ),
|
|
|
- keyboardActions = KeyboardActions(
|
|
|
- onDone = {
|
|
|
- focusManager.clearFocus()
|
|
|
- keyboardController?.hide()
|
|
|
- }
|
|
|
- ),
|
|
|
- visualTransformation =
|
|
|
- if (passwordVisible) VisualTransformation.None
|
|
|
- else PasswordVisualTransformation(),
|
|
|
+ label = {
|
|
|
+ Text(text = "Password",
|
|
|
+ style = MaterialTheme.typography.customTypography.bodyLarge
|
|
|
+ )
|
|
|
+ },
|
|
|
+ leadingIcon = {
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.lock3x),
|
|
|
+ contentDescription = "Password Logo",
|
|
|
+ tint = colorResource(id = R.color.white),
|
|
|
+ modifier = Modifier
|
|
|
+ .size(24.dp, 24.dp)
|
|
|
+ )
|
|
|
+ },
|
|
|
+ maxLines = 1,
|
|
|
+ colors = TextFieldDefaults.colors(
|
|
|
+ focusedLabelColor = Color.Blue,
|
|
|
+ unfocusedContainerColor = colorResource(id = R.color.transparent),
|
|
|
+ focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
|
+ focusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ disabledIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ unfocusedIndicatorColor = colorResource(id = R.color.transparent),
|
|
|
+ cursorColor = colorResource(id = R.color.white)
|
|
|
+ ),
|
|
|
+ keyboardOptions = KeyboardOptions(
|
|
|
+ keyboardType = KeyboardType.Password,
|
|
|
+ imeAction = ImeAction.Done
|
|
|
+ ),
|
|
|
+ keyboardActions = KeyboardActions(
|
|
|
+ onDone = {
|
|
|
+ focusManager.clearFocus()
|
|
|
+ keyboardController?.hide()
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ visualTransformation =
|
|
|
+ if (passwordVisible) VisualTransformation.None
|
|
|
+ else PasswordVisualTransformation(),
|
|
|
|
|
|
- trailingIcon = {
|
|
|
- Log.d("onClick_test", "trailingIcon -> ")
|
|
|
+ trailingIcon = {
|
|
|
+ Log.d("onClick_test", "trailingIcon -> ")
|
|
|
|
|
|
// val image
|
|
|
// = if (passwordVisible) Icons.Filled.Visibility
|
|
|
// else Icons.Filled.VisibilityOff
|
|
|
|
|
|
- val description = if (passwordVisible) "Hide Password"
|
|
|
- else "Show Password"
|
|
|
+ val description = if (passwordVisible) "Hide Password"
|
|
|
+ else "Show Password"
|
|
|
+
|
|
|
+ IconButton(onClick = {
|
|
|
+ if (!isSignUpEnabled) {
|
|
|
+ passwordVisible = !passwordVisible
|
|
|
+ }
|
|
|
+ })
|
|
|
+ {
|
|
|
+ if (passwordVisible) {
|
|
|
+ Icon(
|
|
|
+ imageVector = Icons.Outlined.Visibility,
|
|
|
+ contentDescription = description,
|
|
|
+ tint = colorResource(id = R.color.white),
|
|
|
+ modifier = Modifier.size(24.dp)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.eye_slash3x),
|
|
|
+ contentDescription = description,
|
|
|
+ tint = colorResource(id = R.color.white),
|
|
|
+ modifier = Modifier.size(24.dp)
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
- IconButton(onClick = {
|
|
|
- if (!isSignUpEnabled) {
|
|
|
- passwordVisible = !passwordVisible
|
|
|
}
|
|
|
- })
|
|
|
- {
|
|
|
- if (passwordVisible) {
|
|
|
- Icon(
|
|
|
- imageVector = Icons.Outlined.Visibility,
|
|
|
- contentDescription = description,
|
|
|
- tint = colorResource(id = R.color.white),
|
|
|
- modifier = Modifier.size(24.dp)
|
|
|
- )
|
|
|
- }
|
|
|
- else {
|
|
|
- Icon(
|
|
|
- painter = painterResource(id = R.drawable.eye_slash3x),
|
|
|
- contentDescription = description,
|
|
|
- tint = colorResource(id = R.color.white),
|
|
|
- modifier = Modifier.size(24.dp)
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
- }
|
|
|
- )
|
|
|
-
|
|
|
- if (showErrorPass1) {
|
|
|
- ShowErrorRow(errorText = "Password is Empty")
|
|
|
- }
|
|
|
- else if (showErrorPass2) {
|
|
|
- ShowErrorRow(errorText = "Should be 3 or more!")
|
|
|
- }
|
|
|
+ )
|
|
|
|
|
|
- Spacer(modifier = Modifier.height(15.dp))
|
|
|
+// if (showErrorPass1) {
|
|
|
+// ShowErrorRow(errorText = "Password is Empty")
|
|
|
+// }
|
|
|
+// else if (showErrorPass2) {
|
|
|
+// ShowErrorRow(errorText = "Should be 3 or more!")
|
|
|
+// }
|
|
|
|
|
|
- Row (
|
|
|
- modifier = Modifier
|
|
|
- .padding(start = 15.dp, top = 16.dp)
|
|
|
- .fillMaxWidth(),
|
|
|
- ){
|
|
|
-
|
|
|
- val colorLogo = if (showErrorEmail || showErrorEmail2 || showErrorPass1 || showErrorPass2) colorResource(
|
|
|
- id = R.color.red
|
|
|
- ) else colorResource(id = R.color.white)
|
|
|
+ Spacer(modifier = Modifier.height(10.dp))
|
|
|
|
|
|
- Icon(
|
|
|
- painter = painterResource(id = R.drawable.tick_square3x),
|
|
|
- contentDescription = "Logo",
|
|
|
- tint = colorLogo,
|
|
|
- modifier = Modifier.size(24.dp, 24.dp)
|
|
|
- )
|
|
|
- Text(
|
|
|
+ Row (
|
|
|
modifier = Modifier
|
|
|
- .padding(start = 15.dp),
|
|
|
- style = MaterialTheme.typography.customTypography.bodyLarge,
|
|
|
- text = "By creating your account, you agree to",
|
|
|
- color = colorResource(id = R.color.white),
|
|
|
- )
|
|
|
- }
|
|
|
+ .padding(start = 15.dp, top = 15.dp)
|
|
|
+ .fillMaxWidth(),
|
|
|
+ ){
|
|
|
|
|
|
- Spacer(modifier = Modifier.height(0.dp))
|
|
|
+ val colorLogo = if (showErrorEmail || showErrorEmail2 || showErrorPass1 || showErrorPass2) colorResource(
|
|
|
+ id = R.color.red
|
|
|
+ ) else colorResource(id = R.color.white)
|
|
|
|
|
|
- Row (
|
|
|
- modifier = Modifier
|
|
|
- .padding(start = 15.dp)
|
|
|
- .fillMaxWidth(),
|
|
|
- ){
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.tick_square3x),
|
|
|
+ contentDescription = "Logo",
|
|
|
+ tint = colorLogo,
|
|
|
+ modifier = Modifier.size(24.dp, 24.dp)
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp),
|
|
|
+ style = MaterialTheme.typography.customTypography.bodyLarge,
|
|
|
+ text = "By creating your account, you agree to",
|
|
|
+ color = colorResource(id = R.color.white),
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
- Icon(
|
|
|
- painter = painterResource(id = R.drawable.tick_square3x),
|
|
|
- contentDescription = "Logo",
|
|
|
- tint = colorResource(id = R.color.transparent),
|
|
|
- modifier = Modifier.size(24.dp),
|
|
|
- )
|
|
|
- ClickableText(
|
|
|
- onClick = {
|
|
|
- if (!isSignUpEnabled) {
|
|
|
- navHostController.navigate(
|
|
|
- Screen.TermsAndConditions.route
|
|
|
- )
|
|
|
- }
|
|
|
- },
|
|
|
+ Spacer(modifier = Modifier.height(0.dp))
|
|
|
+
|
|
|
+ Row (
|
|
|
modifier = Modifier
|
|
|
- .padding(start = 15.dp),
|
|
|
- text = AnnotatedString("Terms & Conditions"),
|
|
|
- style = MaterialTheme.typography.customTypography.titleLarge
|
|
|
- )
|
|
|
- }
|
|
|
+ .padding(start = 15.dp)
|
|
|
+ .fillMaxWidth(),
|
|
|
+ ){
|
|
|
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.tick_square3x),
|
|
|
+ contentDescription = "Logo",
|
|
|
+ tint = colorResource(id = R.color.transparent),
|
|
|
+ modifier = Modifier.size(24.dp),
|
|
|
+ )
|
|
|
+ ClickableText(
|
|
|
+ onClick = {
|
|
|
+ if (!isSignUpEnabled) {
|
|
|
+ navHostController.navigate(
|
|
|
+ Screen.TermsAndConditions.route
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 15.dp),
|
|
|
+ text = AnnotatedString("Terms & Conditions"),
|
|
|
+ style = MaterialTheme.typography.customTypography.titleLarge
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- SignUpButton(
|
|
|
- signUpViewModel,
|
|
|
- textChanged,
|
|
|
- passwordChanged,
|
|
|
- navHostController,
|
|
|
- showErrorEmail1 = {
|
|
|
- showErrorEmail = it
|
|
|
- },
|
|
|
- showErrorEmail,
|
|
|
- showErrorPass1 = {
|
|
|
- showErrorPass1 = it
|
|
|
- },
|
|
|
- showErrorPass1,
|
|
|
- showErrorPass2 = {
|
|
|
- showErrorPass2 = it
|
|
|
- },
|
|
|
- showErrorPass2,
|
|
|
- showErrorEmail2 = {
|
|
|
- showErrorEmail2 = it
|
|
|
- },
|
|
|
- showErrorEmail2,
|
|
|
- snackBarState
|
|
|
- )
|
|
|
-
|
|
|
- Row (
|
|
|
+ // 3rd
|
|
|
+ Column(
|
|
|
modifier = Modifier
|
|
|
+ .background(Color.Transparent)
|
|
|
.align(Alignment.BottomCenter)
|
|
|
- .padding(40.dp),
|
|
|
- ){
|
|
|
- Text(
|
|
|
- modifier = Modifier
|
|
|
- .padding(0.dp),
|
|
|
- style = MaterialTheme.typography.customTypography.labelLarge,
|
|
|
- text = "Already have an account? ",
|
|
|
- color = Color.White,
|
|
|
- )
|
|
|
- ClickableText(
|
|
|
- onClick = {
|
|
|
- if (!isSignUpEnabled) {
|
|
|
- navHostController.popBackStack()
|
|
|
-
|
|
|
- if (navHostController.currentDestination?.id != null &&
|
|
|
- navHostController.currentDestination?.route != null){
|
|
|
- Log.d("test_signup", "From Sign In -> id = " + navHostController.currentDestination?.id
|
|
|
- + " route = " + navHostController.currentDestination?.route
|
|
|
- )
|
|
|
- }
|
|
|
- else {
|
|
|
- Log.d("test_signup", "From Sign Up -> id = " + navHostController.currentDestination?.id
|
|
|
- + " route = " + navHostController.currentDestination?.route
|
|
|
- )
|
|
|
- navHostController.navigate(Screen.Login.route)
|
|
|
- }
|
|
|
- }
|
|
|
+ .padding(top = 5.dp),
|
|
|
+ ) {
|
|
|
+ SignUpButton(
|
|
|
+ signUpViewModel,
|
|
|
+ textChanged,
|
|
|
+ passwordChanged,
|
|
|
+ navHostController,
|
|
|
+ showErrorEmail1 = {
|
|
|
+ showErrorEmail = it
|
|
|
+ },
|
|
|
+ showErrorEmail,
|
|
|
+ showErrorPass1 = {
|
|
|
+ showErrorPass1 = it
|
|
|
+ },
|
|
|
+ showErrorPass1,
|
|
|
+ showErrorPass2 = {
|
|
|
+ showErrorPass2 = it
|
|
|
+ },
|
|
|
+ showErrorPass2,
|
|
|
+ showErrorEmail2 = {
|
|
|
+ showErrorEmail2 = it
|
|
|
+ },
|
|
|
+ showErrorEmail2,
|
|
|
+ snackBarState
|
|
|
+ )
|
|
|
|
|
|
- },
|
|
|
- modifier = Modifier
|
|
|
- .padding(0.dp),
|
|
|
- style = MaterialTheme.typography.customTypography.titleMedium,
|
|
|
- text = AnnotatedString(" Sign In"),
|
|
|
- )
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(bottom = 25.dp)
|
|
|
+ .align(Alignment.CenterHorizontally),
|
|
|
+ horizontalArrangement = Arrangement.Center
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(0.dp),
|
|
|
+ style = MaterialTheme.typography.customTypography.labelLarge,
|
|
|
+ text = "Already have an account? ",
|
|
|
+ color = Color.White,
|
|
|
+ )
|
|
|
+ ClickableText(
|
|
|
+ onClick = {
|
|
|
+ if (!isSignUpEnabled) {
|
|
|
+ navHostController.popBackStack()
|
|
|
+
|
|
|
+ if (navHostController.currentDestination?.id != null &&
|
|
|
+ navHostController.currentDestination?.route != null
|
|
|
+ ) {
|
|
|
+ Log.d(
|
|
|
+ "test_signup",
|
|
|
+ "From Sign In -> id = " + navHostController.currentDestination?.id
|
|
|
+ + " route = " + navHostController.currentDestination?.route
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ Log.d(
|
|
|
+ "test_signup",
|
|
|
+ "From Sign Up -> id = " + navHostController.currentDestination?.id
|
|
|
+ + " route = " + navHostController.currentDestination?.route
|
|
|
+ )
|
|
|
+ navHostController.navigate(Screen.Login.route)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(0.dp),
|
|
|
+ style = MaterialTheme.typography.customTypography.titleMedium,
|
|
|
+ text = AnnotatedString(" Sign In"),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
)
|
|
|
}
|
|
@@ -873,29 +915,29 @@ fun SignUp2(navHostController: NavHostController) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- SignUpButton(
|
|
|
- signUpViewModel,
|
|
|
- textChanged,
|
|
|
- passwordChanged,
|
|
|
- navHostController,
|
|
|
- showErrorEmail1 = {
|
|
|
- showErrorEmail = it
|
|
|
- },
|
|
|
- showErrorEmail,
|
|
|
- showErrorPass1 = {
|
|
|
- showErrorPass1 = it
|
|
|
- },
|
|
|
- showErrorPass1,
|
|
|
- showErrorPass2 = {
|
|
|
- showErrorPass2 = it
|
|
|
- },
|
|
|
- showErrorPass2,
|
|
|
- showErrorEmail2 = {
|
|
|
- showErrorEmail2 = it
|
|
|
- },
|
|
|
- showErrorEmail2,
|
|
|
- snackBarState
|
|
|
- )
|
|
|
+// SignUpButton(
|
|
|
+// signUpViewModel,
|
|
|
+// textChanged,
|
|
|
+// passwordChanged,
|
|
|
+// navHostController,
|
|
|
+// showErrorEmail1 = {
|
|
|
+// showErrorEmail = it
|
|
|
+// },
|
|
|
+// showErrorEmail,
|
|
|
+// showErrorPass1 = {
|
|
|
+// showErrorPass1 = it
|
|
|
+// },
|
|
|
+// showErrorPass1,
|
|
|
+// showErrorPass2 = {
|
|
|
+// showErrorPass2 = it
|
|
|
+// },
|
|
|
+// showErrorPass2,
|
|
|
+// showErrorEmail2 = {
|
|
|
+// showErrorEmail2 = it
|
|
|
+// },
|
|
|
+// showErrorEmail2,
|
|
|
+// snackBarState
|
|
|
+// )
|
|
|
|
|
|
Row (
|
|
|
modifier = Modifier
|
|
@@ -968,7 +1010,7 @@ fun ColumnScope.ShowErrorRowSignUp(
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-fun BoxScope.SignUpButton(
|
|
|
+fun ColumnScope.SignUpButton(
|
|
|
signUpViewModel: SignUpViewModel,
|
|
|
email: String,
|
|
|
password: String,
|
|
@@ -1016,28 +1058,7 @@ fun BoxScope.SignUpButton(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (signUpViewModel.liveDataSignUpStatus.value == true) {
|
|
|
- var progress by remember { mutableFloatStateOf(0.1F) }
|
|
|
|
|
|
- LaunchedEffect(key1 = Unit) {
|
|
|
- while (true) {
|
|
|
- for (i in 1..100) {
|
|
|
- progress = i.toFloat()/100F
|
|
|
- delay(150)
|
|
|
- }
|
|
|
- progress = 0.1F
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CircularProgressIndicator(
|
|
|
- progress = { progress },
|
|
|
- modifier = Modifier
|
|
|
- .align(Alignment.Center)
|
|
|
- .size(50.dp),
|
|
|
- color = colorResource(id = R.color.yellow_text),
|
|
|
- strokeWidth = 5.dp,
|
|
|
- )
|
|
|
- }
|
|
|
|
|
|
Button(
|
|
|
onClick = {
|
|
@@ -1076,9 +1097,8 @@ fun BoxScope.SignUpButton(
|
|
|
modifier = Modifier
|
|
|
.padding(
|
|
|
start = 15.dp, end = 15.dp,
|
|
|
- bottom = 100.dp
|
|
|
+ bottom = 25.dp
|
|
|
)
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
.background(colorResource(id = R.color.transparent))
|
|
|
.fillMaxWidth()
|
|
|
.height(60.dp),
|