diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..26e1ab7
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index f7a329b..f734b81 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -53,7 +53,7 @@ dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
- implementation("androidx.activity:activity-compose:1.7.2")
+ implementation("androidx.activity:activity-compose:1.8.0")
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
@@ -67,6 +67,10 @@ dependencies {
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
+ implementation ("androidx.activity:activity-ktx:1.8.0")
+ implementation ("androidx.fragment:fragment-ktx:1.6.1")
+ implementation ("io.coil-kt:coil-compose:1.4.0")
+ implementation ("com.google.code.gson:gson:2.8.8")
- implementation("androidx.navigation:navigation-compose:2.7.3")
+ implementation("androidx.navigation:navigation-compose:2.7.4")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Navigation/NavController.kt b/app/src/main/java/com/example/android_programming/Navigation/NavController.kt
index 4189853..b6a3410 100644
--- a/app/src/main/java/com/example/android_programming/Navigation/NavController.kt
+++ b/app/src/main/java/com/example/android_programming/Navigation/NavController.kt
@@ -4,6 +4,11 @@ import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
+import com.example.android_programming.Screens.AdminPanel.AddPanel
+import com.example.android_programming.Screens.AdminPanel.AdminPanel
+import com.example.android_programming.Screens.AdminPanel.ChangePanel
+import com.example.android_programming.Screens.AdminPanel.ChangeSneaker
+import com.example.android_programming.Screens.HomeScreen.AboutSneaker
import com.example.android_programming.Screens.HomeScreen.HomeScreen
import com.example.android_programming.Screens.LikeScreen.LikeScreen
import com.example.android_programming.Screens.OrderScreen.OrderScreen
@@ -11,6 +16,8 @@ import com.example.android_programming.Screens.ProfileScreen.Profile.Person
import com.example.android_programming.Screens.ProfileScreen.Profile.ProfileScreen
import com.example.android_programming.Screens.ProfileScreen.SignIn.LoginScreen
import com.example.android_programming.Screens.ProfileScreen.SignUp.SignUpScreen
+import com.example.android_programming.SneakerItem
+import com.google.gson.Gson
@Composable
fun NavController(navController: NavHostController){
@@ -19,7 +26,7 @@ fun NavController(navController: NavHostController){
startDestination = NavItem.Home.route
){
composable(NavItem.Home.route){
- HomeScreen()
+ HomeScreen(navController)
}
composable(NavItem.Like.route){
LikeScreen()
@@ -39,5 +46,24 @@ fun NavController(navController: NavHostController){
composable(NavItem.Person.route){
Person()
}
+ composable(NavItem.AdminPanel.route){
+ AdminPanel(navController)
+ }
+ composable(NavItem.AddPanel.route){
+ AddPanel()
+ }
+ composable(NavItem.ChangePanel.route){
+ ChangePanel(navController)
+ }
+ composable(NavItem.AboutSneaker.route) { backStackEntry ->
+ val sneakerItemString = backStackEntry.arguments?.getString("sneakerItem")
+ val sneakerItem = Gson().fromJson(sneakerItemString, SneakerItem::class.java)
+ sneakerItem?.let { AboutSneaker(it) }
+ }
+ composable(NavItem.ChangeSneaker.route) { backStackEntry ->
+ val sneakerItemString = backStackEntry.arguments?.getString("sneakerItem")
+ val sneakerItem = Gson().fromJson(sneakerItemString, SneakerItem::class.java)
+ sneakerItem?.let { ChangeSneaker(it) }
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Navigation/NavItem.kt b/app/src/main/java/com/example/android_programming/Navigation/NavItem.kt
index 7486284..72d03b2 100644
--- a/app/src/main/java/com/example/android_programming/Navigation/NavItem.kt
+++ b/app/src/main/java/com/example/android_programming/Navigation/NavItem.kt
@@ -1,6 +1,7 @@
package com.example.android_programming.Navigation
import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Build
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Person
@@ -15,4 +16,9 @@ sealed class NavItem(val route: String, val icon: ImageVector?){
object SignIn : NavItem("login", null)
object SignUp : NavItem("signup", null)
object Person : NavItem("person", null)
+ object AdminPanel : NavItem("admin", Icons.Default.Build)
+ object AddPanel : NavItem("add", null)
+ object ChangePanel : NavItem("change", null)
+ object AboutSneaker : NavItem("aboutSneaker/{sneakerItem}", null)
+ object ChangeSneaker : NavItem("changeSneaker/{sneakerItem}", null)
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Navigation/Navigate.kt b/app/src/main/java/com/example/android_programming/Navigation/Navigate.kt
index c5025eb..f6eb0db 100644
--- a/app/src/main/java/com/example/android_programming/Navigation/Navigate.kt
+++ b/app/src/main/java/com/example/android_programming/Navigation/Navigate.kt
@@ -12,10 +12,12 @@ import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.colorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
+import com.example.android_programming.R
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
@@ -26,6 +28,7 @@ fun Navigate(){
NavItem.Like,
NavItem.Order,
NavItem.Profile,
+ NavItem.AdminPanel,
)
Scaffold(bottomBar = {
@@ -55,7 +58,7 @@ fun Navigate(){
icon = {
val iconModifier = if (isSelected) {
Modifier
- .background(color = Color.LightGray, shape = CircleShape)
+ .background(color = colorResource(id = R.color.figma_blue), shape = CircleShape)
.padding(8.dp)
} else {
Modifier
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AddPanel.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AddPanel.kt
new file mode 100644
index 0000000..eabed79
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AddPanel.kt
@@ -0,0 +1,187 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Box
+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.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material.Button
+import androidx.compose.material.Text
+import androidx.compose.material.TextField
+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.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+
+@Composable
+@Preview
+fun AddPanel(){
+ var brand by remember { mutableStateOf("") }
+ var model by remember { mutableStateOf("") }
+ var description by remember { mutableStateOf("") }
+ var price by remember { mutableStateOf("") }
+
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.White)
+ .padding(16.dp)
+ ){
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(150.dp)
+ .background(Color.Gray)
+ ) {
+ }
+ Button(
+ onClick = {
+ },
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(20.dp))
+ .padding(16.dp)
+ ) {
+ Text("Add image")
+ }
+
+ TextField(
+ value = brand,
+ onValueChange = { brand = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Brand",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = model,
+ onValueChange = { model = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Model",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = description,
+ onValueChange = { description = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(100.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Description",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = price,
+ onValueChange = { price = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Price",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Button(
+ onClick = {
+
+ },
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(20.dp))
+ .padding(16.dp)
+ ) {
+ Text("Add sneaker")
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AdminPanel.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AdminPanel.kt
new file mode 100644
index 0000000..e6adcd6
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/AdminPanel.kt
@@ -0,0 +1,48 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.Text
+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.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.dp
+import androidx.navigation.NavHostController
+
+@Composable
+fun AdminPanel(navHostController: NavHostController) {
+ var isAddPanelVisible by remember { mutableStateOf(false) }
+ var isChangePanelVisible by remember { mutableStateOf(false) }
+
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.White)
+ .padding(16.dp)
+ ) {
+ ButtonAdmin(
+ onAddClick = {
+ isAddPanelVisible = true
+ isChangePanelVisible = false
+ },
+ onChangeClick = {
+ isChangePanelVisible = true
+ isAddPanelVisible = false
+ }
+ )
+
+ if (isAddPanelVisible) {
+ AddPanel()
+ }
+
+ if (isChangePanelVisible) {
+ ChangePanel(navHostController)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/Button.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/Button.kt
new file mode 100644
index 0000000..3d65b70
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/Button.kt
@@ -0,0 +1,45 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Button
+import androidx.compose.material.Text
+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.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.unit.dp
+import androidx.navigation.NavHostController
+
+@Composable
+fun ButtonAdmin(onAddClick: () -> Unit, onChangeClick: () -> Unit) {
+ Row(){
+ Button(
+ onClick = {
+ onAddClick()
+ },
+ modifier = Modifier
+ .clip(RoundedCornerShape(20.dp))
+ .fillMaxWidth(0.5f)
+ .padding(16.dp)
+ ) {
+ Text("Add")
+ }
+ Button(
+ onClick = {
+ onChangeClick()
+ },
+ modifier = Modifier
+ .clip(RoundedCornerShape(20.dp))
+ .fillMaxWidth()
+ .padding(16.dp)
+ ) {
+ Text("Change/Del")
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/CardSneakerForChange.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/CardSneakerForChange.kt
new file mode 100644
index 0000000..3303456
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/CardSneakerForChange.kt
@@ -0,0 +1,92 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavHostController
+import com.example.android_programming.R
+import com.example.android_programming.SneakerItem
+import com.google.gson.Gson
+
+@Composable
+fun CardSneakerForChange(item: SneakerItem, navController: NavHostController) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(10.dp)
+ .clip(RoundedCornerShape(10.dp))
+ .background(colorResource(id = R.color.figma)),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.SpaceBetween
+ ) {
+ Image(
+ painter = painterResource(id = item.imageId),
+ contentDescription = "image",
+ contentScale = ContentScale.FillWidth,
+ modifier = Modifier
+ .size(70.dp)
+ .padding(10.dp)
+ .clip(RoundedCornerShape(10.dp))
+ )
+
+ Column(
+ modifier = Modifier
+ .weight(1f)
+ .padding(start = 16.dp)
+ ) {
+ item.name?.let { Text(text = it, fontSize = 20.sp) }
+ Text(text = "${item.price} USD", color = Color.Red, fontSize = 16.sp)
+ }
+
+ Image(
+ painter = painterResource(id = R.drawable.change),
+ contentDescription = "image",
+ modifier = Modifier
+ .size(40.dp)
+ .padding(10.dp)
+ .clickable {
+ val sneakerItemString = Gson().toJson(item)
+ navController.navigate("changeSneaker/${sneakerItemString}")
+ }
+ )
+
+ Image(
+ painter = painterResource(id = R.drawable.trash),
+ contentDescription = "image",
+ modifier = Modifier
+ .size(40.dp)
+ .padding(10.dp)
+ .clickable {
+
+ }
+ )
+ }
+}
+
+
+
+/*
+@Composable
+@Preview
+fun CardSneakerLikePreview(){
+ CardSneakerForChange(SneakerItem(R.drawable.sneaker, "Jordan", 159.99))
+}*/
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangePanel.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangePanel.kt
new file mode 100644
index 0000000..c01ab6f
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangePanel.kt
@@ -0,0 +1,41 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.itemsIndexed
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.navigation.NavHostController
+import com.example.android_programming.R
+import com.example.android_programming.SneakerItem
+
+@Composable
+fun ChangePanel(navHostController: NavHostController) {
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.White)
+ ){
+ Row {
+ LazyColumn(
+ modifier = Modifier
+ .fillMaxSize()
+ ) {
+ itemsIndexed(
+ listOf(
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.trash, "Nike", 179.99),
+ )
+ ){_, item->
+ CardSneakerForChange(item = item, navHostController)
+
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangeSneaker.kt b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangeSneaker.kt
new file mode 100644
index 0000000..0fc3053
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/AdminPanel/ChangeSneaker.kt
@@ -0,0 +1,176 @@
+package com.example.android_programming.Screens.AdminPanel
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Box
+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.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardActions
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material.Button
+import androidx.compose.material.Text
+import androidx.compose.material.TextField
+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.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.example.android_programming.SneakerItem
+@Composable
+fun ChangeSneaker(sneaker: SneakerItem) {
+ var brand by remember { mutableStateOf("") }
+ var model by remember { mutableStateOf("") }
+ var description by remember { mutableStateOf("") }
+ var price by remember { mutableStateOf("") }
+
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .background(Color.White)
+ .padding(16.dp)
+ ){
+ Image(
+ painter = painterResource(id = sneaker.imageId),
+ contentDescription = "image",
+ contentScale = ContentScale.FillWidth,
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(200.dp)
+ )
+ Button(
+ onClick = {
+ },
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(20.dp))
+ .padding(16.dp)
+ ) {
+ Text("Change image")
+ }
+
+ TextField(
+ value = sneaker.name.toString(),
+ onValueChange = { brand = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ )
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = model,
+ onValueChange = { model = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Model",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = description,
+ onValueChange = { description = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(100.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ ),
+ placeholder = {
+ Text(
+ text = "Description",
+ style = TextStyle(fontSize = 12.sp)
+ )
+ }
+ )
+
+ Spacer(modifier = Modifier.height(16.dp))
+
+ TextField(
+ value = sneaker.price.toString(),
+ onValueChange = { price = it },
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(50.dp)
+ .border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
+ .padding(0.dp),
+ singleLine = true,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.Text,
+ imeAction = ImeAction.Next
+ ),
+ keyboardActions = KeyboardActions(
+ onNext = {
+
+ }
+ )
+ )
+
+ Button(
+ onClick = {
+
+ },
+ modifier = Modifier
+ .fillMaxWidth()
+ .clip(RoundedCornerShape(20.dp))
+ .padding(16.dp)
+ ) {
+ Text("Save")
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Screens/HomeScreen/AboutSneaker.kt b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/AboutSneaker.kt
new file mode 100644
index 0000000..c9b57bc
--- /dev/null
+++ b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/AboutSneaker.kt
@@ -0,0 +1,41 @@
+package com.example.android_programming.Screens.HomeScreen
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Column
+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.material.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavBackStackEntry
+import androidx.navigation.NavController
+import com.example.android_programming.SneakerItem
+
+@Composable
+fun AboutSneaker(sneaker: SneakerItem) {
+ Column(
+ modifier = Modifier.fillMaxSize()
+ ) {
+ Image(
+ painter = painterResource(id = sneaker.imageId),
+ contentDescription = "image",
+ contentScale = ContentScale.FillWidth,
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(200.dp)
+ )
+
+ Column(
+ modifier = Modifier.padding(16.dp)
+ ) {
+ Text(text = "Name: ${sneaker.name}", fontSize = 18.sp)
+ Text(text = "Price: $${sneaker.price}", fontSize = 16.sp)
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/android_programming/Screens/HomeScreen/HomeScreen.kt b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/HomeScreen.kt
index 700e93f..abf20ab 100644
--- a/app/src/main/java/com/example/android_programming/Screens/HomeScreen/HomeScreen.kt
+++ b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/HomeScreen.kt
@@ -15,20 +15,18 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
-import androidx.navigation.compose.rememberNavController
import com.example.android_programming.Screens.HomeScreen.BrandScrollBar.ItemFilterByBrand
import com.example.android_programming.Screens.HomeScreen.BrandScrollBar.ItemRow
import com.example.android_programming.Screens.HomeScreen.SearchField.SearchField
import com.example.android_programming.Screens.HomeScreen.SneakerRecyclerView.CardSneaker
import com.example.android_programming.SneakerItem
import com.example.android_programming.R
+import com.example.android_programming.getSneakers
@Composable
-fun HomeScreen() {
- val navController = rememberNavController()
+fun HomeScreen(navHostController: NavHostController) {
Column(
modifier = Modifier
.fillMaxSize()
@@ -72,31 +70,8 @@ fun HomeScreen() {
modifier = Modifier
.fillMaxSize()
) {
- val list = listOf(
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
- )
-
- // Определите количество столбцов
+ val list = getSneakers()
val numColumns = 2
-
- // Разделите список на группы по numColumns элементов
val chunkedList = list.chunked(numColumns)
itemsIndexed(chunkedList) { _, chunkedListItem ->
@@ -106,8 +81,7 @@ fun HomeScreen() {
.fillMaxWidth()
) {
for (item in chunkedListItem) {
- // Создайте карточку для каждого элемента
- CardSneaker(item = item, navController = navController)
+ CardSneaker(item, navHostController)
}
}
}
@@ -117,11 +91,5 @@ fun HomeScreen() {
}
}
-@Composable
-@Preview
-fun HomeScreenPreview(){
- HomeScreen()
-}
-
diff --git a/app/src/main/java/com/example/android_programming/Screens/HomeScreen/SneakerRecyclerView/CardSneaker.kt b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/SneakerRecyclerView/CardSneaker.kt
index 2279753..a531075 100644
--- a/app/src/main/java/com/example/android_programming/Screens/HomeScreen/SneakerRecyclerView/CardSneaker.kt
+++ b/app/src/main/java/com/example/android_programming/Screens/HomeScreen/SneakerRecyclerView/CardSneaker.kt
@@ -13,6 +13,8 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button
+import androidx.compose.material.ButtonColors
+import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@@ -26,9 +28,13 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import androidx.core.os.bundleOf
import androidx.navigation.NavHostController
+import androidx.navigation.compose.rememberNavController
import com.example.android_programming.R
+import com.example.android_programming.Screens.HomeScreen.AboutSneaker
import com.example.android_programming.SneakerItem
+import com.google.gson.Gson
@Composable
fun CardSneaker(item: SneakerItem, navController: NavHostController) {
@@ -39,7 +45,8 @@ fun CardSneaker(item: SneakerItem, navController: NavHostController) {
.padding(4.dp)
.widthIn(maxWidth)
.clickable {
- navController.navigate("signup")
+ val sneakerItemString = Gson().toJson(item)
+ navController.navigate("aboutSneaker/${sneakerItemString}")
}
) {
Column(
@@ -68,7 +75,7 @@ fun CardSneaker(item: SneakerItem, navController: NavHostController) {
modifier = Modifier
.padding(10.dp, 0.dp)
) {
- Text(text = item.name)
+ item.name?.let { Text(text = it) }
Text(text = item.price.toString(), color = Color.Red)
}
Column(
@@ -88,8 +95,3 @@ fun CardSneaker(item: SneakerItem, navController: NavHostController) {
}
}
}
-@Composable
-@Preview
-fun CardSneakerPreview(){
-// CardSneaker(SneakerItem(R.drawable.sneaker, "Air Jordan 1", 159.99))
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/android_programming/Screens/LikeScreen/CardSneaker.kt b/app/src/main/java/com/example/android_programming/Screens/LikeScreen/CardSneaker.kt
index 10b1ecc..10e2faf 100644
--- a/app/src/main/java/com/example/android_programming/Screens/LikeScreen/CardSneaker.kt
+++ b/app/src/main/java/com/example/android_programming/Screens/LikeScreen/CardSneaker.kt
@@ -51,7 +51,7 @@ fun CardSneakerLike(item: SneakerItem) {
.weight(1f)
.padding(start = 16.dp)
) {
- Text(text = item.name, fontSize = 20.sp)
+ item.name?.let { Text(text = it, fontSize = 20.sp) }
Text(text = "${item.price} USD", color = Color.Red, fontSize = 16.sp)
}
diff --git a/app/src/main/java/com/example/android_programming/Screens/LikeScreen/LikeScreen.kt b/app/src/main/java/com/example/android_programming/Screens/LikeScreen/LikeScreen.kt
index 8ffa206..6bd9d11 100644
--- a/app/src/main/java/com/example/android_programming/Screens/LikeScreen/LikeScreen.kt
+++ b/app/src/main/java/com/example/android_programming/Screens/LikeScreen/LikeScreen.kt
@@ -1,19 +1,15 @@
package com.example.android_programming.Screens.LikeScreen;
import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
-import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable;
-import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
diff --git a/app/src/main/java/com/example/android_programming/Screens/OrderScreen/OrderScreen.kt b/app/src/main/java/com/example/android_programming/Screens/OrderScreen/OrderScreen.kt
index 10f711e..cabd3f8 100644
--- a/app/src/main/java/com/example/android_programming/Screens/OrderScreen/OrderScreen.kt
+++ b/app/src/main/java/com/example/android_programming/Screens/OrderScreen/OrderScreen.kt
@@ -1,15 +1,11 @@
package com.example.android_programming.Screens.OrderScreen
-import android.widget.ScrollView
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
-import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@@ -20,7 +16,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Button
-import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.runtime.Composable
diff --git a/app/src/main/java/com/example/android_programming/SneakerItem.kt b/app/src/main/java/com/example/android_programming/SneakerItem.kt
index 908fff8..f5aa84c 100644
--- a/app/src/main/java/com/example/android_programming/SneakerItem.kt
+++ b/app/src/main/java/com/example/android_programming/SneakerItem.kt
@@ -1,7 +1,61 @@
package com.example.android_programming
+import android.os.Parcel
+import android.os.Parcelable
+
+
data class SneakerItem(
val imageId: Int,
- val name: String,
+ val name: String?,
val price: Double
-)
\ No newline at end of file
+) : Parcelable {
+ constructor(parcel: Parcel) : this(
+ parcel.readInt(),
+ parcel.readString(),
+ parcel.readDouble()
+ ) {
+ }
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeInt(imageId)
+ parcel.writeString(name)
+ parcel.writeDouble(price)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): SneakerItem {
+ return SneakerItem(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+}
+
+fun getSneakers(): List {
+ return listOf(
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.trash, "Nike", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
+ )
+}
diff --git a/app/src/main/res/drawable/change.png b/app/src/main/res/drawable/change.png
new file mode 100644
index 0000000..452b650
Binary files /dev/null and b/app/src/main/res/drawable/change.png differ
diff --git a/app/src/main/res/drawable/trash.png b/app/src/main/res/drawable/trash.png
new file mode 100644
index 0000000..f8cc927
Binary files /dev/null and b/app/src/main/res/drawable/trash.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 75cf818..433080c 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -8,4 +8,5 @@
#FF000000
#FFFFFFFF
#F4F4F4
+ #3660F6
\ No newline at end of file