Ver código fonte

app: add auth and login page

Anna 1 semana atrás
pai
commit
8b19d01c00

+ 3 - 0
.idea/.gitignore

@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml

+ 1 - 1
Project_exvesta/.idea/other.xml → .idea/caches/deviceStreaming.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="direct_access_persist.xml">
+  <component name="DeviceStreaming">
     <option name="deviceSelectionList">
       <list>
         <PersistentDeviceSelectionData>

+ 9 - 0
.idea/exvesta.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/misc.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/exvesta.iml" filepath="$PROJECT_DIR$/.idea/exvesta.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 0 - 1
Project_exvesta/.idea/misc.xml

@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ExternalStorageConfigurationManager" enabled="true" />
   <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">

+ 9 - 20
Project_exvesta/app/src/main/java/com/example/exvesta/MainActivity.kt

@@ -6,11 +6,14 @@ import androidx.activity.compose.setContent
 import androidx.activity.enableEdgeToEdge
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.MaterialTheme
 import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Surface
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.tooling.preview.Preview
+import com.example.exvesta.navigation.Navigation
 import com.example.exvesta.ui.theme.ExvestaTheme
 
 class MainActivity : ComponentActivity() {
@@ -19,29 +22,15 @@ class MainActivity : ComponentActivity() {
         enableEdgeToEdge()
         setContent {
             ExvestaTheme {
-                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
-                    Greeting(
-                        name = "Android",
-                        modifier = Modifier.padding(innerPadding)
-                    )
+                Surface(
+                    modifier = Modifier.fillMaxSize(),
+                    color = MaterialTheme.colorScheme.background
+                ) {
+                    Navigation()
+
                 }
             }
         }
     }
 }
 
-@Composable
-fun Greeting(name: String, modifier: Modifier = Modifier) {
-    Text(
-        text = "Hello $name!",
-        modifier = modifier
-    )
-}
-
-@Preview(showBackground = true)
-@Composable
-fun GreetingPreview() {
-    ExvestaTheme {
-        Greeting("Android")
-    }
-}

+ 130 - 0
Project_exvesta/app/src/main/java/com/example/exvesta/Screans/Login.kt

@@ -0,0 +1,130 @@
+package com.example.exvesta.Screans
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+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.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+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.draw.clip
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavHostController
+
+import com.example.exvesta.R
+import com.example.exvesta.model.MainViewModel
+
+@Composable
+fun Login(navHost: NavHostController) {
+    val viewModel = MainViewModel()
+    val email = remember { mutableStateOf("") }
+    val password = remember { mutableStateOf("")}
+    val gradientButton = Brush.linearGradient(
+        colors = listOf(
+            Color(0xFF6F4A48),
+            Color(0xFFC09F9C)
+        ),
+
+        start =  Offset(30.0f, 50.0f),
+        end =  Offset(200.0f, 50.0f)
+    );
+
+
+
+    Column(
+        modifier = Modifier
+            .fillMaxSize()
+            .background(Color.White),
+//        verticalArrangement = Arrangement.Center,
+        horizontalAlignment = Alignment.CenterHorizontally
+    ) {
+
+        Spacer(modifier = Modifier.height(100.dp))
+        Image(
+            painter = painterResource(id = R.drawable.back),
+            contentDescription = "Background Image",
+            modifier = Modifier
+                .fillMaxWidth()
+                .height(350.dp)
+                .clip(RoundedCornerShape(16.dp))
+        )
+
+        TextField(
+            value = email.value,
+            onValueChange = { email.value = it },
+            label = { Text("Логин") },
+            modifier = Modifier.fillMaxWidth()
+        )
+        Spacer(modifier = Modifier.height(16.dp))
+        TextField(
+            value = password.value,
+            onValueChange = { password.value = it },
+            label = { Text("Пароль") },
+            modifier = Modifier
+
+                .width(350.dp)
+                .height(50.dp)
+
+            ,
+//            colors = TextFieldDefaults.Colors(
+//                backgroundColor = Color.White),
+//            visualTransformation = PasswordVisualTransformation(),
+//            shape = TextFieldDefaults.shape
+        )
+
+        Spacer(modifier = Modifier.height(30.dp))
+        Button(
+            onClick = {  navHost.navigate("Login") },
+            modifier = Modifier
+                .width(350.dp)
+                .height(50.dp)
+                .padding(horizontal = 20.dp)
+                .background(
+                    brush = Brush.horizontalGradient(
+                        colors = listOf(
+                            Color(0xFF6F4A48),
+                            Color(0xFFE7D2A9),
+                        )
+                    ), shape = ButtonDefaults.shape
+                )
+                .height(ButtonDefaults.MinHeight),
+
+            colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
+        ) {
+            Text(
+                text = "войти",
+                fontSize = 16.sp,
+                fontWeight = FontWeight.Medium
+            )
+        }
+        Spacer(modifier = Modifier.height(16.dp))
+
+
+    }
+}

+ 40 - 8
Project_exvesta/app/src/main/java/com/example/exvesta/Screans/Preloading.kt

@@ -1,26 +1,56 @@
 package com.example.exvesta.Screans
 
+import android.view.animation.OvershootInterpolator
 import androidx.compose.foundation.layout.Column
 import androidx.compose.runtime.Composable
 import androidx.navigation.NavHost
 import androidx.navigation.NavHostController
 import androidx.activity.ComponentActivity
 import androidx.activity.compose.setContent
+import androidx.compose.animation.core.tween
 import androidx.compose.foundation.background
 import androidx.compose.foundation.layout.*
+import androidx.compose.material3.Icon
 import androidx.compose.material3.Text
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
 
 
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Brush
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
+import com.example.exvesta.R
+import kotlinx.coroutines.delay
+
 @Composable
 fun Preloading(navHost: NavHostController){
+
+    val scale = remember {
+        androidx.compose.animation.core.Animatable(0f)
+    }
+
+    LaunchedEffect(key1 = true) {
+        scale.animateTo(
+            targetValue = 0.7f,
+            animationSpec = tween(
+                durationMillis = 800,
+                easing = {
+                    OvershootInterpolator(4f).getInterpolation(it)
+                })
+        )
+        delay(1500L)
+        navHost.navigate("RegAuth")
+
+    }
+
+
+
     Column(
         modifier = Modifier
             .fillMaxSize()
@@ -28,9 +58,9 @@ fun Preloading(navHost: NavHostController){
                 Brush.verticalGradient(
                     colors = listOf(
                         Color(0xFFF4F4F4),
-                        Color(0xFFD9D9D9),
-                        Color(0xFFB0A69B),
-                        Color(0xFFA08779)
+                        Color(0xFFE7D2A9),
+                        Color(0xFFC1A88B),
+                        Color(0xFF6F4A48)
                     )
                 )
             ),
@@ -40,13 +70,15 @@ fun Preloading(navHost: NavHostController){
         Box(
             modifier = Modifier
                 .size(100.dp)
-                .background(Color.White),
+            ,
             contentAlignment = Alignment.Center
         ) {
-            Text(
-                text = "👕",
-                fontSize = 48.sp,
-                color = Color(0xFFA08779)
+            Icon(
+
+                painter = painterResource(id = R.drawable.i),
+                contentDescription = "",
+                modifier = Modifier.size(100.dp), // Устанавливаем размер иконки
+                tint = Color.White
             )
         }
         Spacer(modifier = Modifier.height(16.dp))

+ 111 - 0
Project_exvesta/app/src/main/java/com/example/exvesta/Screans/RegAuth.kt

@@ -0,0 +1,111 @@
+package com.example.exvesta.Screans
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavHostController
+import com.example.exvesta.R
+import androidx.compose.ui.Modifier
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.*
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+
+
+@Composable
+fun RegAuth(navHost: NavHostController) {
+    val gradientButton = Brush.linearGradient(
+        colors = listOf(
+            Color(0xFF6F4A48),
+            Color(0xFFC09F9C)
+        ),
+
+        start =  Offset(30.0f, 50.0f),
+        end =  Offset(200.0f, 50.0f)
+    );
+
+
+
+    Column(
+        modifier = Modifier
+            .fillMaxSize()
+            .background(Color.White),
+//        verticalArrangement = Arrangement.Center,
+        horizontalAlignment = Alignment.CenterHorizontally
+    ) {
+
+        Spacer(modifier = Modifier.height(100.dp))
+        Image(
+            painter = painterResource(id = R.drawable.back),
+            contentDescription = "Background Image",
+            modifier = Modifier
+                .fillMaxWidth()
+                .height(350.dp)
+                .clip(RoundedCornerShape(16.dp))
+        )
+        Spacer(modifier = Modifier.height(30.dp))
+        Button(
+            onClick = {  navHost.navigate("Login") },
+            modifier = Modifier
+                .width(350.dp)
+                .height(50.dp)
+                .padding(horizontal = 20.dp)
+                .background(
+                    brush = Brush.horizontalGradient(
+                        colors = listOf(
+                            Color(0xFF6F4A48),
+                            Color(0xFFE7D2A9),
+                        )
+                    ), shape = ButtonDefaults.shape
+                )
+                .height(ButtonDefaults.MinHeight),
+
+            colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent)
+        ) {
+            Text(
+                text = "войти",
+                fontSize = 16.sp,
+                fontWeight = FontWeight.Medium
+            )
+        }
+        Spacer(modifier = Modifier.height(16.dp))
+        Button(
+            onClick = { navHost.navigate("registration") },
+            modifier = Modifier
+                .width(350.dp)
+                .height(50.dp)
+                .padding(horizontal = 20.dp),
+            colors = ButtonDefaults.buttonColors(
+              Color(0xFF6F4A48),
+                contentColor = Color.White
+            ),
+            shape = ButtonDefaults.shape
+        ) {
+            Text(
+                text = "зарегистрироваться",
+                fontSize = 16.sp,
+                fontWeight = FontWeight.Medium
+            )
+        }
+        Spacer(modifier = Modifier.height(16.dp))
+        Text(
+            text = "нет аккаунта? нажмите зарегистрироваться",
+            fontSize = 12.sp,
+        )
+    }
+}

+ 8 - 0
Project_exvesta/app/src/main/java/com/example/exvesta/navigation/Navigation.kt

@@ -4,7 +4,9 @@ import androidx.compose.runtime.Composable
 import androidx.navigation.compose.NavHost
 import androidx.navigation.compose.composable
 import androidx.navigation.compose.rememberNavController
+import com.example.exvesta.Screans.Login
 import com.example.exvesta.Screans.Preloading
+import com.example.exvesta.Screans.RegAuth
 
 @Composable
 fun Navigation(){
@@ -15,5 +17,11 @@ fun Navigation(){
         composable("Preloading"){
             Preloading(navController)
         }
+        composable("RegAuth"){
+            RegAuth(navController)
+        }
+        composable("Login"){
+            Login(navController)
+        }
     }
 }

BIN
Project_exvesta/app/src/main/res/drawable/back.png


+ 0 - 0
Project_exvesta/1.png → Project_exvesta/app/src/main/res/drawable/i.png