Skip to content

Commit

Permalink
belindas-closet-android_4_229_add-donation-page (#230)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
heosman and taylorpapke authored Dec 6, 2023
1 parent d127d22 commit 0fbda6d
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/example/belindas_closet/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
@@ -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))
}

}
}
35 changes: 32 additions & 3 deletions app/src/main/java/com/example/belindas_closet/screen/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/info_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="27.964dp"
android:height="27.964dp"
android:viewportWidth="27.964"
android:viewportHeight="27.964">
<path
android:pathData="M13.982,0.001C6.259,0.001 0,6.259 0,13.984c0,7.721 6.259,13.98 13.982,13.98c7.722,0 13.982,-6.26 13.982,-13.98C27.965,6.259 21.704,0.001 13.982,0.001zM13.982,26.533c-6.933,0 -12.551,-5.619 -12.551,-12.549c0,-6.935 5.618,-12.552 12.551,-12.552c6.931,0 12.55,5.617 12.55,12.552C26.532,20.914 20.913,26.533 13.982,26.533z"
android:fillColor="#000000"/>
<path
android:pathData="M12.004,10.551h3.931v12.649h-3.931z"
android:fillColor="#000000"/>
<path
android:pathData="M13.995,5.072c-1.265,0 -2.095,0.852 -2.095,1.963c0,1.087 0.802,1.964 2.044,1.964c1.317,0 2.119,-0.877 2.119,-1.964C16.037,5.924 15.262,5.072 13.995,5.072z"
android:fillColor="#000000"/>
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<string name="product_image_picker_upload_product_image">Upload Product Image</string>
<string name="product_image_picker_product_image">Product Image</string>

<!-- DonationInfo Screen Strings -->
<string name="donation_info">Donation Info</string>

<!-- Reset Password Screen Strings -->
<string name="reset_password_title">Reset Password</string>
<string name="reset_new_password_label">New Password</string>
Expand Down

0 comments on commit 0fbda6d

Please sign in to comment.