|
@@ -1,5 +1,6 @@
|
|
package com.vpn.fastestvpnservice.screensTV
|
|
package com.vpn.fastestvpnservice.screensTV
|
|
|
|
|
|
|
|
+import android.util.Log
|
|
import androidx.compose.foundation.BorderStroke
|
|
import androidx.compose.foundation.BorderStroke
|
|
import androidx.compose.foundation.Image
|
|
import androidx.compose.foundation.Image
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.background
|
|
@@ -25,6 +26,7 @@ import androidx.compose.material3.Text
|
|
import androidx.compose.material3.TextField
|
|
import androidx.compose.material3.TextField
|
|
import androidx.compose.material3.TextFieldDefaults
|
|
import androidx.compose.material3.TextFieldDefaults
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.Composable
|
|
|
|
+import androidx.compose.runtime.LaunchedEffect
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.remember
|
|
import androidx.compose.runtime.remember
|
|
@@ -62,15 +64,20 @@ import com.vpn.fastestvpnservice.ui.theme.customTypography
|
|
@Composable
|
|
@Composable
|
|
fun LoginTV(navHostController: NavHostController) {
|
|
fun LoginTV(navHostController: NavHostController) {
|
|
val context = LocalContext.current
|
|
val context = LocalContext.current
|
|
- val basePreferenceHelper = BasePreferenceHelper(context)
|
|
|
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
val focusManager = LocalFocusManager.current
|
|
val focusManager = LocalFocusManager.current
|
|
var textChanged by remember { mutableStateOf("") }
|
|
var textChanged by remember { mutableStateOf("") }
|
|
var passwordChanged by remember { mutableStateOf("") }
|
|
var passwordChanged by remember { mutableStateOf("") }
|
|
- var showErrorEmail by remember { mutableStateOf(false) }
|
|
|
|
- var isTextFieldFocused by remember { mutableStateOf(false) }
|
|
|
|
- var isTextFieldFocused2 by remember { mutableStateOf(false) }
|
|
|
|
-// val focusRequester = remember { FocusRequester() }
|
|
|
|
|
|
+ val showErrorEmail by remember { mutableStateOf(false) }
|
|
|
|
+ val isTextFieldFocused by remember { mutableStateOf(false) }
|
|
|
|
+ val isTextFieldFocused2 by remember { mutableStateOf(false) }
|
|
|
|
+ val focusRequester1 = remember { FocusRequester() }
|
|
|
|
+ val focusRequester2 = remember { FocusRequester() }
|
|
|
|
+ val focusRequester3 = remember { FocusRequester() }
|
|
|
|
+
|
|
|
|
+ LaunchedEffect(key1 = Unit) {
|
|
|
|
+ focusRequester1.requestFocus()
|
|
|
|
+ }
|
|
|
|
|
|
Scaffold(
|
|
Scaffold(
|
|
content = { padding ->
|
|
content = { padding ->
|
|
@@ -124,13 +131,12 @@ fun LoginTV(navHostController: NavHostController) {
|
|
shape = RoundedCornerShape(16.dp)
|
|
shape = RoundedCornerShape(16.dp)
|
|
)
|
|
)
|
|
.background(color = colorResource(id = R.color.transparent))
|
|
.background(color = colorResource(id = R.color.transparent))
|
|
-// .focusRequester(focusRequester)
|
|
|
|
|
|
+ .focusRequester(focusRequester1)
|
|
// .onFocusChanged {
|
|
// .onFocusChanged {
|
|
-// isTextFieldFocused = it.isFocused
|
|
|
|
-// keyboardController?.show()
|
|
|
|
|
|
+//// isTextFieldFocused = it.isFocused
|
|
|
|
+// focusRequester2.requestFocus()
|
|
// }
|
|
// }
|
|
// .focusable()
|
|
// .focusable()
|
|
-// .clickable() {}
|
|
|
|
,
|
|
,
|
|
shape = RoundedCornerShape(16.dp),
|
|
shape = RoundedCornerShape(16.dp),
|
|
label = {
|
|
label = {
|
|
@@ -166,6 +172,7 @@ fun LoginTV(navHostController: NavHostController) {
|
|
onDone = {
|
|
onDone = {
|
|
focusManager.clearFocus()
|
|
focusManager.clearFocus()
|
|
keyboardController?.hide()
|
|
keyboardController?.hide()
|
|
|
|
+ focusRequester2.requestFocus()
|
|
}
|
|
}
|
|
),
|
|
),
|
|
)
|
|
)
|
|
@@ -189,12 +196,12 @@ fun LoginTV(navHostController: NavHostController) {
|
|
else colorResource(id = R.color.white),
|
|
else colorResource(id = R.color.white),
|
|
shape = RoundedCornerShape(16.dp)
|
|
shape = RoundedCornerShape(16.dp)
|
|
)
|
|
)
|
|
|
|
+ .focusRequester(focusRequester2)
|
|
// .background(color = colorResource(id = R.color.transparent))
|
|
// .background(color = colorResource(id = R.color.transparent))
|
|
// .onFocusChanged {
|
|
// .onFocusChanged {
|
|
// isTextFieldFocused2 = it.isFocused
|
|
// isTextFieldFocused2 = it.isFocused
|
|
// }
|
|
// }
|
|
// .focusable()
|
|
// .focusable()
|
|
-// .clickable() {}
|
|
|
|
,
|
|
,
|
|
|
|
|
|
leadingIcon = {
|
|
leadingIcon = {
|
|
@@ -231,11 +238,12 @@ fun LoginTV(navHostController: NavHostController) {
|
|
onDone = {
|
|
onDone = {
|
|
focusManager.clearFocus()
|
|
focusManager.clearFocus()
|
|
keyboardController?.hide()
|
|
keyboardController?.hide()
|
|
|
|
+ focusRequester3.requestFocus()
|
|
}
|
|
}
|
|
),
|
|
),
|
|
)
|
|
)
|
|
Spacer(modifier = Modifier.height(25.dp))
|
|
Spacer(modifier = Modifier.height(25.dp))
|
|
- LoginButtonTV(navHostController)
|
|
|
|
|
|
+ LoginButtonTV(navHostController, focusRequester3)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -243,25 +251,21 @@ fun LoginTV(navHostController: NavHostController) {
|
|
}
|
|
}
|
|
|
|
|
|
@Composable
|
|
@Composable
|
|
-fun ColumnScope.LoginButtonTV(navHostController: NavHostController) {
|
|
|
|
|
|
+fun ColumnScope.LoginButtonTV(navHostController: NavHostController,
|
|
|
|
+ focusRequester3: FocusRequester) {
|
|
var isButtonFocused by remember { mutableStateOf(false) }
|
|
var isButtonFocused by remember { mutableStateOf(false) }
|
|
- val focusRequester = remember { FocusRequester() }
|
|
|
|
- val focusManager = LocalFocusManager.current
|
|
|
|
- val context = LocalContext.current
|
|
|
|
Button(
|
|
Button(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
.background(colorResource(id = R.color.transparent))
|
|
.background(colorResource(id = R.color.transparent))
|
|
.fillMaxWidth(fraction = 0.5f)
|
|
.fillMaxWidth(fraction = 0.5f)
|
|
.height(60.dp)
|
|
.height(60.dp)
|
|
- .focusRequester(focusRequester)
|
|
|
|
|
|
+ .focusRequester(focusRequester3)
|
|
.onFocusChanged {
|
|
.onFocusChanged {
|
|
isButtonFocused = it.isFocused
|
|
isButtonFocused = it.isFocused
|
|
}
|
|
}
|
|
- .focusable()
|
|
|
|
-// .clickable() { }
|
|
|
|
|
|
+// .focusable()
|
|
,
|
|
,
|
|
onClick = {
|
|
onClick = {
|
|
- focusRequester.requestFocus()
|
|
|
|
// Toast.makeText(
|
|
// Toast.makeText(
|
|
// context, "Test", Toast.LENGTH_SHORT
|
|
// context, "Test", Toast.LENGTH_SHORT
|
|
// ).show()
|
|
// ).show()
|
|
@@ -284,14 +288,14 @@ fun ColumnScope.LoginButtonTV(navHostController: NavHostController) {
|
|
focusedContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
focusedContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
disabledContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
disabledContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
),
|
|
),
|
|
- border = ButtonDefaults.border(
|
|
|
|
- border = Border(
|
|
|
|
- border = BorderStroke(
|
|
|
|
- 0.dp, if(isButtonFocused) colorResource(id = R.color.transparent)
|
|
|
|
- else colorResource(id = R.color.transparent)
|
|
|
|
- )
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
|
|
+// border = ButtonDefaults.border(
|
|
|
|
+// border = Border(
|
|
|
|
+// border = BorderStroke(
|
|
|
|
+// 0.dp, if(isButtonFocused) colorResource(id = R.color.transparent)
|
|
|
|
+// else colorResource(id = R.color.transparent)
|
|
|
|
+// )
|
|
|
|
+// ),
|
|
|
|
+// )
|
|
) {
|
|
) {
|
|
Surface(
|
|
Surface(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -302,7 +306,6 @@ fun ColumnScope.LoginButtonTV(navHostController: NavHostController) {
|
|
contentColor = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
|
|
contentColor = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
|
|
containerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
containerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
|
|
)
|
|
)
|
|
-
|
|
|
|
) {
|
|
) {
|
|
Text(
|
|
Text(
|
|
modifier = Modifier
|
|
modifier = Modifier
|