Compare commits

..

10 Commits

Author SHA1 Message Date
7d96407e6c Mantap Rispek broh 2025-11-06 09:46:29 +07:00
221682ade3 Mantap Rispek broo 2025-11-06 09:45:22 +07:00
2c2c104baf Mantap Rispek 2025-11-06 09:44:45 +07:00
ab3870d712 Mantap 2025-11-06 09:42:13 +07:00
Jose Alcérreca
82b7dc7723
Merge pull request #117 from google-developer-training/renovate/configure
Configure Renovate
2024-12-05 12:32:46 +01:00
Jose Alcérreca
8b50e72975
Update and rename renovate.json to .github/renovate.json 2024-12-05 12:32:35 +01:00
renovate[bot]
7097a75f37
Add renovate.json 2024-12-03 17:04:48 +00:00
the-scrambler
a5118e6dfe
Merge pull request #69 from google-developer-training/main-e2e
Implement edge-to-edge on branch main
2024-01-22 21:55:07 -08:00
John Shea
8f9aedaebc Remove TODO wording from README.md 2023-11-01 11:46:02 -04:00
John Shea
5b8dab87ee Implement vertical scrolling for landscape orientation 2023-10-25 11:58:33 -04:00
9 changed files with 6446 additions and 121 deletions

6
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>android/.github:renovate-config"
]
}

View File

@ -5,15 +5,12 @@ This app contains an order flow for cupcakes with options for quantity, flavor,
The order details get displayed on an order summary screen and can be shared to another app to
send the order.
TODO
Pre-requisites
--------------
* Experience with Kotlin syntax.
* How to create and run a project in Android Studio.
* How to create composable functions
* TODO
Getting Started

View File

@ -21,6 +21,8 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
@ -115,7 +117,10 @@ fun CupcakeApp(
NavHost(
navController = navController,
startDestination = CupcakeScreen.Start.name,
modifier = Modifier.padding(innerPadding)
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
.padding(innerPadding)
) {
composable(route = CupcakeScreen.Start.name) {
StartOrderScreen(

View File

@ -39,6 +39,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import com.example.cupcake.R
import com.example.cupcake.ui.components.FormattedPriceLabel
import com.example.cupcake.ui.theme.CupcakeTheme
/**
* Composable that displays the list of items as [RadioButton] options,
@ -100,12 +101,14 @@ fun SelectOptionScreen(
Row(
modifier = Modifier
.fillMaxWidth()
.padding(dimensionResource(R.dimen.padding_medium))
.weight(1f, false),
.padding(dimensionResource(R.dimen.padding_medium)),
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.padding_medium)),
verticalAlignment = Alignment.Bottom
) {
OutlinedButton(modifier = Modifier.weight(1f), onClick = onCancelButtonClicked) {
OutlinedButton(
modifier = Modifier.weight(1f),
onClick = onCancelButtonClicked
) {
Text(stringResource(R.string.cancel))
}
Button(
@ -124,9 +127,11 @@ fun SelectOptionScreen(
@Preview
@Composable
fun SelectOptionPreview() {
CupcakeTheme {
SelectOptionScreen(
subtotal = "299.99",
options = listOf("Option 1", "Option 2", "Option 3", "Option 4"),
modifier = Modifier.fillMaxHeight()
)
}
}

View File

@ -19,9 +19,7 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
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
@ -41,6 +39,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.cupcake.R
import com.example.cupcake.data.DataSource
import com.example.cupcake.ui.theme.CupcakeTheme
/**
* Composable that allows the user to select the desired cupcake quantity and expects
@ -75,7 +74,6 @@ fun StartOrderScreen(
)
Spacer(modifier = Modifier.height(dimensionResource(R.dimen.padding_small)))
}
Row(modifier = Modifier.weight(1f, false)) {
Column(
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
@ -86,13 +84,13 @@ fun StartOrderScreen(
quantityOptions.forEach { item ->
SelectQuantityButton(
labelResourceId = item.first,
onClick = { onNextButtonClicked(item.second) }
onClick = { onNextButtonClicked(item.second) },
modifier = Modifier.fillMaxWidth(),
)
}
}
}
}
}
/**
* Customizable button composable that displays the [labelResourceId]
@ -115,9 +113,13 @@ fun SelectQuantityButton(
@Preview
@Composable
fun StartOrderPreview() {
CupcakeTheme {
StartOrderScreen(
quantityOptions = DataSource.quantityOptions,
onNextButtonClicked = {},
modifier = Modifier.fillMaxSize().padding(dimensionResource(R.dimen.padding_medium))
modifier = Modifier
.fillMaxSize()
.padding(dimensionResource(R.dimen.padding_medium))
)
}
}

View File

@ -38,6 +38,7 @@ import androidx.compose.ui.tooling.preview.Preview
import com.example.cupcake.R
import com.example.cupcake.data.OrderUiState
import com.example.cupcake.ui.components.FormattedPriceLabel
import com.example.cupcake.ui.theme.CupcakeTheme
/**
* This composable expects [orderUiState] that represents the order state, [onCancelButtonClicked]
@ -97,9 +98,7 @@ fun OrderSummaryScreen(
)
}
Row(
modifier = Modifier
.weight(1f, false)
.padding(dimensionResource(R.dimen.padding_medium))
modifier = Modifier.padding(dimensionResource(R.dimen.padding_medium))
) {
Column(
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.padding_small))
@ -124,6 +123,7 @@ fun OrderSummaryScreen(
@Preview
@Composable
fun OrderSummaryPreview() {
CupcakeTheme {
OrderSummaryScreen(
orderUiState = OrderUiState(0, "Test", "Test", "$300.00"),
onSendButtonClicked = { subject: String, summary: String -> },
@ -131,3 +131,4 @@ fun OrderSummaryPreview(){
modifier = Modifier.fillMaxHeight()
)
}
}

View File

@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Cupcake icon for the start fragment -->
<vector android:height="200dp" android:viewportHeight="413.71"
android:viewportWidth="308.15" android:width="148.96909dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#4fc3f7" android:pathData="M34.33,218.79l-27.63,-11.72l-6.7,27.68l34.33,-15.96z"/>
<path android:fillColor="#4fc3f7" android:pathData="M273.75,218.79l27.63,-11.72l6.69,27.68l-34.32,-15.96z"/>
<path android:fillColor="#4fc3f7" android:pathData="M27.22,225.91l20.35,-30.56l29.24,22.58l24.1,-27.94l27.32,24.84l25.84,-26.36l25.85,26.36l27.32,-24.84l24.1,27.94l29.24,-22.58l20.35,30.56"/>
<path android:fillColor="#03a9f4" android:pathData="M280.93,233.84l-20.35,30.57l-29.24,-22.59l-24.1,27.95l-27.32,-24.84l-25.85,26.36l-25.84,-26.36l-27.32,24.84l-24.1,-27.95l-29.24,22.59l-20.35,-30.57"/>
<path android:fillColor="#ffe0b2" android:pathData="M6.72,245.77a147.35,49.81 0,1 0,294.7 0a147.35,49.81 0,1 0,-294.7 0z"/>
<path android:fillColor="#81d4fa" android:pathData="M308.15,234.77 L289.5,219.22l-21.58,31L237.06,228l-25.52,28.14 -28.88,-24.72L155.3,257.8 128,231.41 99.07,256.13 73.54,228 42.68,250.25l-21.58,-31L0,234.75 29.3,380.43C41,424.8 268.46,424.8 281,380.43Z"/>
<path android:fillColor="#4fc3f7" android:pathData="M296.79,290a177.71,177.71 0,0 1,-14.08 22.93c-6.49,8.8 -12.95,17.78 -20.38,25.84 -7.2,7.83 -16.18,14 -24.61,20.32 -26.6,19.82 -63.2,26.79 -95.82,20.47C119.55,377.93 101.2,373 81.14,362c-27.72,-15.16 -49.54,-41.31 -65.72,-67.86 -1.86,-3.05 -3.63,-6.14 -5.34,-9.27L29.3,380.43C41,424.8 268.46,424.8 281,380.43l17.45,-93.7C297.92,287.82 297.36,288.91 296.79,290Z"/>
<path android:fillColor="#29b6f6" android:pathData="M58.88,378.74a2,2 0,0 1,-2 -1.74L42.39,263.14a2,2 0,1 1,4 -0.51L60.87,376.49a2,2 0,0 1,-1.73 2.24Z"/>
<path android:fillColor="#29b6f6" android:pathData="M104.17,385.44a2,2 0,0 1,-2 -1.92l-4.5,-116.09a2,2 0,1 1,4 -0.16l4.51,116.09a2,2 0,0 1,-1.92 2.08Z"/>
<path android:fillColor="#29b6f6" android:pathData="M252.08,378.74h-0.26a2,2 0,0 1,-1.73 -2.24L264.6,262.63a2,2 0,1 1,4 0.51L254.06,377A2,2 0,0 1,252.08 378.74Z"/>
<path android:fillColor="#29b6f6" android:pathData="M206.79,385.44h-0.08a2,2 0,0 1,-1.92 -2.08l4.5,-116.09a2,2 0,0 1,4 0.16l-4.5,116.09A2,2 0,0 1,206.79 385.44Z"/>
<path android:fillColor="#29b6f6" android:pathData="M155.18,388.79a2,2 0,0 1,-2 -2V270.14a2,2 0,0 1,4 0V386.79A2,2 0,0 1,155.18 388.79Z"/>
<path android:fillColor="#f06292" android:pathData="M174.42,0.11S186.94,47.44 104,57.92c0,0 -48.29,5.29 -33.19,37.35a21.64,21.64 0,0 1,-5.47 25.88C47.92,135.74 24.89,164.84 46.08,207a13.44,13.44 0,0 0,7.28 6.57c20.12,7.53 101.54,33.31 201.88,1.32a13.21,13.21 0,0 0,6.3 -4.34c6.57,-8.21 20.38,-31.37 -2.24,-60.91A26.16,26.16 0,0 1,254 135.12c-0.51,-9.9 -4.73,-27.17 -25.88,-39.45a13.57,13.57 0,0 1,-5.69 -16.92c4,-9.75 7.66,-24.1 2,-36.44C214.6,21.28 174.42,0.11 174.42,0.11Z"/>
<path android:fillColor="#ec407a" android:pathData="M256,204.18c-18.82,3.85 -38.66,6.32 -58,5.56a342.08,342.08 0,0 1,-54.75 -7,191.23 191.23,0 0,1 -31,-9 372.7,372.7 0,0 1,-43.43 -19.84c-9.64,-5.25 -19.52,-11.32 -28.07,-18.59 -4.75,14.09 -4.81,31.38 5.4,51.71a13.44,13.44 0,0 0,7.28 6.57c20.12,7.53 101.54,33.31 201.88,1.31a13.12,13.12 0,0 0,6.3 -4.33,48.91 48.91,0 0,0 5.89,-9.43A105.18,105.18 0,0 1,256 204.18Z"/>
<path android:fillColor="#f48fb1" android:pathData="M222.18,89c-28,24.79 -65.43,27.57 -102.41,21.79 -15.62,-2.44 -28.25,-11.48 -42.54,-4.72 -2.93,1.38 -6,4 -5.48,7.19 15.75,0.68 27.44,6.57 42.6,10.88 22.47,6.38 43.32,17.56 65.72,24.18s48,8.13 67.88,-4.07c2.46,-1.51 4.94,-3.39 5.87,-6.13a12.71,12.71 0,0 0,0.06 -6.31c-3.28,-18.77 -15,-33 -31.43,-42.81"/>
<path android:fillColor="#673ab7" android:pathData="M108.057,137.999L141.83,124.422A3.105,3.11 68.099,0 1,145.874 126.143L145.874,126.143A3.105,3.11 68.099,0 1,144.146 130.184L110.373,143.761A3.105,3.11 68.099,0 1,106.329 142.04L106.329,142.04A3.105,3.11 68.099,0 1,108.057 137.999z"/>
<path android:fillColor="#ffee58" android:pathData="M63.656,78.785L63.656,78.785A3.105,3.11 110.731,0 1,67.664 76.982L101.707,89.866A3.105,3.11 110.731,0 1,103.517 93.871L103.517,93.871A3.105,3.11 110.731,0 1,99.509 95.674L65.466,82.79A3.105,3.11 110.731,0 1,63.656 78.785z"/>
<path android:fillColor="#80deea" android:pathData="M223.715,131.605L241.916,99.937A3.121,3.116 119.885,0 1,246.172 98.784L246.172,98.784A3.121,3.116 119.885,0 1,247.318 103.042L229.118,134.71A3.121,3.116 119.885,0 1,224.862 135.864L224.862,135.864A3.121,3.116 119.885,0 1,223.715 131.605z"/>
<path android:fillColor="#8bc34a" android:pathData="M158.163,63.484L158.163,63.484A3.105,3.11 107.861,0 1,162.076 61.482L196.722,72.646A3.105,3.11 107.861,0 1,198.729 76.555L198.729,76.555A3.105,3.11 107.861,0 1,194.817 78.557L160.171,67.393A3.105,3.11 107.861,0 1,158.163 63.484z"/>
<path android:fillColor="#673ab7" android:pathData="M181.372,45.493L201.621,15.246A3.11,3.105 123.799,0 1,205.931 14.389L205.931,14.389A3.11,3.105 123.799,0 1,206.781 18.7L186.532,48.948A3.11,3.105 123.799,0 1,182.222 49.805L182.222,49.805A3.11,3.105 123.799,0 1,181.372 45.493z"/>
<path android:fillColor="#8bc34a" android:pathData="M132.014,205.938L152.263,175.691A3.11,3.105 123.799,0 1,156.574 174.834L156.574,174.834A3.11,3.105 123.799,0 1,157.424 179.145L137.175,209.393A3.11,3.105 123.799,0 1,132.864 210.25L132.864,210.25A3.11,3.105 123.799,0 1,132.014 205.938z"/>
<path android:fillColor="#ffee58" android:pathData="M203.177,166.031L203.177,166.031A3.105,3.11 104.521,0 1,206.966 163.805L242.204,172.931A3.105,3.11 104.521,0 1,244.436 176.716L244.436,176.716A3.105,3.11 104.521,0 1,240.647 178.942L205.409,169.816A3.105,3.11 104.521,0 1,203.177 166.031z"/>
<path android:fillColor="#80deea" android:pathData="M34.294,179.55L56.164,150.453A3.11,3.105 126.929,0 1,60.515 149.832L60.515,149.832A3.11,3.105 126.929,0 1,61.128 154.184L39.258,183.281A3.11,3.105 126.929,0 1,34.907 183.902L34.907,183.902A3.11,3.105 126.929,0 1,34.294 179.55z"/>
<path android:fillColor="#f48fb1" android:pathData="M174.6,0.19c5.85,5.93 5.7,15.41 2.45,23.08a51.17,51.17 0,0 1,-16 20c-22,16.43 -49.79,24.94 -77.21,24.27 -1.61,0 -3.64,-0.43 -4,-2 1.47,-2.29 4.27,-3.29 6.89,-4 12.66,-3.58 26,-5.8 38.46,-10.07C148.61,43.36 169,33.86 174.42,0"/>
</vector>

File diff suppressed because one or more lines are too long

View File

@ -14,33 +14,32 @@
limitations under the License.
-->
<resources>
<string name="app_name">Cupcake</string>
<string name="order_cupcakes">Order Cupcakes</string>
<string name="one_cupcake">One Cupcake</string>
<string name="six_cupcakes">Six Cupcakes</string>
<string name="twelve_cupcakes">Twelve Cupcakes</string>
<string name="choose_flavor">Choose Flavor</string>
<string name="vanilla">Vanilla</string>
<string name="chocolate">Chocolate</string>
<string name="red_velvet">Red Velvet</string>
<string name="salted_caramel">Salted Caramel</string>
<string name="coffee">Coffee</string>
<string name="special_flavor">Special Flavor</string>
<string name="cancel">Cancel</string>
<string name="next">Next</string>
<string name="choose_pickup_date">Choose Pickup Date</string>
<string name="order_summary">Order Summary</string>
<string name="send">Send Order to Another App</string>
<string name="quantity">Quantity</string>
<string name="flavor">Flavor</string>
<string name="pickup_date">Pickup date</string>
<string name="app_name">Miee Ayam</string>
<string name="order_mie_ayam">Pesan Mie Ayam</string>
<string name="one_mie_ayam">1 Porsi</string>
<string name="six_mie_ayam">6 Porsi</string>
<string name="twelve_mie_ayam">12 Porsi</string>
<string name="choose_flavor">Pilih Menu</string>
<string name="biasa">Biasa</string>
<string name="mie_ayam_bakso">Miee Ayam Bakso</string>
<string name="mie_ayam_ceker">Mie Ayam Ceker</string>
<string name="mie_ayam_yamin">Mie Ayam Yamin</string>
<string name="mie_ayam_komplit">Mie Ayam Komplit</string>
<string name="cancel">Batal</string>
<string name="next">Lanjut</string>
<string name="choose_pickup_date">Pilih Tanggal Kirim</string>
<string name="order_summary">Detail Orderan</string>
<string name="send">Bagikan ke Aplikasi Lain</string>
<string name="quantity">Jumlah</string>
<string name="flavor">Menu</string>
<string name="pickup_date">Tanggall Kirim</string>
<string name="subtotal_price">Subtotal %s</string>
<string name="total_price">Total %s</string>
<string name="new_cupcake_order">New Cupcake Order</string>
<string name="order_details">Quantity: %1$s \nFlavor: %2$s \nPickup date: %3$s \nTotal: %4$s \n\nThank you!</string>
<string name="back_button">Back</string>
<plurals name="cupcakes">
<item quantity="one">%d cupcake</item>
<item quantity="other">%d cupcakes</item>
<string name="new_mie_ayam_order">Orderan Mie Ayam Baru</string>
<string name="order_details">Jumlah: %1$s \nMenu: %2$s \nTanggal Kirim: %3$s \nTotal: %4$s \n\nTerima Kasih! Selamat Menikmati!</string>
<string name="back_button">Kembali</string>
<plurals name="mie_ayam">
<item quantity="one">%d porsi mie ayam</item>
<item quantity="other">%d porsi mie ayam</item>
</plurals>
</resources>