From 40c9e4ec9b77053477d4ae468a4ac7247e510964 Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:13:15 -0700 Subject: [PATCH 1/7] Tabs added to TopAppBar in products detail page ONLY --- .../screen/IndividualProduct.kt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt index d75f2c88..e5d63976 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt @@ -36,11 +36,23 @@ import com.example.belindas_closet.R import com.example.belindas_closet.Routes import com.example.belindas_closet.model.Product import com.example.belindas_closet.data.Datasource +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.* +import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset +import androidx.compose.runtime.* @OptIn(ExperimentalMaterial3Api::class) @Composable fun IndividualProductPage(navController: NavController, productId: String) { + + var selectedTabIndex by remember { mutableIntStateOf(0) } + val tabs = listOf("Tab 1", "Tab 2", "Tab 3") + Scaffold( + modifier = Modifier .fillMaxSize(), topBar = { @@ -67,6 +79,29 @@ fun IndividualProductPage(navController: NavController, productId: String) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } + TabRow( + selectedTabIndex = selectedTabIndex, + contentColor = MaterialTheme.colorScheme.primary, + indicator = { tabPositions -> + TabRowDefaults.Indicator( + modifier = Modifier.tabIndicatorOffset(tabPositions[selectedTabIndex]), + height = 2.dp, + color = MaterialTheme.colorScheme.primary + ) + } + ) { + tabs.forEachIndexed { index, tabText -> + Tab( + selected = selectedTabIndex == index, + onClick = { + selectedTabIndex = index + // Handle tab selection as needed + }, + ) { + Text(text = tabText) + } + } + } } ) }, From 459e0ea1e3ec4ec60030487bdb12fd65ad839dfc Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Thu, 2 Nov 2023 10:08:36 -0700 Subject: [PATCH 2/7] Removed tabs --- .../screen/IndividualProduct.kt | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt index e5d63976..b23c79e1 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt @@ -79,29 +79,6 @@ fun IndividualProductPage(navController: NavController, productId: String) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } - TabRow( - selectedTabIndex = selectedTabIndex, - contentColor = MaterialTheme.colorScheme.primary, - indicator = { tabPositions -> - TabRowDefaults.Indicator( - modifier = Modifier.tabIndicatorOffset(tabPositions[selectedTabIndex]), - height = 2.dp, - color = MaterialTheme.colorScheme.primary - ) - } - ) { - tabs.forEachIndexed { index, tabText -> - Tab( - selected = selectedTabIndex == index, - onClick = { - selectedTabIndex = index - // Handle tab selection as needed - }, - ) { - Text(text = tabText) - } - } - } } ) }, From 0027b5b242b34e810f83ef414b9ab53b010eceb6 Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Sat, 4 Nov 2023 14:36:08 -0700 Subject: [PATCH 3/7] Drawer Icon added to ProductDetails Page. Non functioning. --- .../example/belindas_closet/screen/Home.kt | 60 +++++++++++++++++++ .../screen/IndividualProduct.kt | 7 +-- .../belindas_closet/screen/ProductDetail.kt | 10 +++- 3 files changed, 71 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/example/belindas_closet/screen/Home.kt b/app/src/main/java/com/example/belindas_closet/screen/Home.kt index 64ed92d3..20d47841 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/Home.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/Home.kt @@ -1,5 +1,6 @@ package com.example.belindas_closet.screen +import android.graphics.drawable.Icon import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -7,13 +8,23 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.Edit +import androidx.compose.material.icons.filled.Menu import androidx.compose.material3.Button import androidx.compose.material3.Card +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -35,8 +46,10 @@ import com.example.belindas_closet.data.Datasource import com.example.belindas_closet.model.Product +@OptIn(ExperimentalMaterial3Api::class) @Composable fun HomePage(navController: NavController) { + Row( modifier = Modifier .size(125.dp) @@ -89,6 +102,53 @@ fun HomePage(navController: NavController) { ProductList(products = Datasource().loadProducts(), navController = navController) } } + +// Scaffold( +// +// modifier = Modifier +// .fillMaxSize(), +// topBar = { +// /* Don't need back button on this page? */ +// /* Back arrow that navigates back to different page? */ +// TopAppBar( +// title = { Text("Belinda's Home Page") }, +// navigationIcon = { +// IconButton( +// onClick = { +// navController.navigate(Routes.Home.route) +// } +// ) { +// +// Icon( +// imageVector = Icons.Default.ArrowBack, +// contentDescription = "Back to Product page" +// ) +// } +// }, +// actions = { +// Row( +// horizontalArrangement = Arrangement.spacedBy(8.dp), // Adjust spacing as needed +// modifier = Modifier.fillMaxWidth(), +// ) { +// IconButton( +// onClick = { /*TO DO*/ } +// ) { +// Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") +// } +// } +// } +// ) +// }, +// ) { innerPadding -> +// val modifier = Modifier.padding(innerPadding) +// Column( +// modifier = modifier +// .fillMaxSize(), +// verticalArrangement = Arrangement.Center, +// horizontalAlignment = Alignment.CenterHorizontally +// ) { +// } +// } } diff --git a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt index b23c79e1..b36fffb5 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt @@ -48,9 +48,6 @@ import androidx.compose.runtime.* @Composable fun IndividualProductPage(navController: NavController, productId: String) { - var selectedTabIndex by remember { mutableIntStateOf(0) } - val tabs = listOf("Tab 1", "Tab 2", "Tab 3") - Scaffold( modifier = Modifier @@ -58,7 +55,7 @@ fun IndividualProductPage(navController: NavController, productId: String) { topBar = { /* Back arrow that navigates back to login page */ TopAppBar( - title = { Text("Home") }, + title = { Text("Back") }, navigationIcon = { IconButton( onClick = { @@ -67,7 +64,7 @@ fun IndividualProductPage(navController: NavController, productId: String) { ) { Icon( imageVector = Icons.Default.ArrowBack, - contentDescription = "Back to Home page" + contentDescription = "Back to Product page" ) } }, diff --git a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt index c08f98fb..2242bb47 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt @@ -15,6 +15,7 @@ import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.Edit +import androidx.compose.material.icons.filled.Menu import androidx.compose.material3.Card import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon @@ -50,7 +51,7 @@ fun ProductDetailPage(navController: NavController) { topBar = { /* Back arrow that navigates back to login page */ TopAppBar( - title = { Text("Home") }, + title = { Text("Product Details") }, navigationIcon = { IconButton( onClick = { @@ -74,6 +75,13 @@ fun ProductDetailPage(navController: NavController) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } + IconButton( + onClick = { + //TODO: Create dropdown drawer menu of other product categories + } + ) { + Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") + } } ) }, From 440a7628e528a7c3370442e2233be8ad9baff16e Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Sat, 4 Nov 2023 18:26:19 -0700 Subject: [PATCH 4/7] Back button on ProductDetail.kt now says 'Home' next to back arrow. --- .../java/com/example/belindas_closet/screen/ProductDetail.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt index 2242bb47..8596dc1e 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt @@ -51,7 +51,7 @@ fun ProductDetailPage(navController: NavController) { topBar = { /* Back arrow that navigates back to login page */ TopAppBar( - title = { Text("Product Details") }, + title = { Text("Home") }, navigationIcon = { IconButton( onClick = { From b10e7eae8c871f75823304f7d849c0c3553152a6 Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:14:44 -0800 Subject: [PATCH 5/7] Remove Scaffolding from Home.kt --- app/build.gradle | 10 ++-- .../example/belindas_closet/screen/Home.kt | 47 ------------------- .../belindas_closet/screen/ProductDetail.kt | 31 +++++++++--- 3 files changed, 29 insertions(+), 59 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 241648c8..6c83b766 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,10 +48,10 @@ android { dependencies { - implementation 'androidx.core:core-ktx:1.10.1' + implementation 'androidx.core:core-ktx:1.12.0' implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.22') - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' - implementation 'androidx.activity:activity-compose:1.7.2' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2' + implementation 'androidx.activity:activity-compose:1.8.0' implementation 'androidx.compose.ui:ui' implementation 'androidx.compose.ui:ui-graphics' implementation 'androidx.compose.ui:ui-tooling-preview' @@ -64,8 +64,8 @@ dependencies { debugImplementation 'androidx.compose.ui:ui-test-manifest' // Navigation - implementation 'androidx.navigation:navigation-compose:2.6.0' + implementation 'androidx.navigation:navigation-compose:2.7.5' // Material Design - implementation "androidx.compose.material3:material3:1.2.0-alpha03" + implementation "androidx.compose.material3:material3:1.2.0-alpha10" } diff --git a/app/src/main/java/com/example/belindas_closet/screen/Home.kt b/app/src/main/java/com/example/belindas_closet/screen/Home.kt index 20d47841..f927fe4d 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/Home.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/Home.kt @@ -102,53 +102,6 @@ fun HomePage(navController: NavController) { ProductList(products = Datasource().loadProducts(), navController = navController) } } - -// Scaffold( -// -// modifier = Modifier -// .fillMaxSize(), -// topBar = { -// /* Don't need back button on this page? */ -// /* Back arrow that navigates back to different page? */ -// TopAppBar( -// title = { Text("Belinda's Home Page") }, -// navigationIcon = { -// IconButton( -// onClick = { -// navController.navigate(Routes.Home.route) -// } -// ) { -// -// Icon( -// imageVector = Icons.Default.ArrowBack, -// contentDescription = "Back to Product page" -// ) -// } -// }, -// actions = { -// Row( -// horizontalArrangement = Arrangement.spacedBy(8.dp), // Adjust spacing as needed -// modifier = Modifier.fillMaxWidth(), -// ) { -// IconButton( -// onClick = { /*TO DO*/ } -// ) { -// Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") -// } -// } -// } -// ) -// }, -// ) { innerPadding -> -// val modifier = Modifier.padding(innerPadding) -// Column( -// modifier = modifier -// .fillMaxSize(), -// verticalArrangement = Arrangement.Center, -// horizontalAlignment = Alignment.CenterHorizontally -// ) { -// } -// } } diff --git a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt index 8596dc1e..261bbb39 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt @@ -17,6 +17,9 @@ import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.Edit import androidx.compose.material.icons.filled.Menu import androidx.compose.material3.Card +import androidx.compose.material3.DrawerValue +import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -24,7 +27,12 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.TopAppBar +import androidx.compose.material3.rememberDrawerState 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.graphics.Color @@ -45,6 +53,12 @@ import com.example.belindas_closet.data.Datasource @OptIn(ExperimentalMaterial3Api::class) @Composable fun ProductDetailPage(navController: NavController) { + + var drawerState by remember { mutableStateOf(DrawerValue.Closed) } + var expanded by remember { mutableStateOf(false) } + + val items = listOf("Item 1", "Item 2", "Item 3") + Scaffold( modifier = Modifier .fillMaxSize(), @@ -63,6 +77,14 @@ fun ProductDetailPage(navController: NavController) { contentDescription = "Back to Home page" ) } + IconButton( + onClick = { + drawerState = DrawerValue.Open + } + ) { + Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") + } + }, actions = { IconButton( @@ -75,16 +97,11 @@ fun ProductDetailPage(navController: NavController) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } - IconButton( - onClick = { - //TODO: Create dropdown drawer menu of other product categories - } - ) { - Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") - } + } ) }, + ) { innerPadding -> val modifier = Modifier.padding(innerPadding) Column( From 5dbf94233b87b7073940ef6e3de538eb13774ae4 Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:49:41 -0800 Subject: [PATCH 6/7] Menu icon added to ProductDetail.kt and IndividualProduct.kt. Pushed to right side of Nav bar and edit icon. No functionality. --- .../screen/IndividualProduct.kt | 10 ++++++++++ .../belindas_closet/screen/ProductDetail.kt | 18 +++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt index b36fffb5..5dc93bbe 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/IndividualProduct.kt @@ -40,6 +40,7 @@ import androidx.activity.compose.BackHandler import androidx.compose.foundation.background import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.material.icons.filled.Menu import androidx.compose.material3.* import androidx.compose.material3.TabRowDefaults.tabIndicatorOffset import androidx.compose.runtime.* @@ -48,6 +49,8 @@ import androidx.compose.runtime.* @Composable fun IndividualProductPage(navController: NavController, productId: String) { + var drawerState by remember { mutableStateOf(DrawerValue.Closed) } + Scaffold( modifier = Modifier @@ -76,6 +79,13 @@ fun IndividualProductPage(navController: NavController, productId: String) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } + IconButton( + onClick = { + drawerState = DrawerValue.Open + } + ) { + Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") + } } ) }, diff --git a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt index 261bbb39..79b4389d 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/ProductDetail.kt @@ -55,9 +55,6 @@ import com.example.belindas_closet.data.Datasource fun ProductDetailPage(navController: NavController) { var drawerState by remember { mutableStateOf(DrawerValue.Closed) } - var expanded by remember { mutableStateOf(false) } - - val items = listOf("Item 1", "Item 2", "Item 3") Scaffold( modifier = Modifier @@ -77,14 +74,6 @@ fun ProductDetailPage(navController: NavController) { contentDescription = "Back to Home page" ) } - IconButton( - onClick = { - drawerState = DrawerValue.Open - } - ) { - Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") - } - }, actions = { IconButton( @@ -97,6 +86,13 @@ fun ProductDetailPage(navController: NavController) { ) { Icon(imageVector = Icons.Default.Edit, contentDescription = "Edit") } + IconButton( + onClick = { + drawerState = DrawerValue.Open + } + ) { + Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu") + } } ) From 76df2f27c584d4369185c022211120fb719a6df8 Mon Sep 17 00:00:00 2001 From: Annelisebx <50610153+Annelisebx@users.noreply.github.com> Date: Wed, 8 Nov 2023 11:39:47 -0800 Subject: [PATCH 7/7] Revert Home.kt to what is currently in main --- .../example/belindas_closet/screen/Home.kt | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/example/belindas_closet/screen/Home.kt b/app/src/main/java/com/example/belindas_closet/screen/Home.kt index 83415d4a..6ec70012 100644 --- a/app/src/main/java/com/example/belindas_closet/screen/Home.kt +++ b/app/src/main/java/com/example/belindas_closet/screen/Home.kt @@ -1,6 +1,5 @@ package com.example.belindas_closet.screen -import android.graphics.drawable.Icon import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -8,23 +7,13 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack -import androidx.compose.material.icons.filled.Edit -import androidx.compose.material.icons.filled.Menu import androidx.compose.material3.Button import androidx.compose.material3.Card -import androidx.compose.material3.TopAppBar -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -46,10 +35,8 @@ import com.example.belindas_closet.data.Datasource import com.example.belindas_closet.model.Product -@OptIn(ExperimentalMaterial3Api::class) @Composable fun HomePage(navController: NavController) { - Row( modifier = Modifier .size(125.dp) @@ -90,19 +77,19 @@ fun HomePage(navController: NavController) { ) Spacer(modifier = Modifier.padding(16.dp)) - // Add Product button (Temporary), - // todo: will later be moved and protected for only admin access - Button( - onClick = { - /*TODO add navigation logic to the protected page only allowing Admin access*/ - navController.navigate(Routes.AddProduct.route) - }, - modifier = Modifier - .padding(4.dp) - .align(Alignment.CenterHorizontally) - ) { - Text(text = "Add Product") - } + // Add Product button (Temporary), + // todo: will later be moved and protected for only admin access + Button( + onClick = { + /*TODO add navigation logic to the protected page only allowing Admin access*/ + navController.navigate(Routes.AddProduct.route) + }, + modifier = Modifier + .padding(4.dp) + .align(Alignment.CenterHorizontally) + ) { + Text(text = "Add Product") + } // TODO Delete later. Just for testing purpose TextButton( onClick = { @@ -208,5 +195,5 @@ fun NSCLogo() { Image( painter = painterResource(id = R.drawable.nsc_v_logo), contentDescription = stringResource(id = R.string.home_nsc_logo_description) - ) -} + ) +} \ No newline at end of file