From 0fbda6dae2056acdd48ad9f8cf929e67b8c44990 Mon Sep 17 00:00:00 2001
From: hanan o <77591083+heosman@users.noreply.github.com>
Date: Tue, 5 Dec 2023 21:04:15 -0800
Subject: [PATCH] belindas-closet-android_4_229_add-donation-page (#230)
* Create Donation Info page
* Add route for DonationInfo page
* Add button that routes to donation info page
Info icon button is added to navigation bar on the Home page, which I reused from the Login page
---------
Co-authored-by: taylorpapke <94101953+taylorpapke@users.noreply.github.com>
---
.../com/example/belindas_closet/Routes.kt | 1 +
.../belindas_closet/screen/DonationInfo.kt | 80 +++++++++++++++++++
.../example/belindas_closet/screen/Home.kt | 35 +++++++-
.../belindas_closet/screen/ScreenMain.kt | 3 +
app/src/main/res/drawable/info_icon.xml | 15 ++++
app/src/main/res/values/strings.xml | 3 +
6 files changed, 134 insertions(+), 3 deletions(-)
create mode 100644 app/src/main/java/com/example/belindas_closet/screen/DonationInfo.kt
create mode 100644 app/src/main/res/drawable/info_icon.xml
diff --git a/app/src/main/java/com/example/belindas_closet/Routes.kt b/app/src/main/java/com/example/belindas_closet/Routes.kt
index 66c327a7..11dc1f9f 100644
--- a/app/src/main/java/com/example/belindas_closet/Routes.kt
+++ b/app/src/main/java/com/example/belindas_closet/Routes.kt
@@ -12,4 +12,5 @@ sealed class Routes (val route: String) {
object IndividualProduct: Routes("Individual_Product")
object IndividualProductUpdatePage: Routes("Individual_Product_Update")
object AdminView: Routes("Admin_View")
+ object DonationInfo: Routes("Donation_Info")
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/belindas_closet/screen/DonationInfo.kt b/app/src/main/java/com/example/belindas_closet/screen/DonationInfo.kt
new file mode 100644
index 00000000..a9de3f20
--- /dev/null
+++ b/app/src/main/java/com/example/belindas_closet/screen/DonationInfo.kt
@@ -0,0 +1,80 @@
+package com.example.belindas_closet.screen
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.foundation.layout.Arrangement
+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.wrapContentSize
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.ArrowBack
+import androidx.compose.material.icons.filled.Menu
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.Text
+import androidx.compose.material3.TopAppBar
+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.res.stringResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavController
+import com.example.belindas_closet.R
+import com.example.belindas_closet.Routes
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun DonationInfoPage(navController: NavController) {
+
+ /* Back arrow that navigates back to Home page */
+ TopAppBar(
+ title = { Text("Home") },
+ navigationIcon = {
+ IconButton(
+ onClick = {
+ navController.navigate(Routes.Home.route)
+ }
+ ) {
+ Icon(imageVector = Icons.Default.ArrowBack, contentDescription = "Back")
+ }
+ },
+ actions = {
+ IconButton(
+ onClick = {
+ }
+ ) {
+ Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu")
+ }
+ }
+ )
+
+ Column(
+ modifier = Modifier.fillMaxSize(),
+ verticalArrangement = Arrangement.Top,
+ ) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ Spacer(modifier = Modifier.height(75.dp))
+ Text(
+ text = stringResource(id = R.string.donation_info),
+ style = TextStyle(
+ fontSize = 30.sp,
+ fontWeight = FontWeight.Light,
+ color = if (isSystemInDarkTheme()) Color.White else Color.Black
+ ),
+ modifier = Modifier.wrapContentSize()
+ )
+ Spacer(modifier = Modifier.height(25.dp))
+ }
+
+ }
+}
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 e5664403..41500150 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
@@ -12,10 +12,15 @@ 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.Menu
import androidx.compose.material3.Button
import androidx.compose.material3.Card
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
-import androidx.compose.material3.TextButton
+import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -36,12 +41,36 @@ import com.example.belindas_closet.model.Product
import com.example.belindas_closet.model.ProductType
+@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomePage(navController: NavController) {
+ TopAppBar(
+ title = { Text("") },
+ actions = {
+ IconButton(
+ onClick = {
+ navController.navigate(Routes.DonationInfo.route)
+ }
+ ) {
+ Icon(
+ painter = painterResource(R.drawable.info_icon),
+ contentDescription = "Donation Info page",
+ modifier = Modifier.padding(10.dp)
+ )
+ }
+ IconButton(
+ onClick = {
+ }
+ ) {
+ Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu")
+ }
+ }
+
+ )
Row(
modifier = Modifier
- .size(125.dp)
- .padding(top = 10.dp, start = 10.dp),
+ .size(75.dp)
+ .padding(top = 20.dp, start = 10.dp),
verticalAlignment = Alignment.Top,
horizontalArrangement = Arrangement.Start
) {
diff --git a/app/src/main/java/com/example/belindas_closet/screen/ScreenMain.kt b/app/src/main/java/com/example/belindas_closet/screen/ScreenMain.kt
index 9ead1568..b3bb029f 100644
--- a/app/src/main/java/com/example/belindas_closet/screen/ScreenMain.kt
+++ b/app/src/main/java/com/example/belindas_closet/screen/ScreenMain.kt
@@ -43,6 +43,9 @@ fun ScreenMain() {
composable(Routes.AdminView.route) {
AdminView(navController = navController)
}
+ composable(Routes.DonationInfo.route) {
+ DonationInfoPage(navController = navController)
+ }
composable(Routes.IndividualProduct.route+"/{productId}",
arguments = listOf(navArgument("productId") { type = NavType.StringType })
diff --git a/app/src/main/res/drawable/info_icon.xml b/app/src/main/res/drawable/info_icon.xml
new file mode 100644
index 00000000..a45423f0
--- /dev/null
+++ b/app/src/main/res/drawable/info_icon.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4adb4e13..d60a3df9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -65,6 +65,9 @@
Upload Product Image
Product Image
+
+ Donation Info
+
Reset Password
New Password