8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2023 Xero
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
Coffee Drop
3 |
4 | [](./LICENSE)
5 | [](https://github.com/dev-xero/paper-app/releases/tag/v1.0)
6 |
7 | Coffee App UI Built with Kotlin and Jetpack Compose. The design is inspired by this concept on dribbble. It's based on the Clean Architecture (or at least my implementation of it). Not a fully-functional app, more of a UI practice app.
8 |
9 | ## Screenshots
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## Try out the app
17 |
If you're looking for something you can run, just head over to the releases page.
18 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | id("org.jetbrains.kotlin.android")
4 | kotlin("kapt")
5 | id("com.google.dagger.hilt.android")
6 | }
7 |
8 | android {
9 | namespace = "architex.labs.coffeedrop"
10 | compileSdk = 33
11 |
12 | defaultConfig {
13 | applicationId = "architex.labs.coffeedrop"
14 | minSdk = 24
15 | targetSdk = 33
16 | versionCode = 1
17 | versionName = "1.0"
18 |
19 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20 | vectorDrawables {
21 | useSupportLibrary = true
22 | }
23 | }
24 |
25 | buildTypes {
26 | getByName("release") {
27 | isMinifyEnabled = false
28 | proguardFiles(
29 | getDefaultProguardFile("proguard-android-optimize.txt"),
30 | "proguard-rules.pro"
31 | )
32 | }
33 | }
34 | compileOptions {
35 | sourceCompatibility = JavaVersion.VERSION_17
36 | targetCompatibility = JavaVersion.VERSION_17
37 | }
38 | buildFeatures {
39 | compose = true
40 | }
41 | composeOptions {
42 | kotlinCompilerExtensionVersion = "1.4.6"
43 | }
44 | packagingOptions.resources.excludes.add("META-INF/{AL2.0,LGPL2.1}")
45 | }
46 |
47 | dependencies {
48 | val coreVersion = "1.10.0"
49 | val lifecycleVersion = "2.6.1"
50 | val activityComposeVersion = "1.7.1"
51 | val splashScreenVersion = "1.0.1"
52 | val viewModelVersion = "2.6.1"
53 | val navigationComposeVersion = "2.5.3"
54 | val daggerVersion = "2.44.2"
55 | val hiltVersion = "1.0.0"
56 |
57 | implementation ("androidx.core:core-ktx:$coreVersion")
58 | implementation ("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
59 | implementation ("androidx.activity:activity-compose:$activityComposeVersion")
60 | implementation (platform("androidx.compose:compose-bom:2023.04.01"))
61 | implementation ("androidx.compose.ui:ui")
62 | implementation ("androidx.compose.ui:ui-graphics")
63 | implementation ("androidx.compose.ui:ui-tooling-preview")
64 | implementation ("androidx.compose.material3:material3")
65 | implementation ("androidx.core:core-splashscreen:$splashScreenVersion")
66 | implementation ("androidx.lifecycle:lifecycle-viewmodel-compose:$viewModelVersion")
67 | implementation ("androidx.navigation:navigation-compose:$navigationComposeVersion")
68 | implementation ("com.google.dagger:hilt-android:$daggerVersion")
69 | kapt ("com.google.dagger:hilt-android-compiler:$daggerVersion")
70 | implementation ("androidx.hilt:hilt-navigation-compose:$hiltVersion")
71 |
72 | testImplementation ("junit:junit:4.13.2")
73 | androidTestImplementation ("androidx.test.ext:junit:1.1.5")
74 | androidTestImplementation ("androidx.test.espresso:espresso-core:3.5.1")
75 | androidTestImplementation (platform ("androidx.compose:compose-bom:2023.04.01"))
76 | androidTestImplementation ("androidx.compose.ui:ui-test-junit4")
77 | debugImplementation ("androidx.compose.ui:ui-tooling")
78 | debugImplementation ("androidx.compose.ui:ui-test-manifest")
79 | }
80 |
81 | kapt {
82 | correctErrorTypes = true
83 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.kts.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/architex/labs/coffeedrop/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package architex.labs.coffeedrop
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("architex.labs.coffeedrop", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
19 |
20 |
31 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/application/BaseApplication.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.application
17 |
18 | import android.app.Application
19 | import dagger.hilt.android.HiltAndroidApp
20 |
21 | @HiltAndroidApp
22 | class BaseApplication : Application()
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/application/di/AppModule.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.application.di
17 |
18 | import architex.labs.coffeedrop.data.repository.CoffeeListImpl
19 | import architex.labs.coffeedrop.domain.repository.CoffeeList
20 | import dagger.Module
21 | import dagger.Provides
22 | import dagger.hilt.InstallIn
23 | import dagger.hilt.components.SingletonComponent
24 | import javax.inject.Singleton
25 |
26 | @Module
27 | @InstallIn(SingletonComponent::class)
28 | object AppModule {
29 |
30 | @Provides
31 | @Singleton
32 | fun providesCoffeeList(): CoffeeList {
33 | return CoffeeListImpl()
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/application/navigation/NavGraph.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.application.navigation
17 |
18 | import androidx.compose.runtime.Composable
19 | import androidx.hilt.navigation.compose.hiltViewModel
20 | import androidx.navigation.NavHostController
21 | import androidx.navigation.compose.NavHost
22 | import androidx.navigation.compose.composable
23 | import architex.labs.coffeedrop.application.navigation.routes.NavRoutes
24 | import architex.labs.coffeedrop.presentation.screens.CoffeeDetailsScreen
25 | import architex.labs.coffeedrop.presentation.screens.HomeScreen
26 | import architex.labs.coffeedrop.presentation.viewmodels.CoffeeDetailsScreenViewModel
27 | import architex.labs.coffeedrop.presentation.viewmodels.HomeScreenViewModel
28 |
29 | @Composable
30 | fun NavGraph(
31 | navController: NavHostController
32 | ) {
33 | NavHost(navController = navController, startDestination = NavRoutes.HomeScreen.route) {
34 | composable(route = NavRoutes.HomeScreen.route) {
35 | val viewModel = hiltViewModel()
36 | HomeScreen(
37 | viewModel = viewModel,
38 | onCoffeeDetailScreenClicked = {
39 | val id = viewModel.selectedCoffeeID.toString()
40 | navController.navigate( "${NavRoutes.CoffeeDetailScreen.route}/$id" )
41 | },
42 |
43 | )
44 | }
45 | composable(route = "${NavRoutes.CoffeeDetailScreen.route}/{id}") { navBackStack ->
46 | val viewModel = hiltViewModel()
47 | val id = navBackStack.arguments?.getString("id")!!.toInt()
48 | viewModel.setCoffeeID(id)
49 |
50 | CoffeeDetailsScreen(
51 | viewModel = viewModel,
52 | onBackButtonClicked = { navController.popBackStack() }
53 | )
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/application/navigation/bottom_nav/BottomNavItemList.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.application.navigation.bottom_nav
17 |
18 | import architex.labs.coffeedrop.R
19 | import architex.labs.coffeedrop.presentation.utils.BottomNavItem
20 |
21 | val bottomNavItemList: MutableList = mutableListOf(
22 | BottomNavItem(
23 | selectedIcon = R.drawable.icon_home_filled,
24 | unselectedIcon = R.drawable.icon_home_outline,
25 | route = "Home"
26 | ),
27 |
28 | BottomNavItem(
29 | selectedIcon = R.drawable.icon_shopping_bag_filled,
30 | unselectedIcon = R.drawable.icon_shopping_bag_outline,
31 | route = "Cart"
32 | ),
33 |
34 | BottomNavItem(
35 | selectedIcon = R.drawable.icon_heart_filled,
36 | unselectedIcon = R.drawable.icon_heart_outline,
37 | route = "Favorites"
38 | ),
39 |
40 | BottomNavItem(
41 | selectedIcon = R.drawable.icon_notification_filled,
42 | unselectedIcon = R.drawable.icon_notification_outline,
43 | route = "Notification"
44 | )
45 | )
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/application/navigation/routes/NavRoutes.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.application.navigation.routes
17 |
18 | sealed class NavRoutes(val route: String) {
19 | object HomeScreen: NavRoutes("home_screen")
20 | object CoffeeDetailScreen: NavRoutes("coffee_details_screen")
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/data/repository/CoffeeListImpl.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.data.repository
17 |
18 | import architex.labs.coffeedrop.R
19 | import architex.labs.coffeedrop.domain.models.Coffee
20 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeSize
21 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeType
22 | import architex.labs.coffeedrop.domain.models.sub_models.RoastingLevel
23 | import architex.labs.coffeedrop.domain.repository.CoffeeList
24 |
25 | class CoffeeListImpl : CoffeeList {
26 |
27 | override val list: List
28 | get() = listOf(
29 | Coffee(
30 | id = 0,
31 | imageResID = R.drawable.image_1,
32 | name = R.string.cappuccino,
33 | description = R.string.cappuccino_description,
34 | variant = "With Oat Milk",
35 | coffeeType = CoffeeType.Cappuccino,
36 | price = 4.20,
37 | rating = 4.6,
38 | reviews = 18048,
39 | roastingLevel = RoastingLevel.MediumRoasted,
40 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
41 | ),
42 |
43 | Coffee(
44 | id = 1,
45 | imageResID = R.drawable.image_2,
46 | name = R.string.espresso,
47 | description = R.string.espresso_description,
48 | variant = "With Chocolate",
49 | coffeeType = CoffeeType.Espresso,
50 | price = 4.40,
51 | rating = 4.4,
52 | reviews = 16204,
53 | roastingLevel = RoastingLevel.HighRoasted,
54 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
55 | ),
56 |
57 | Coffee(
58 | id = 2,
59 | imageResID = R.drawable.image_3,
60 | name = R.string.cappuccino,
61 | description = R.string.cappuccino_description,
62 | variant = "With Creamy Milk",
63 | coffeeType = CoffeeType.Cappuccino,
64 | price = 4.80,
65 | rating = 4.9,
66 | reviews = 24912,
67 | roastingLevel = RoastingLevel.MediumRoasted,
68 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
69 | ),
70 |
71 | Coffee(
72 | id = 3,
73 | imageResID = R.drawable.image_4,
74 | name = R.string.mocha,
75 | description = R.string.mocha_description,
76 | variant = "With Whole Milk",
77 | coffeeType = CoffeeType.Mocha,
78 | price = 4.00,
79 | rating = 4.2,
80 | reviews = 71684,
81 | roastingLevel = RoastingLevel.LowRoasted,
82 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
83 | ),
84 |
85 | Coffee(
86 | id = 4,
87 | imageResID = R.drawable.image_5,
88 | name = R.string.cortado,
89 | description = R.string.cortado_description,
90 | variant = "With Coconut Milk",
91 | coffeeType = CoffeeType.Cortado,
92 | price = 5.00,
93 | rating = 4.8,
94 | reviews = 64122,
95 | roastingLevel = RoastingLevel.MediumRoasted,
96 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
97 | ),
98 |
99 | Coffee(
100 | id = 5,
101 | imageResID = R.drawable.image_6,
102 | name = R.string.latte,
103 | description = R.string.latte_description,
104 | variant = "With Almond Milk",
105 | coffeeType = CoffeeType.Latte,
106 | price = 4.20,
107 | rating = 4.6,
108 | reviews = 24708,
109 | roastingLevel = RoastingLevel.HighRoasted,
110 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
111 | ),
112 |
113 | Coffee(
114 | id =6,
115 | imageResID = R.drawable.image_7,
116 | name = R.string.cappuccino,
117 | description = R.string.cappuccino_description,
118 | variant = "With Skim Milk",
119 | coffeeType = CoffeeType.Cappuccino,
120 | price = 4.45,
121 | rating = 4.5,
122 | reviews = 3270,
123 | roastingLevel = RoastingLevel.HighRoasted,
124 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
125 | ),
126 |
127 | Coffee(
128 | id = 7,
129 | imageResID = R.drawable.image_8,
130 | name = R.string.double_espresso,
131 | description = R.string.double_espresso_description,
132 | variant = "With Whole Milk",
133 | coffeeType = CoffeeType.DoubleEspresso,
134 | price = 4.67,
135 | rating = 4.3,
136 | reviews = 11051,
137 | roastingLevel = RoastingLevel.LowRoasted,
138 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
139 | ),
140 |
141 | Coffee(
142 | id = 8,
143 | imageResID = R.drawable.image_9,
144 | name = R.string.espresso,
145 | description = R.string.espresso_description,
146 | variant = "With Whole Milk",
147 | coffeeType = CoffeeType.Espresso,
148 | price = 4.90,
149 | rating = 4.7,
150 | reviews = 41002,
151 | roastingLevel = RoastingLevel.LowRoasted,
152 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
153 | ),
154 |
155 | Coffee(
156 | id = 9,
157 | imageResID = R.drawable.image_10,
158 | name = R.string.cortado,
159 | description = R.string.cortado_description,
160 | variant = "With Soy Milk",
161 | coffeeType = CoffeeType.Cortado,
162 | price = 5.20,
163 | rating = 4.9,
164 | reviews = 84311,
165 | roastingLevel = RoastingLevel.MediumRoasted,
166 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
167 | ),
168 |
169 | Coffee(
170 | id = 10,
171 | imageResID = R.drawable.image_11,
172 | name = R.string.cortado,
173 | description = R.string.cortado_description,
174 | variant = "With Oat Milk",
175 | coffeeType = CoffeeType.Cortado,
176 | price = 5.12,
177 | rating = 4.8,
178 | reviews = 33001,
179 | roastingLevel = RoastingLevel.HighRoasted,
180 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
181 | ),
182 |
183 | Coffee(
184 | id = 11,
185 | imageResID = R.drawable.image_12,
186 | name = R.string.latte,
187 | description = R.string.latte_description,
188 | variant = "With Soy Milk",
189 | coffeeType = CoffeeType.Latte,
190 | price = 4.90,
191 | rating = 4.6,
192 | reviews = 7020,
193 | roastingLevel = RoastingLevel.LowRoasted,
194 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
195 | ),
196 |
197 | Coffee(
198 | id = 12,
199 | imageResID = R.drawable.image_13,
200 | name = R.string.cappuccino,
201 | description = R.string.cappuccino_description,
202 | variant = "With Oat Milk",
203 | coffeeType = CoffeeType.Cappuccino,
204 | price = 4.90,
205 | rating = 4.7,
206 | reviews = 62010,
207 | roastingLevel = RoastingLevel.HighRoasted,
208 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Large)
209 | ),
210 |
211 | Coffee(
212 | id = 13,
213 | imageResID = R.drawable.image_14,
214 | name = R.string.espresso,
215 | description = R.string.espresso_description,
216 | variant = "With Skim Milk",
217 | coffeeType = CoffeeType.Espresso,
218 | price = 4.40,
219 | rating = 4.8,
220 | reviews = 18231,
221 | roastingLevel = RoastingLevel.MediumRoasted,
222 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium)
223 | ),
224 |
225 | Coffee(
226 | id = 14,
227 | imageResID = R.drawable.image_15,
228 | name = R.string.latte,
229 | description = R.string.latte_description,
230 | variant = "With Almond Milk",
231 | coffeeType = CoffeeType.Latte,
232 | price = 5.00,
233 | rating = 4.9,
234 | reviews = 77025,
235 | roastingLevel = RoastingLevel.HighRoasted,
236 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
237 | ),
238 |
239 | Coffee(
240 | id = 15,
241 | imageResID = R.drawable.image_16,
242 | name = R.string.mocha,
243 | description = R.string.mocha_description,
244 | variant = "With Soy Milk",
245 | coffeeType = CoffeeType.Mocha,
246 | price = 4.75,
247 | rating = 4.8,
248 | reviews = 10030,
249 | roastingLevel = RoastingLevel.LowRoasted,
250 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
251 | ),
252 |
253 | Coffee(
254 | id = 16,
255 | imageResID = R.drawable.image_17,
256 | name = R.string.cortado,
257 | description = R.string.cortado_description,
258 | variant = "With Skim Milk",
259 | coffeeType = CoffeeType.Cortado,
260 | price = 5.20,
261 | rating = 4.9,
262 | reviews = 98160,
263 | roastingLevel = RoastingLevel.HighRoasted,
264 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
265 | ),
266 |
267 | Coffee(
268 | id = 17,
269 | imageResID = R.drawable.image_18,
270 | name = R.string.double_espresso,
271 | description = R.string.double_espresso_description,
272 | variant = "With Oat Milk",
273 | coffeeType = CoffeeType.DoubleEspresso,
274 | price = 4.10,
275 | rating = 4.4,
276 | reviews = 53990,
277 | roastingLevel = RoastingLevel.LowRoasted,
278 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
279 | ),
280 |
281 | Coffee(
282 | id = 18,
283 | imageResID = R.drawable.image_19,
284 | name = R.string.double_espresso,
285 | description = R.string.double_espresso_description,
286 | variant = "With Coconut Milk",
287 | coffeeType = CoffeeType.DoubleEspresso,
288 | price = 4.20,
289 | rating = 4.7,
290 | reviews = 8100,
291 | roastingLevel = RoastingLevel.MediumRoasted,
292 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
293 | ),
294 |
295 | Coffee(
296 | id = 19,
297 | imageResID = R.drawable.image_20,
298 | name = R.string.mocha,
299 | description = R.string.mocha_description,
300 | variant = "With Coconut Milk",
301 | coffeeType = CoffeeType.Mocha,
302 | price = 4.80,
303 | rating = 4.8,
304 | reviews = 32021,
305 | roastingLevel = RoastingLevel.MediumRoasted,
306 | coffeeSize = listOf(CoffeeSize.Small, CoffeeSize.Medium, CoffeeSize.Large)
307 | )
308 | )
309 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/domain/models/Coffee.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.domain.models
17 |
18 | import androidx.annotation.DrawableRes
19 | import androidx.annotation.StringRes
20 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeSize
21 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeType
22 | import architex.labs.coffeedrop.domain.models.sub_models.RoastingLevel
23 |
24 | data class Coffee(
25 | val id: Int,
26 | @DrawableRes val imageResID: Int,
27 | @StringRes val name: Int,
28 | @StringRes val description: Int,
29 | val variant: String,
30 | val coffeeType: CoffeeType,
31 | val price: Double,
32 | val rating: Double,
33 | val reviews: Int,
34 | val roastingLevel: RoastingLevel,
35 | val coffeeSize: List
36 | )
37 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/domain/models/sub_models/CoffeeSize.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.domain.models.sub_models
17 |
18 | sealed class CoffeeSize(val size: String) {
19 | object Small: CoffeeSize("SM")
20 | object Medium: CoffeeSize("MD")
21 | object Large: CoffeeSize("LG")
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/domain/models/sub_models/CoffeeType.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.domain.models.sub_models
17 |
18 | sealed class CoffeeType(val type: String) {
19 | object Cappuccino: CoffeeType("Cappuccino")
20 | object Latte: CoffeeType("Latte")
21 | object Espresso: CoffeeType("Espresso")
22 | object DoubleEspresso: CoffeeType("Double Espresso")
23 | object Mocha: CoffeeType("Mocha")
24 | object Cortado: CoffeeType("Cortado")
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/domain/models/sub_models/RoastingLevel.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.domain.models.sub_models
17 |
18 | sealed class RoastingLevel(val roastingLevel: String) {
19 | object LowRoasted: RoastingLevel("LOW ROAST")
20 | object MediumRoasted: RoastingLevel("MEDIUM ROAST")
21 | object HighRoasted: RoastingLevel("HIGH ROAST")
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/domain/repository/CoffeeList.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.domain.repository
17 |
18 | import architex.labs.coffeedrop.domain.models.Coffee
19 |
20 | interface CoffeeList {
21 | val list: List
22 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation
17 |
18 | import android.os.Bundle
19 | import androidx.activity.ComponentActivity
20 | import androidx.activity.compose.setContent
21 | import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
22 | import androidx.navigation.compose.rememberNavController
23 | import architex.labs.coffeedrop.application.navigation.NavGraph
24 | import architex.labs.coffeedrop.presentation.theme.CoffeeDropTheme
25 | import dagger.hilt.android.AndroidEntryPoint
26 |
27 | @AndroidEntryPoint
28 | class MainActivity : ComponentActivity() {
29 | override fun onCreate(savedInstanceState: Bundle?) {
30 | installSplashScreen()
31 |
32 | super.onCreate(savedInstanceState)
33 | setContent {
34 | CoffeeDropTheme {
35 | val navController = rememberNavController()
36 | NavGraph(navController)
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/AppBar.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.Image
19 | import androidx.compose.foundation.background
20 | import androidx.compose.foundation.border
21 | import androidx.compose.foundation.layout.Arrangement
22 | import androidx.compose.foundation.layout.Box
23 | import androidx.compose.foundation.layout.Row
24 | import androidx.compose.foundation.layout.fillMaxWidth
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.shape.RoundedCornerShape
27 | import androidx.compose.material3.Icon
28 | import androidx.compose.runtime.Composable
29 | import androidx.compose.ui.Alignment
30 | import androidx.compose.ui.Modifier
31 | import androidx.compose.ui.draw.clip
32 | import androidx.compose.ui.layout.ContentScale
33 | import androidx.compose.ui.res.painterResource
34 | import androidx.compose.ui.res.stringResource
35 | import androidx.compose.ui.tooling.preview.Preview
36 | import androidx.compose.ui.unit.dp
37 | import architex.labs.coffeedrop.R
38 | import architex.labs.coffeedrop.presentation.theme.CoffeeDropTheme
39 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
40 | import architex.labs.coffeedrop.presentation.theme.Neutrals300
41 |
42 | @Composable
43 | fun AppBar(
44 | modifier: Modifier = Modifier
45 | ) {
46 | Row(
47 | modifier = modifier.fillMaxWidth(),
48 | verticalAlignment = Alignment.CenterVertically,
49 | horizontalArrangement = Arrangement.SpaceBetween
50 | ) {
51 | Box(
52 | modifier = Modifier
53 | .size(48.dp)
54 | .clip(RoundedCornerShape(16.dp))
55 | .background(Neutrals300),
56 | contentAlignment = Alignment.Center
57 | ) {
58 | Icon(
59 | painter = painterResource(id = R.drawable.icon_menu),
60 | contentDescription = stringResource(id = R.string.description_menu),
61 | tint = Neutrals100,
62 | modifier = Modifier.size(24.dp)
63 | )
64 | }
65 |
66 | Image(
67 | painter = painterResource(id = R.drawable.avatar),
68 | contentDescription = stringResource(id = R.string.description_avatar),
69 | contentScale = ContentScale.Crop,
70 | modifier = Modifier
71 | .size(48.dp)
72 | .clip(RoundedCornerShape(16.dp))
73 | .border(2.dp, Neutrals100, RoundedCornerShape(16.dp))
74 | )
75 | }
76 | }
77 |
78 | @Preview
79 | @Composable
80 | fun AppBarDefaultPreview() {
81 | CoffeeDropTheme {
82 | AppBar()
83 | }
84 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/BottomNavBar.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.fillMaxWidth
19 | import androidx.compose.material3.Icon
20 | import androidx.compose.material3.NavigationBar
21 | import androidx.compose.material3.NavigationBarItem
22 | import androidx.compose.material3.NavigationBarItemDefaults
23 | import androidx.compose.runtime.Composable
24 | import androidx.compose.ui.Modifier
25 | import androidx.compose.ui.res.painterResource
26 | import architex.labs.coffeedrop.application.navigation.bottom_nav.bottomNavItemList
27 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
28 | import architex.labs.coffeedrop.presentation.theme.Neutrals400Transparent
29 | import architex.labs.coffeedrop.presentation.theme.Primary
30 |
31 | @Composable
32 | fun BottomNavBar(
33 | modifier: Modifier = Modifier,
34 | currentScreen: String,
35 | changeCurrentScreen: (String) -> Unit
36 | ) {
37 | NavigationBar(
38 | modifier = modifier.fillMaxWidth(),
39 | containerColor = Neutrals400Transparent
40 | ) {
41 | bottomNavItemList.forEach { navItem ->
42 | val isSelected = navItem.route == currentScreen
43 |
44 | NavigationBarItem(
45 | selected = isSelected,
46 | onClick = { changeCurrentScreen(navItem.route) },
47 | icon = {
48 | Icon(
49 | painter = if (isSelected)
50 | painterResource(id = navItem.selectedIcon)
51 | else
52 | painterResource(id = navItem.unselectedIcon),
53 | contentDescription = navItem.route
54 | )
55 | },
56 | alwaysShowLabel = false,
57 | colors = NavigationBarItemDefaults.colors(
58 | selectedIconColor = Primary,
59 | unselectedIconColor = Neutrals200,
60 | indicatorColor = Neutrals400Transparent
61 | )
62 | )
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeCard.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.Image
19 | import androidx.compose.foundation.background
20 | import androidx.compose.foundation.layout.Arrangement
21 | import androidx.compose.foundation.layout.Box
22 | import androidx.compose.foundation.layout.Column
23 | import androidx.compose.foundation.layout.fillMaxSize
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.shape.RoundedCornerShape
27 | import androidx.compose.material3.MaterialTheme
28 | import androidx.compose.material3.Text
29 | import androidx.compose.runtime.Composable
30 | import androidx.compose.ui.Alignment
31 | import androidx.compose.ui.Modifier
32 | import androidx.compose.ui.draw.clip
33 | import androidx.compose.ui.layout.ContentScale
34 | import androidx.compose.ui.res.painterResource
35 | import androidx.compose.ui.res.stringResource
36 | import androidx.compose.ui.unit.dp
37 | import architex.labs.coffeedrop.domain.models.Coffee
38 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
39 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
40 | import architex.labs.coffeedrop.presentation.theme.Neutrals300
41 |
42 | @Composable
43 | fun CoffeeCard(
44 | modifier: Modifier = Modifier,
45 | coffee: Coffee,
46 | onCoffeeDetailsButtonClicked: (id: Int) -> Unit
47 | ) {
48 | Column(
49 | modifier = modifier
50 | .size(width = 164.dp, height = 260.dp)
51 | .clip(RoundedCornerShape(16.dp))
52 | .background(Neutrals300)
53 | .padding(8.dp)
54 | ) {
55 | Column(
56 | modifier = Modifier
57 | .fillMaxSize(),
58 | verticalArrangement = Arrangement.spacedBy(8.dp),
59 | ) {
60 | Box(
61 | modifier = Modifier
62 | .size(156.dp)
63 | .clip(RoundedCornerShape(12.dp)),
64 | contentAlignment = Alignment.TopEnd
65 | ) {
66 | RatingBadge(rating = coffee.rating)
67 | Image(
68 | painter = painterResource(id = coffee.imageResID),
69 | contentDescription = stringResource(id = coffee.name),
70 | contentScale = ContentScale.Crop
71 | )
72 | }
73 |
74 | Column(
75 | verticalArrangement = Arrangement.spacedBy(4.dp)
76 | ) {
77 | Text(
78 | text = stringResource(id = coffee.name),
79 | style = MaterialTheme.typography.titleMedium,
80 | color = Neutrals100
81 | )
82 | Text(
83 | text = coffee.variant,
84 | style = MaterialTheme.typography.labelSmall,
85 | color = Neutrals200
86 | )
87 | CoffeeCardBottomRow(
88 | price = coffee.price,
89 | onDetailsButtonClick = { onCoffeeDetailsButtonClicked(coffee.id) }
90 | )
91 | }
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeCardBottomRow.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.Arrangement
19 | import androidx.compose.foundation.layout.Row
20 | import androidx.compose.foundation.layout.fillMaxWidth
21 | import androidx.compose.foundation.layout.size
22 | import androidx.compose.foundation.shape.RoundedCornerShape
23 | import androidx.compose.material3.Icon
24 | import androidx.compose.material3.IconButton
25 | import androidx.compose.material3.IconButtonDefaults
26 | import androidx.compose.material3.MaterialTheme
27 | import androidx.compose.material3.Text
28 | import androidx.compose.runtime.Composable
29 | import androidx.compose.ui.Alignment
30 | import androidx.compose.ui.Modifier
31 | import androidx.compose.ui.draw.clip
32 | import androidx.compose.ui.res.painterResource
33 | import androidx.compose.ui.res.stringResource
34 | import androidx.compose.ui.unit.dp
35 | import architex.labs.coffeedrop.R
36 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
37 | import architex.labs.coffeedrop.presentation.theme.Primary
38 |
39 | @Composable
40 | fun CoffeeCardBottomRow(
41 | modifier: Modifier = Modifier,
42 | price: Double,
43 | onDetailsButtonClick: () -> Unit,
44 | ) {
45 | Row(
46 | modifier = modifier.fillMaxWidth(),
47 | horizontalArrangement = Arrangement.SpaceBetween,
48 | verticalAlignment = Alignment.CenterVertically
49 | ) {
50 | Row (
51 | horizontalArrangement = Arrangement.spacedBy(2.dp)
52 | ) {
53 | Text(
54 | text = stringResource(id = R.string.dollar_sign),
55 | style = MaterialTheme.typography.bodyLarge,
56 | color = Primary
57 | )
58 | Text(
59 | text = stringResource(id = R.string.price, price),
60 | style = MaterialTheme.typography.bodyLarge,
61 | color = Neutrals100
62 | )
63 | }
64 |
65 | IconButton(
66 | onClick = onDetailsButtonClick,
67 | colors = IconButtonDefaults.iconButtonColors(
68 | containerColor = Primary,
69 | contentColor = Neutrals100
70 | ),
71 | modifier = Modifier
72 | .clip(RoundedCornerShape(8.dp))
73 | .size(32.dp)
74 | ) {
75 | Icon(
76 | painter = painterResource(id = R.drawable.icon_plus),
77 | contentDescription = stringResource(id = R.string.description_add_button),
78 | tint = Neutrals100,
79 | modifier = Modifier.size(18.dp)
80 | )
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeDetailsBottomRow.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.Arrangement
19 | import androidx.compose.foundation.layout.Column
20 | import androidx.compose.foundation.layout.Row
21 | import androidx.compose.foundation.layout.fillMaxWidth
22 | import androidx.compose.foundation.layout.padding
23 | import androidx.compose.foundation.layout.width
24 | import androidx.compose.foundation.shape.RoundedCornerShape
25 | import androidx.compose.material3.Button
26 | import androidx.compose.material3.ButtonDefaults
27 | import androidx.compose.material3.MaterialTheme
28 | import androidx.compose.material3.Text
29 | import androidx.compose.runtime.Composable
30 | import androidx.compose.ui.Modifier
31 | import androidx.compose.ui.res.stringResource
32 | import androidx.compose.ui.unit.dp
33 | import architex.labs.coffeedrop.R
34 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
35 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
36 | import architex.labs.coffeedrop.presentation.theme.Primary
37 |
38 | @Composable
39 | fun CoffeeDetailsBottomRow(
40 | modifier: Modifier = Modifier,
41 | price: Double
42 | ) {
43 | Row(
44 | modifier = modifier.fillMaxWidth(),
45 | horizontalArrangement = Arrangement.SpaceBetween
46 | ) {
47 | Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
48 | Text(
49 | text = stringResource(id = R.string.price_literal).uppercase(),
50 | style = MaterialTheme.typography.titleSmall,
51 | color = Neutrals200
52 | )
53 |
54 | Row(horizontalArrangement = Arrangement.spacedBy(2.dp)) {
55 | Text(
56 | text = stringResource(id = R.string.dollar_sign),
57 | style = MaterialTheme.typography.displayMedium,
58 | color = Primary
59 | )
60 | Text(
61 | text = stringResource(id = R.string.price, price),
62 | style = MaterialTheme.typography.displayMedium,
63 | color = Neutrals100
64 | )
65 | }
66 | }
67 |
68 | Button(
69 | onClick = { /*TODO*/ },
70 | elevation = ButtonDefaults.buttonElevation(0.dp),
71 | colors = ButtonDefaults.buttonColors(
72 | containerColor = Primary
73 | ),
74 | shape = RoundedCornerShape(12.dp),
75 | content = {
76 | Text(
77 | text = stringResource(id = R.string.order_now),
78 | style = MaterialTheme.typography.bodyLarge,
79 | color = Neutrals100,
80 | modifier = Modifier.padding(vertical = 8.dp)
81 | )
82 | },
83 | modifier = Modifier.width(220.dp)
84 | )
85 | }
86 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeDetailsDisplay.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.Image
19 | import androidx.compose.foundation.layout.Arrangement
20 | import androidx.compose.foundation.layout.Box
21 | import androidx.compose.foundation.layout.Column
22 | import androidx.compose.foundation.layout.fillMaxSize
23 | import androidx.compose.foundation.layout.height
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.layout.widthIn
27 | import androidx.compose.foundation.shape.RoundedCornerShape
28 | import androidx.compose.runtime.Composable
29 | import androidx.compose.ui.Modifier
30 | import androidx.compose.ui.draw.clip
31 | import androidx.compose.ui.layout.ContentScale
32 | import androidx.compose.ui.res.painterResource
33 | import androidx.compose.ui.res.stringResource
34 | import androidx.compose.ui.unit.dp
35 | import androidx.compose.ui.zIndex
36 | import architex.labs.coffeedrop.R
37 |
38 | @Composable
39 | fun CoffeeDetailsDisplay(
40 | modifier: Modifier = Modifier,
41 | imageResID: Int,
42 | titleRedID: Int,
43 | variant: String,
44 | ratings: Double,
45 | reviews: Int,
46 | coffeeType: String,
47 | onBackButtonClicked: () -> Unit
48 | ) {
49 | Column(
50 | modifier = modifier
51 | .fillMaxSize()
52 | .padding(12.dp)
53 | ) {
54 | Box(
55 | modifier = Modifier.widthIn(max = 400.dp).height(440.dp)
56 | ) {
57 | Column(
58 | verticalArrangement = Arrangement.SpaceBetween,
59 | modifier = Modifier
60 | .zIndex(99f)
61 | .height(452.dp)
62 | ) {
63 | CoffeeDetailsTopRow(
64 | icons = Pair(R.drawable.icon_arrow_left, R.drawable.icon_heart_filled),
65 | onBackButtonClicked = onBackButtonClicked,
66 | modifier = Modifier
67 | .zIndex(99f)
68 | .padding(8.dp)
69 | )
70 |
71 | CoffeeDetailsDisplayBottomRow(
72 | titleResID = titleRedID,
73 | variant = variant,
74 | modifier = Modifier
75 | .padding(8.dp),
76 | ratings = ratings,
77 | reviews = reviews,
78 | coffeeType = coffeeType
79 | )
80 | }
81 | Image(
82 | painter = painterResource(id = imageResID),
83 | contentDescription = stringResource(id = R.string.description_coffee_image),
84 | contentScale = ContentScale.Crop,
85 | modifier = Modifier
86 | .clip(
87 | RoundedCornerShape(
88 | topStart = 24.dp,
89 | topEnd = 24.dp,
90 | bottomStart = 12.dp,
91 | bottomEnd = 12.dp
92 | )
93 | )
94 | .size(width = 400.dp, height = 460.dp)
95 | )
96 | }
97 | }
98 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeDetailsDisplayBottomRow.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.background
19 | import androidx.compose.foundation.layout.Arrangement
20 | import androidx.compose.foundation.layout.Box
21 | import androidx.compose.foundation.layout.Column
22 | import androidx.compose.foundation.layout.Row
23 | import androidx.compose.foundation.layout.fillMaxWidth
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.shape.RoundedCornerShape
27 | import androidx.compose.material3.Icon
28 | import androidx.compose.material3.MaterialTheme
29 | import androidx.compose.material3.Text
30 | import androidx.compose.runtime.Composable
31 | import androidx.compose.ui.Alignment
32 | import androidx.compose.ui.Modifier
33 | import androidx.compose.ui.draw.clip
34 | import androidx.compose.ui.res.painterResource
35 | import androidx.compose.ui.res.stringResource
36 | import androidx.compose.ui.unit.dp
37 | import androidx.compose.ui.unit.sp
38 | import architex.labs.coffeedrop.R
39 | import architex.labs.coffeedrop.presentation.theme.Accent
40 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
41 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
42 | import architex.labs.coffeedrop.presentation.theme.Neutrals400Transparent
43 |
44 | @Composable
45 | fun CoffeeDetailsDisplayBottomRow(
46 | modifier: Modifier = Modifier,
47 | titleResID: Int,
48 | variant: String,
49 | ratings: Double,
50 | reviews: Int,
51 | coffeeType: String
52 | ) {
53 | Row(
54 | verticalAlignment = Alignment.CenterVertically,
55 | horizontalArrangement = Arrangement.SpaceBetween,
56 | modifier = modifier
57 | .fillMaxWidth()
58 | .clip(RoundedCornerShape(12.dp))
59 | .background(Neutrals400Transparent)
60 | .padding(18.dp)
61 | ) {
62 | Column(
63 | verticalArrangement = Arrangement.spacedBy(8.dp)
64 | ) {
65 | Text(
66 | text = stringResource(id = titleResID),
67 | style = MaterialTheme.typography.bodyLarge,
68 | color = Neutrals100
69 | )
70 | Text(
71 | text = variant,
72 | style = MaterialTheme.typography.bodyMedium,
73 | color = Neutrals200
74 | )
75 | RatingDetails(
76 | ratings = ratings,
77 | reviews = reviews
78 | )
79 | }
80 | Column(
81 | verticalArrangement = Arrangement.spacedBy(8.dp),
82 | horizontalAlignment = Alignment.CenterHorizontally
83 | ) {
84 | Row(
85 | horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.Start),
86 | ) {
87 | Box(
88 | contentAlignment = Alignment.Center,
89 | modifier = modifier
90 | .clip(RoundedCornerShape(12.dp))
91 | .size(40.dp)
92 | .background(Neutrals100)
93 | ) {
94 | Icon(
95 | painter = painterResource(id = R.drawable.icon_coffee_cup),
96 | contentDescription = null,
97 | tint = Accent,
98 | modifier = Modifier.size(24.dp)
99 | )
100 | }
101 | Box(
102 | contentAlignment = Alignment.Center,
103 | modifier = modifier
104 | .clip(RoundedCornerShape(12.dp))
105 | .size(40.dp)
106 | .background(Neutrals100)
107 | ) {
108 | Icon(
109 | painter = painterResource(id = R.drawable.icon_milk_drop),
110 | contentDescription = null,
111 | tint = Accent,
112 | modifier = Modifier.size(24.dp)
113 | )
114 | }
115 | }
116 |
117 | Text(
118 | text = coffeeType,
119 | style = MaterialTheme.typography.titleMedium,
120 | color = Neutrals100,
121 | fontSize = 14.sp
122 | )
123 | }
124 | }
125 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeDetailsTopRow.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.Arrangement
19 | import androidx.compose.foundation.layout.Row
20 | import androidx.compose.foundation.layout.fillMaxWidth
21 | import androidx.compose.foundation.layout.size
22 | import androidx.compose.foundation.shape.RoundedCornerShape
23 | import androidx.compose.material.ripple.LocalRippleTheme
24 | import androidx.compose.material3.Icon
25 | import androidx.compose.material3.IconButton
26 | import androidx.compose.material3.IconButtonDefaults
27 | import androidx.compose.runtime.Composable
28 | import androidx.compose.runtime.CompositionLocalProvider
29 | import androidx.compose.ui.Alignment
30 | import androidx.compose.ui.Modifier
31 | import androidx.compose.ui.draw.clip
32 | import androidx.compose.ui.res.painterResource
33 | import androidx.compose.ui.res.stringResource
34 | import androidx.compose.ui.unit.dp
35 | import architex.labs.coffeedrop.R
36 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
37 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
38 | import architex.labs.coffeedrop.presentation.theme.Neutrals400Transparent
39 | import architex.labs.coffeedrop.presentation.utils.CustomRippleTheme
40 |
41 | @Composable
42 | fun CoffeeDetailsTopRow(
43 | modifier: Modifier = Modifier,
44 | icons: Pair,
45 | onBackButtonClicked: () -> Unit
46 | ) {
47 | Row(
48 | modifier = modifier.fillMaxWidth(),
49 | verticalAlignment = Alignment.CenterVertically,
50 | horizontalArrangement = Arrangement.SpaceBetween
51 | ) {
52 | CompositionLocalProvider(LocalRippleTheme provides CustomRippleTheme) {
53 | IconButton(
54 | onClick = onBackButtonClicked,
55 | colors = IconButtonDefaults.iconButtonColors(
56 | containerColor = Neutrals400Transparent,
57 | contentColor = Neutrals100
58 | ),
59 | modifier = Modifier
60 | .clip(RoundedCornerShape(16.dp))
61 | .size(48.dp),
62 | content = {
63 | Icon(
64 | painter = painterResource(id = icons.first),
65 | contentDescription = stringResource(id = R.string.description_back_btn),
66 | modifier = Modifier.size(24.dp)
67 | )
68 | }
69 | )
70 |
71 | IconButton(
72 | onClick = { /*TODO*/ },
73 | colors = IconButtonDefaults.iconButtonColors(
74 | containerColor = Neutrals400Transparent,
75 | contentColor = Neutrals200
76 | ),
77 | modifier = Modifier
78 | .clip(RoundedCornerShape(16.dp))
79 | .size(48.dp),
80 | content = {
81 | Icon(
82 | painter = painterResource(id = icons.second),
83 | contentDescription = stringResource(id = R.string.description_heart_btn),
84 | modifier = Modifier.size(24.dp)
85 | )
86 | }
87 | )
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeFilterBar.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.fillMaxWidth
19 | import androidx.compose.foundation.lazy.LazyRow
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.ui.Modifier
22 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeType
23 |
24 | @Composable
25 | fun CoffeeFilterBar(
26 | modifier: Modifier = Modifier,
27 | activeOption: CoffeeType,
28 | filterOptions: List,
29 | updateSelectedCoffeeType: (CoffeeType) -> Unit
30 | ) {
31 |
32 | LazyRow(
33 | modifier = modifier.fillMaxWidth()
34 | ) {
35 | item {
36 | for (filterOption in filterOptions) {
37 | CoffeeFilterOption(
38 | filterOption = filterOption,
39 | isActiveOption = filterOption.type == activeOption.type,
40 | updateSelectedCoffeeType = { updateSelectedCoffeeType(filterOption) }
41 | )
42 | }
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/CoffeeFilterOption.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.background
19 | import androidx.compose.foundation.layout.Box
20 | import androidx.compose.foundation.layout.Column
21 | import androidx.compose.foundation.layout.padding
22 | import androidx.compose.foundation.layout.size
23 | import androidx.compose.foundation.shape.RoundedCornerShape
24 | import androidx.compose.material3.MaterialTheme
25 | import androidx.compose.material3.Text
26 | import androidx.compose.runtime.Composable
27 | import androidx.compose.ui.Modifier
28 | import androidx.compose.ui.draw.clip
29 | import androidx.compose.ui.unit.dp
30 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeType
31 | import architex.labs.coffeedrop.presentation.theme.CircularStd
32 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
33 | import architex.labs.coffeedrop.presentation.theme.Primary
34 | import architex.labs.coffeedrop.presentation.utils.clickableNoRipple
35 |
36 | @Composable
37 | fun CoffeeFilterOption(
38 | modifier: Modifier = Modifier,
39 | filterOption: CoffeeType,
40 | isActiveOption: Boolean,
41 | updateSelectedCoffeeType: () -> Unit
42 | ) {
43 |
44 | Column(
45 | modifier = modifier
46 | .padding(horizontal = 12.dp)
47 | .clickableNoRipple(
48 | onClick = updateSelectedCoffeeType
49 | )
50 | ) {
51 | Text(
52 | text = filterOption.type,
53 | color = if (isActiveOption) Primary else Neutrals200,
54 | modifier = Modifier.padding(bottom = 6.dp),
55 | style = MaterialTheme.typography.bodyLarge,
56 | fontFamily = CircularStd
57 | )
58 |
59 | Box(
60 | modifier = Modifier
61 | .size(width = if (isActiveOption) 40.dp else 0.dp, height = 4.dp)
62 | .clip(RoundedCornerShape(2.dp))
63 | .background(Primary)
64 | )
65 | }
66 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/RatingBadge.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.background
19 | import androidx.compose.foundation.layout.Arrangement
20 | import androidx.compose.foundation.layout.Box
21 | import androidx.compose.foundation.layout.Row
22 | import androidx.compose.foundation.layout.padding
23 | import androidx.compose.foundation.layout.size
24 | import androidx.compose.foundation.shape.RoundedCornerShape
25 | import androidx.compose.material3.Icon
26 | import androidx.compose.material3.MaterialTheme
27 | import androidx.compose.material3.Text
28 | import androidx.compose.runtime.Composable
29 | import androidx.compose.ui.Alignment
30 | import androidx.compose.ui.Modifier
31 | import androidx.compose.ui.draw.clip
32 | import androidx.compose.ui.res.painterResource
33 | import androidx.compose.ui.res.stringResource
34 | import androidx.compose.ui.unit.dp
35 | import androidx.compose.ui.zIndex
36 | import architex.labs.coffeedrop.R
37 | import architex.labs.coffeedrop.presentation.theme.Neutrals400Transparent
38 | import architex.labs.coffeedrop.presentation.theme.Primary
39 |
40 | @Composable
41 | fun RatingBadge(
42 | modifier: Modifier = Modifier,
43 | rating: Double
44 | ) {
45 | Box(
46 | modifier = modifier
47 | .clip(
48 | RoundedCornerShape(
49 | topEnd = 12.dp,
50 | bottomStart = 12.dp,
51 | )
52 | )
53 | .background(Neutrals400Transparent)
54 | .zIndex(99f)
55 | ) {
56 | Row(
57 | horizontalArrangement = Arrangement.spacedBy(4.dp),
58 | verticalAlignment = Alignment.CenterVertically,
59 | modifier = Modifier
60 | .padding(horizontal = 8.dp, vertical = 4.dp)
61 | ) {
62 | Icon(
63 | painter = painterResource(id = R.drawable.icon_star),
64 | contentDescription = stringResource(id = R.string.description_rating),
65 | tint = Primary,
66 | modifier = Modifier.size(14.dp)
67 | )
68 | Text(
69 | text = rating.toString(),
70 | style = MaterialTheme.typography.titleSmall
71 | )
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/RatingsDetail.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.Arrangement
19 | import androidx.compose.foundation.layout.Row
20 | import androidx.compose.foundation.layout.size
21 | import androidx.compose.material3.Icon
22 | import androidx.compose.material3.MaterialTheme
23 | import androidx.compose.material3.Text
24 | import androidx.compose.runtime.Composable
25 | import androidx.compose.ui.Alignment
26 | import androidx.compose.ui.Modifier
27 | import androidx.compose.ui.res.painterResource
28 | import androidx.compose.ui.res.stringResource
29 | import androidx.compose.ui.unit.dp
30 | import architex.labs.coffeedrop.R
31 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
32 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
33 | import architex.labs.coffeedrop.presentation.theme.Primary
34 | import java.text.NumberFormat
35 |
36 | @Composable
37 | fun RatingDetails(
38 | modifier: Modifier = Modifier,
39 | ratings: Double,
40 | reviews: Int
41 | ) {
42 | Row(
43 | horizontalArrangement = Arrangement.spacedBy(8.dp),
44 | verticalAlignment = Alignment.CenterVertically
45 | ) {
46 | Row(
47 | horizontalArrangement = Arrangement.spacedBy(4.dp),
48 | verticalAlignment = Alignment.CenterVertically
49 | ) {
50 | Icon(
51 | painter = painterResource(id = R.drawable.icon_star),
52 | contentDescription = stringResource(id = R.string.description_rating),
53 | modifier = modifier.size(14.dp),
54 | tint = Primary
55 | )
56 | Text(
57 | text = ratings.toString(),
58 | style = MaterialTheme.typography.titleSmall,
59 | color = Neutrals100
60 | )
61 | }
62 | Text(
63 | text = stringResource(id = R.string.reviews, NumberFormat.getNumberInstance().format(reviews)),
64 | style = MaterialTheme.typography.titleSmall,
65 | color = Neutrals200
66 | )
67 | }
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/SearchBar.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.layout.fillMaxWidth
19 | import androidx.compose.foundation.layout.padding
20 | import androidx.compose.foundation.layout.size
21 | import androidx.compose.foundation.shape.RoundedCornerShape
22 | import androidx.compose.foundation.text.KeyboardActions
23 | import androidx.compose.foundation.text.KeyboardOptions
24 | import androidx.compose.material3.ExperimentalMaterial3Api
25 | import androidx.compose.material3.Icon
26 | import androidx.compose.material3.MaterialTheme
27 | import androidx.compose.material3.OutlinedTextField
28 | import androidx.compose.material3.Text
29 | import androidx.compose.material3.TextFieldDefaults
30 | import androidx.compose.runtime.Composable
31 | import androidx.compose.runtime.getValue
32 | import androidx.compose.runtime.mutableStateOf
33 | import androidx.compose.runtime.remember
34 | import androidx.compose.runtime.setValue
35 | import androidx.compose.ui.Modifier
36 | import androidx.compose.ui.focus.FocusManager
37 | import androidx.compose.ui.focus.onFocusChanged
38 | import androidx.compose.ui.res.painterResource
39 | import androidx.compose.ui.res.stringResource
40 | import androidx.compose.ui.text.input.ImeAction
41 | import androidx.compose.ui.text.input.KeyboardType
42 | import androidx.compose.ui.unit.dp
43 | import architex.labs.coffeedrop.R
44 | import architex.labs.coffeedrop.presentation.theme.CircularStd
45 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
46 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
47 | import architex.labs.coffeedrop.presentation.theme.Neutrals300
48 | import architex.labs.coffeedrop.presentation.theme.Primary
49 | import architex.labs.coffeedrop.presentation.utils.clickableNoRipple
50 |
51 | @OptIn(ExperimentalMaterial3Api::class)
52 | @Composable
53 | fun SearchBar(
54 | modifier: Modifier = Modifier,
55 | focusManager: FocusManager,
56 | searchValue: String,
57 | onSearchValueChange: (String) -> Unit,
58 | clearSearchString: () -> Unit
59 | ) {
60 | var isFocused by remember { mutableStateOf(false) }
61 |
62 | OutlinedTextField(
63 | value = searchValue,
64 | onValueChange = onSearchValueChange,
65 | singleLine = true,
66 | maxLines = 1,
67 | shape = RoundedCornerShape(16.dp),
68 | modifier = modifier
69 | .fillMaxWidth()
70 | .padding(16.dp)
71 | .onFocusChanged { isFocused = it.isFocused },
72 | placeholder = {
73 | Text(
74 | text = stringResource(id = R.string.search_bar_placeholder),
75 | style = MaterialTheme.typography.bodyLarge,
76 | fontFamily = CircularStd,
77 | color = Neutrals200
78 | )
79 | },
80 | leadingIcon = {
81 | Icon(
82 | painter = painterResource(id = R.drawable.icon_search),
83 | contentDescription = stringResource(id = R.string.description_search),
84 | modifier = Modifier.size(24.dp)
85 | )
86 | },
87 | trailingIcon = {
88 | if (isFocused && searchValue.isNotEmpty()) {
89 | Icon(
90 | painter = painterResource(id = R.drawable.icon_clear),
91 | contentDescription = stringResource(id = R.string.description_clear),
92 | modifier = Modifier
93 | .size(24.dp)
94 | .clickableNoRipple(
95 | onClick = clearSearchString
96 | )
97 | )
98 | }
99 | },
100 | colors = TextFieldDefaults.outlinedTextFieldColors(
101 | containerColor = Neutrals300,
102 | focusedLeadingIconColor = Primary,
103 | unfocusedLeadingIconColor = Neutrals100,
104 | focusedBorderColor = Neutrals300,
105 | unfocusedBorderColor = Neutrals300,
106 | focusedTrailingIconColor = Neutrals200,
107 | textColor = Neutrals100
108 | ),
109 | keyboardOptions = KeyboardOptions.Default.copy(
110 | keyboardType = KeyboardType.Text,
111 | imeAction = ImeAction.Go
112 | ),
113 | keyboardActions = KeyboardActions(
114 | onGo = {
115 | focusManager.clearFocus()
116 | }
117 | )
118 | )
119 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/SizeDisplay.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.background
19 | import androidx.compose.foundation.border
20 | import androidx.compose.foundation.layout.Box
21 | import androidx.compose.foundation.layout.padding
22 | import androidx.compose.foundation.shape.RoundedCornerShape
23 | import androidx.compose.material3.MaterialTheme
24 | import androidx.compose.material3.Text
25 | import androidx.compose.runtime.Composable
26 | import androidx.compose.ui.Alignment
27 | import androidx.compose.ui.Modifier
28 | import androidx.compose.ui.draw.clip
29 | import androidx.compose.ui.unit.dp
30 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeSize
31 | import architex.labs.coffeedrop.presentation.theme.Accent
32 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
33 | import architex.labs.coffeedrop.presentation.theme.Neutrals300
34 | import architex.labs.coffeedrop.presentation.theme.Primary
35 | import architex.labs.coffeedrop.presentation.utils.clickableNoRipple
36 |
37 | @Composable
38 | fun SizeDisplay(
39 | modifier: Modifier = Modifier,
40 | size: CoffeeSize,
41 | isSelected: Boolean,
42 | count: Int,
43 | setCoffeeSize: () -> Unit
44 | ) {
45 | Box(
46 | contentAlignment = Alignment.Center,
47 | modifier = modifier
48 | .border(
49 | width = 1.dp,
50 | color = if (isSelected) Primary else Neutrals300,
51 | shape = when (count) {
52 | 1 -> RoundedCornerShape(
53 | topStart = 8.dp,
54 | topEnd = 4.dp,
55 | bottomStart = 8.dp,
56 | bottomEnd = 4.dp
57 | )
58 | 2 -> RoundedCornerShape(4.dp)
59 | else -> RoundedCornerShape(
60 | topStart = 4.dp,
61 | topEnd = 8.dp,
62 | bottomStart = 4.dp,
63 | bottomEnd = 8.dp
64 | )
65 | }
66 | )
67 | .clip(
68 | shape = when (count) {
69 | 1 -> RoundedCornerShape(
70 | topStart = 8.dp,
71 | topEnd = 4.dp,
72 | bottomStart = 8.dp,
73 | bottomEnd = 4.dp
74 | )
75 | 2 -> RoundedCornerShape(4.dp)
76 | else -> RoundedCornerShape(
77 | topStart = 4.dp,
78 | topEnd = 8.dp,
79 | bottomStart = 4.dp,
80 | bottomEnd = 8.dp
81 | )
82 | }
83 | )
84 | .background(if (isSelected) Accent else Neutrals300)
85 | .clickableNoRipple(
86 | onClick = setCoffeeSize
87 | )
88 | ) {
89 | Text(
90 | text = size.size,
91 | style = MaterialTheme.typography.titleMedium,
92 | color = if (isSelected) Primary else Neutrals200,
93 | modifier = modifier.padding(16.dp)
94 | )
95 | }
96 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/components/SpecialForYouCard.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.components
17 |
18 | import androidx.compose.foundation.Image
19 | import androidx.compose.foundation.background
20 | import androidx.compose.foundation.layout.Arrangement
21 | import androidx.compose.foundation.layout.Column
22 | import androidx.compose.foundation.layout.Row
23 | import androidx.compose.foundation.layout.fillMaxWidth
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.shape.RoundedCornerShape
27 | import androidx.compose.material3.MaterialTheme
28 | import androidx.compose.material3.Text
29 | import androidx.compose.runtime.Composable
30 | import androidx.compose.ui.Alignment
31 | import androidx.compose.ui.Modifier
32 | import androidx.compose.ui.draw.clip
33 | import androidx.compose.ui.layout.ContentScale
34 | import androidx.compose.ui.res.painterResource
35 | import androidx.compose.ui.res.stringResource
36 | import androidx.compose.ui.unit.dp
37 | import architex.labs.coffeedrop.R
38 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
39 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
40 | import architex.labs.coffeedrop.presentation.theme.Neutrals300
41 |
42 | @Composable
43 | fun SpecialForYouCard(
44 | modifier: Modifier = Modifier,
45 | imageResID: Int
46 | ) {
47 | Row(
48 | modifier = modifier
49 | .fillMaxWidth()
50 | .clip(RoundedCornerShape(16.dp))
51 | .background(Neutrals300)
52 | ) {
53 | Row(
54 | modifier = Modifier
55 | .fillMaxWidth()
56 | .padding(12.dp),
57 | horizontalArrangement = Arrangement.spacedBy(12.dp),
58 | verticalAlignment = Alignment.CenterVertically
59 | ) {
60 | Image(
61 | painter = painterResource(id = imageResID),
62 | contentDescription = stringResource(id = R.string.description_for_you_image),
63 | contentScale = ContentScale.Crop,
64 | modifier = Modifier
65 | .size(96.dp)
66 | .clip(RoundedCornerShape(12.dp))
67 | )
68 |
69 | Column(
70 | verticalArrangement = Arrangement.spacedBy(6.dp)
71 | ) {
72 | Text(
73 | text = stringResource(id = R.string.five_coffee_beans_to_try),
74 | style = MaterialTheme.typography.bodyLarge,
75 | color = Neutrals100
76 | )
77 | Text(
78 | text = stringResource(id = R.string.special_for_you_headline),
79 | style = MaterialTheme.typography.bodyMedium,
80 | color = Neutrals200
81 | )
82 | }
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/screens/CoffeeDetailsScreen.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.screens
17 |
18 | import androidx.compose.foundation.background
19 | import androidx.compose.foundation.layout.Arrangement
20 | import androidx.compose.foundation.layout.BoxWithConstraints
21 | import androidx.compose.foundation.layout.Column
22 | import androidx.compose.foundation.layout.Row
23 | import androidx.compose.foundation.layout.fillMaxWidth
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.lazy.LazyColumn
26 | import androidx.compose.material3.ExperimentalMaterial3Api
27 | import androidx.compose.material3.MaterialTheme
28 | import androidx.compose.material3.Scaffold
29 | import androidx.compose.material3.Text
30 | import androidx.compose.runtime.Composable
31 | import androidx.compose.ui.Modifier
32 | import androidx.compose.ui.res.stringResource
33 | import androidx.compose.ui.text.style.TextOverflow
34 | import androidx.compose.ui.unit.dp
35 | import architex.labs.coffeedrop.R
36 | import architex.labs.coffeedrop.presentation.components.CoffeeDetailsBottomRow
37 | import architex.labs.coffeedrop.presentation.components.CoffeeDetailsDisplay
38 | import architex.labs.coffeedrop.presentation.components.SizeDisplay
39 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
40 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
41 | import architex.labs.coffeedrop.presentation.theme.Neutrals400
42 | import architex.labs.coffeedrop.presentation.theme.Primary
43 | import architex.labs.coffeedrop.presentation.utils.clickableNoRipple
44 | import architex.labs.coffeedrop.presentation.viewmodels.CoffeeDetailsScreenViewModel
45 |
46 | @OptIn(ExperimentalMaterial3Api::class)
47 | @Composable
48 | fun CoffeeDetailsScreen(
49 | modifier: Modifier = Modifier,
50 | viewModel: CoffeeDetailsScreenViewModel,
51 | onBackButtonClicked: () -> Unit
52 | ) {
53 | val selectedCoffee = viewModel.selectedCoffee!!
54 |
55 | Scaffold(
56 | modifier = modifier.background(Neutrals400),
57 | content = {contentPadding ->
58 | LazyColumn(modifier = Modifier.padding(contentPadding)) {
59 | item {
60 | BoxWithConstraints {
61 | if (maxWidth < 600.dp) {
62 | selectedCoffee.run {
63 | Column(
64 | verticalArrangement = Arrangement.spacedBy(16.dp)
65 | ) {
66 | CoffeeDetailsDisplay(
67 | imageResID = imageResID,
68 | titleRedID = name,
69 | variant = variant,
70 | ratings = rating,
71 | reviews = reviews,
72 | coffeeType = roastingLevel.roastingLevel,
73 | onBackButtonClicked = onBackButtonClicked
74 | )
75 |
76 | Column(
77 | verticalArrangement = Arrangement.spacedBy(8.dp),
78 | modifier = Modifier.padding(horizontal = 12.dp)
79 | ) {
80 | Text(
81 | text = stringResource(id = R.string.description),
82 | style = MaterialTheme.typography.displayMedium,
83 | color = Neutrals100
84 | )
85 |
86 | Column(
87 | modifier = Modifier.fillMaxWidth(),
88 | verticalArrangement = Arrangement.spacedBy(2.dp)
89 | ) {
90 | Text(
91 | text = stringResource(id = description),
92 | style = MaterialTheme.typography.bodyMedium,
93 | color = Neutrals200,
94 | maxLines = if (viewModel.isDescriptionExpanded) 30 else 2,
95 | overflow = TextOverflow.Ellipsis
96 | )
97 | Text(
98 | text = if (viewModel.isDescriptionExpanded)
99 | stringResource(id = R.string.read_less)
100 | else
101 | stringResource(id = R.string.read_more),
102 | style = MaterialTheme.typography.bodyMedium,
103 | color = Primary,
104 | modifier = Modifier.clickableNoRipple { viewModel.toggleIsDescriptionExpanded() }
105 | )
106 | }
107 | }
108 |
109 | Column(
110 | verticalArrangement = Arrangement.spacedBy(12.dp),
111 | modifier = Modifier.padding(horizontal = 12.dp)
112 | ) {
113 | Text(
114 | text = stringResource(id = R.string.size),
115 | style = MaterialTheme.typography.bodyLarge,
116 | color = Neutrals200
117 | )
118 |
119 | Row(
120 | modifier = Modifier.fillMaxWidth(),
121 | horizontalArrangement = Arrangement.spacedBy(8.dp)
122 | ) {
123 | for ((count, size) in coffeeSize.withIndex()) {
124 | SizeDisplay(
125 | size = size,
126 | isSelected = if (viewModel.selectedCoffeeSize == null)
127 | count == 0
128 | else
129 | viewModel.selectedCoffeeSize!!.size == size.size,
130 | modifier = Modifier.weight(1f / 3f),
131 | count = count+1,
132 | setCoffeeSize = { viewModel.selectCoffeeSize(size) }
133 | )
134 | }
135 | }
136 | }
137 |
138 | Column(
139 | modifier = Modifier.padding(
140 | top = 32.dp,
141 | start = 12.dp,
142 | end = 12.dp
143 | )
144 | ) {
145 | CoffeeDetailsBottomRow(price = price)
146 | }
147 | }
148 | }
149 | } else {
150 | selectedCoffee.run {
151 | Row(
152 | horizontalArrangement = Arrangement.spacedBy(16.dp)
153 | ) {
154 | Column(
155 | modifier.weight(1f / 2f)
156 | ) {
157 | CoffeeDetailsDisplay(
158 | imageResID = imageResID,
159 | titleRedID = name,
160 | variant = variant,
161 | ratings = rating,
162 | reviews = reviews,
163 | coffeeType = roastingLevel.roastingLevel,
164 | onBackButtonClicked = onBackButtonClicked
165 | )
166 | }
167 |
168 | Column(
169 | modifier = Modifier.weight(1f / 2f),
170 | verticalArrangement = Arrangement.spacedBy(16.dp)
171 | ) {
172 | Column(
173 | verticalArrangement = Arrangement.spacedBy(8.dp),
174 | modifier = Modifier.padding(horizontal = 12.dp)
175 | ) {
176 | Text(
177 | text = stringResource(id = R.string.description),
178 | style = MaterialTheme.typography.displayMedium,
179 | color = Neutrals100
180 | )
181 |
182 | Column(
183 | modifier = Modifier.fillMaxWidth(),
184 | verticalArrangement = Arrangement.spacedBy(2.dp)
185 | ) {
186 | Text(
187 | text = stringResource(id = description),
188 | style = MaterialTheme.typography.bodyMedium,
189 | color = Neutrals200,
190 | maxLines = if (viewModel.isDescriptionExpanded) 30 else 2,
191 | overflow = TextOverflow.Ellipsis
192 | )
193 | Text(
194 | text = if (viewModel.isDescriptionExpanded)
195 | stringResource(id = R.string.read_less)
196 | else
197 | stringResource(id = R.string.read_more),
198 | style = MaterialTheme.typography.bodyMedium,
199 | color = Primary,
200 | modifier = Modifier.clickableNoRipple { viewModel.toggleIsDescriptionExpanded() }
201 | )
202 | }
203 | }
204 |
205 | Column(
206 | verticalArrangement = Arrangement.spacedBy(12.dp),
207 | modifier = Modifier.padding(horizontal = 12.dp)
208 | ) {
209 | Text(
210 | text = stringResource(id = R.string.size),
211 | style = MaterialTheme.typography.bodyLarge,
212 | color = Neutrals200
213 | )
214 |
215 | Row(
216 | modifier = Modifier.fillMaxWidth(),
217 | horizontalArrangement = Arrangement.spacedBy(8.dp)
218 | ) {
219 | for ((count, size) in coffeeSize.withIndex()) {
220 | SizeDisplay(
221 | size = size,
222 | isSelected = if (viewModel.selectedCoffeeSize == null)
223 | count == 0
224 | else
225 | viewModel.selectedCoffeeSize!!.size == size.size,
226 | modifier = Modifier.weight(1f / 3f),
227 | count = count+1,
228 | setCoffeeSize = { viewModel.selectCoffeeSize(size) }
229 | )
230 | }
231 | }
232 | }
233 |
234 | CoffeeDetailsBottomRow(
235 | modifier = Modifier.padding(
236 | top = 16.dp,
237 | start = 12.dp,
238 | end = 12.dp
239 | ),
240 | price = price
241 | )
242 | }
243 | }
244 | }
245 | }
246 | }
247 | }
248 | }
249 | }
250 | )
251 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/screens/HomeScreen.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.screens
17 |
18 | import androidx.compose.animation.core.tween
19 | import androidx.compose.foundation.ExperimentalFoundationApi
20 | import androidx.compose.foundation.background
21 | import androidx.compose.foundation.layout.Arrangement
22 | import androidx.compose.foundation.layout.Column
23 | import androidx.compose.foundation.layout.fillMaxWidth
24 | import androidx.compose.foundation.layout.padding
25 | import androidx.compose.foundation.layout.size
26 | import androidx.compose.foundation.lazy.LazyColumn
27 | import androidx.compose.foundation.lazy.LazyRow
28 | import androidx.compose.foundation.lazy.items
29 | import androidx.compose.material3.ExperimentalMaterial3Api
30 | import androidx.compose.material3.Icon
31 | import androidx.compose.material3.MaterialTheme
32 | import androidx.compose.material3.Scaffold
33 | import androidx.compose.material3.Text
34 | import androidx.compose.runtime.Composable
35 | import androidx.compose.ui.Alignment
36 | import androidx.compose.ui.Modifier
37 | import androidx.compose.ui.platform.LocalFocusManager
38 | import androidx.compose.ui.res.painterResource
39 | import androidx.compose.ui.res.stringResource
40 | import androidx.compose.ui.unit.dp
41 | import architex.labs.coffeedrop.R
42 | import architex.labs.coffeedrop.presentation.components.AppBar
43 | import architex.labs.coffeedrop.presentation.components.BottomNavBar
44 | import architex.labs.coffeedrop.presentation.components.CoffeeCard
45 | import architex.labs.coffeedrop.presentation.components.CoffeeFilterBar
46 | import architex.labs.coffeedrop.presentation.components.SearchBar
47 | import architex.labs.coffeedrop.presentation.components.SpecialForYouCard
48 | import architex.labs.coffeedrop.presentation.theme.Neutrals100
49 | import architex.labs.coffeedrop.presentation.theme.Neutrals200
50 | import architex.labs.coffeedrop.presentation.theme.Neutrals400
51 | import architex.labs.coffeedrop.presentation.viewmodels.HomeScreenViewModel
52 |
53 | @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
54 | @Composable
55 | fun HomeScreen(
56 | modifier: Modifier = Modifier,
57 | viewModel: HomeScreenViewModel,
58 | onCoffeeDetailScreenClicked: () -> Unit
59 | ) {
60 | val focusManager = LocalFocusManager.current
61 |
62 | Scaffold(
63 | modifier = modifier.background(Neutrals400),
64 | topBar = {
65 | AppBar(modifier = Modifier.padding(16.dp))
66 | },
67 | bottomBar = {
68 | BottomNavBar(
69 | currentScreen = viewModel.currentScreen,
70 | changeCurrentScreen = { viewModel.changeCurrentScreen(it) }
71 | )
72 | },
73 | content = { contentPadding ->
74 | LazyColumn(modifier = Modifier.padding(contentPadding)) {
75 | item {
76 | Column(
77 | modifier = Modifier.padding(16.dp)
78 | ) {
79 | Text(
80 | text = stringResource(id = R.string.headline_1),
81 | style = MaterialTheme.typography.displayMedium,
82 | color = Neutrals200
83 | )
84 | Text(
85 | text = stringResource(id = R.string.headline_2),
86 | style = MaterialTheme.typography.displayLarge,
87 | color = Neutrals100
88 | )
89 | }
90 |
91 | SearchBar(
92 | focusManager = focusManager,
93 | searchValue = viewModel.searchString,
94 | onSearchValueChange = { viewModel.updateSearchString(it) },
95 | clearSearchString = { viewModel.clearSearchString() }
96 | )
97 | }
98 |
99 | item {
100 | CoffeeFilterBar(
101 | modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),
102 | activeOption = viewModel.selectedCoffeeType,
103 | filterOptions = viewModel.coffeeTypeList,
104 | updateSelectedCoffeeType = { viewModel.updateSelectedCoffeeType(it) }
105 | )
106 | }
107 |
108 | item {
109 | LazyRow(
110 | modifier = Modifier
111 | .padding(horizontal = 12.dp, vertical = 12.dp)
112 | .animateItemPlacement(tween(durationMillis = 250)),
113 | horizontalArrangement = Arrangement.spacedBy(12.dp)
114 | ) {
115 | items(viewModel.filteredCoffeeList, key = { it.id }) { coffee ->
116 | CoffeeCard(
117 | coffee = coffee,
118 | onCoffeeDetailsButtonClicked = {
119 | viewModel.setSelectedCoffee(it)
120 | onCoffeeDetailScreenClicked()
121 | }
122 | )
123 | }
124 | }
125 | }
126 |
127 | if (viewModel.filteredCoffeeList.isEmpty()) {
128 | item {
129 | Column(
130 | verticalArrangement = Arrangement.spacedBy(12.dp),
131 | horizontalAlignment = Alignment.CenterHorizontally,
132 | modifier = Modifier
133 | .fillMaxWidth()
134 | .padding(horizontal = 12.dp, vertical = 32.dp)
135 | ) {
136 | Icon(
137 | painter = painterResource(id = R.drawable.icon_search_filter),
138 | contentDescription = stringResource(id = R.string.description_no_matches),
139 | modifier = Modifier.size(80.dp)
140 | )
141 | Text(
142 | text = stringResource(id = R.string.no_matching_results),
143 | style = MaterialTheme.typography.bodyLarge,
144 | color = Neutrals200
145 | )
146 | }
147 | }
148 | }
149 |
150 | item {
151 | Column(
152 | modifier = Modifier.padding(
153 | top = 12.dp,
154 | start = 12.dp,
155 | end = 12.dp
156 | ),
157 | verticalArrangement = Arrangement.spacedBy(16.dp)
158 | ) {
159 | Text(
160 | text = stringResource(id = R.string.special_for_you),
161 | style = MaterialTheme.typography.displayMedium,
162 | color = Neutrals100
163 | )
164 | SpecialForYouCard(imageResID = R.drawable.image_17)
165 | }
166 | }
167 | }
168 | }
169 | )
170 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/theme/Color.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.theme
17 |
18 | import androidx.compose.ui.graphics.Color
19 |
20 | /** [NEUTRALS] */
21 | val Neutrals400 = Color(0xFF090C11)
22 | val Neutrals400Transparent = Color(0xAA090C11)
23 | val Neutrals300 = Color(0xFF131820)
24 | val Neutrals200 = Color(0xFF9BA6B3)
25 | val Neutrals100 = Color(0xFFF6F6F7)
26 |
27 | /** [PRIMARY & ACCENT] */
28 | val Primary = Color(0xFFED8B60)
29 | val Accent = Color(0xFF462518)
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/theme/Theme.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.theme
17 |
18 | import android.app.Activity
19 | import androidx.compose.material3.MaterialTheme
20 | import androidx.compose.material3.darkColorScheme
21 | import androidx.compose.runtime.Composable
22 | import androidx.compose.runtime.SideEffect
23 | import androidx.compose.ui.graphics.toArgb
24 | import androidx.compose.ui.platform.LocalView
25 | import androidx.core.view.WindowCompat
26 |
27 | private val AppColorScheme = darkColorScheme(
28 | primary = Primary,
29 | secondary = Accent,
30 | background = Neutrals400
31 | )
32 |
33 | @Composable
34 | fun CoffeeDropTheme(
35 | content: @Composable () -> Unit
36 | ) {
37 | val colorScheme = AppColorScheme
38 | val view = LocalView.current
39 | if (!view.isInEditMode) {
40 | SideEffect {
41 | val window = (view.context as Activity).window
42 | window.statusBarColor = colorScheme.background.toArgb()
43 | window.navigationBarColor = colorScheme.background.toArgb()
44 | WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = false
45 | }
46 | }
47 |
48 | MaterialTheme(
49 | colorScheme = colorScheme,
50 | typography = Typography,
51 | content = content
52 | )
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/theme/Type.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.theme
17 |
18 | import androidx.compose.material3.Typography
19 | import androidx.compose.ui.text.TextStyle
20 | import androidx.compose.ui.text.font.Font
21 | import androidx.compose.ui.text.font.FontFamily
22 | import androidx.compose.ui.text.font.FontWeight
23 | import androidx.compose.ui.unit.sp
24 | import architex.labs.coffeedrop.R
25 |
26 | val CircularStd = FontFamily(
27 | Font(
28 | resId = R.font.circular_std_book,
29 | weight = FontWeight.Normal
30 | ),
31 |
32 | Font(
33 | resId = R.font.circular_std_bold,
34 | weight = FontWeight.Bold
35 | )
36 | )
37 |
38 | val Typography = Typography(
39 | displayLarge = TextStyle(
40 | fontFamily = CircularStd,
41 | fontWeight = FontWeight.Bold,
42 | fontSize = 32.sp,
43 | lineHeight = 40.sp
44 | ),
45 |
46 | displayMedium = TextStyle(
47 | fontFamily = CircularStd,
48 | fontWeight = FontWeight.Bold,
49 | fontSize = 24.sp,
50 | lineHeight = 30.sp
51 | ),
52 |
53 | bodyLarge = TextStyle(
54 | fontFamily = CircularStd,
55 | fontWeight = FontWeight.Bold,
56 | fontSize = 18.sp,
57 | lineHeight = 23.sp
58 | ),
59 |
60 | bodyMedium = TextStyle(
61 | fontFamily = CircularStd,
62 | fontWeight = FontWeight.Normal,
63 | fontSize = 16.sp,
64 | lineHeight = 20.sp
65 | ),
66 |
67 | labelMedium = TextStyle(
68 | fontFamily = CircularStd,
69 | fontWeight = FontWeight.Normal,
70 | fontSize = 18.sp,
71 | lineHeight = 23.sp
72 | ),
73 |
74 | titleMedium = TextStyle(
75 | fontFamily = CircularStd,
76 | fontWeight = FontWeight.Bold,
77 | fontSize = 16.sp,
78 | lineHeight = 20.sp
79 | ),
80 |
81 | titleSmall = TextStyle(
82 | fontFamily = CircularStd,
83 | fontWeight = FontWeight.Bold,
84 | fontSize = 14.sp,
85 | lineHeight = 18.sp
86 | ),
87 |
88 | labelSmall = TextStyle(
89 | fontFamily = CircularStd,
90 | fontWeight = FontWeight.Normal,
91 | fontSize = 14.sp,
92 | lineHeight = 18.sp
93 | ),
94 | )
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/utils/BottomNavItem.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.utils
17 |
18 | import androidx.annotation.DrawableRes
19 |
20 | data class BottomNavItem(
21 | @DrawableRes val selectedIcon: Int,
22 | @DrawableRes val unselectedIcon: Int,
23 | val route: String
24 | )
25 |
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/utils/CustomRippleTheme.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.utils
17 |
18 | import androidx.compose.material.ripple.RippleAlpha
19 | import androidx.compose.material.ripple.RippleTheme
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.ui.graphics.Color
22 |
23 | object CustomRippleTheme : RippleTheme {
24 | @Composable
25 | override fun defaultColor(): Color = Color.Unspecified
26 | @Composable
27 | override fun rippleAlpha(): RippleAlpha = RippleAlpha(
28 | draggedAlpha = 0f,
29 | focusedAlpha = 0f,
30 | hoveredAlpha = 0f,
31 | pressedAlpha = 0f
32 | )
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/utils/NoRippleClickable.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.utils
17 |
18 | import androidx.compose.foundation.clickable
19 | import androidx.compose.foundation.interaction.MutableInteractionSource
20 | import androidx.compose.runtime.remember
21 | import androidx.compose.ui.Modifier
22 | import androidx.compose.ui.composed
23 | import androidx.compose.ui.semantics.Role
24 |
25 | // Extending Modifier to disable ripple effect
26 | fun Modifier.clickableNoRipple(
27 | enabled: Boolean = true,
28 | onClickLabel: String? = null,
29 | role: Role? = null,
30 | onClick: () -> Unit,
31 | ): Modifier = composed {
32 | this.clickable(
33 | interactionSource = remember { MutableInteractionSource() },
34 | indication = null,
35 | enabled = enabled,
36 | onClickLabel = onClickLabel,
37 | role = role,
38 | onClick = onClick
39 | )
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/viewmodels/CoffeeDetailsScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.viewmodels
17 |
18 | import androidx.compose.runtime.getValue
19 | import androidx.compose.runtime.mutableStateOf
20 | import androidx.compose.runtime.setValue
21 | import androidx.lifecycle.ViewModel
22 | import architex.labs.coffeedrop.domain.models.Coffee
23 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeSize
24 | import architex.labs.coffeedrop.domain.repository.CoffeeList
25 | import dagger.hilt.android.lifecycle.HiltViewModel
26 | import javax.inject.Inject
27 |
28 | @HiltViewModel
29 | class CoffeeDetailsScreenViewModel @Inject constructor (
30 | private val coffeeList: CoffeeList
31 | ): ViewModel() {
32 | private var selectedCoffeeID: Int? by mutableStateOf(null)
33 | var selectedCoffee: Coffee? by mutableStateOf(null)
34 | var isDescriptionExpanded: Boolean by mutableStateOf(false)
35 | var selectedCoffeeSize: CoffeeSize? by mutableStateOf(null)
36 |
37 | fun setCoffeeID(id: Int) {
38 | selectedCoffeeID = id
39 | selectedCoffee = coffeeList.list.find {
40 | it.id == selectedCoffeeID
41 | }
42 | }
43 |
44 | fun toggleIsDescriptionExpanded() {
45 | isDescriptionExpanded = !isDescriptionExpanded
46 | }
47 |
48 |
49 | fun selectCoffeeSize(newSize: CoffeeSize) {
50 | selectedCoffeeSize = newSize
51 | }
52 | }
--------------------------------------------------------------------------------
/app/src/main/java/architex/labs/coffeedrop/presentation/viewmodels/HomeScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) [2023 - Present] - Xero
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package architex.labs.coffeedrop.presentation.viewmodels
17 |
18 | import androidx.compose.runtime.getValue
19 | import androidx.compose.runtime.mutableStateOf
20 | import androidx.compose.runtime.setValue
21 | import androidx.lifecycle.ViewModel
22 | import architex.labs.coffeedrop.domain.models.sub_models.CoffeeType
23 | import architex.labs.coffeedrop.domain.repository.CoffeeList
24 | import dagger.hilt.android.lifecycle.HiltViewModel
25 | import javax.inject.Inject
26 |
27 | @HiltViewModel
28 | class HomeScreenViewModel @Inject constructor (
29 | private val coffeeList: CoffeeList
30 | ): ViewModel() {
31 | var selectedCoffeeID: Int? by mutableStateOf(null)
32 | var searchString: String by mutableStateOf("")
33 | var currentScreen by mutableStateOf("Home")
34 | var selectedCoffeeType: CoffeeType by mutableStateOf(CoffeeType.Cappuccino)
35 | val coffeeTypeList: List = listOf(
36 | CoffeeType.Cappuccino,
37 | CoffeeType.Cortado,
38 | CoffeeType.Espresso,
39 | CoffeeType.DoubleEspresso,
40 | CoffeeType.Latte,
41 | CoffeeType.Mocha
42 | )
43 |
44 | var filteredCoffeeList by mutableStateOf(
45 | coffeeList.list.filter {
46 | it.coffeeType.type == selectedCoffeeType.type
47 | }
48 | )
49 | private fun filterCoffeeList() {
50 | filteredCoffeeList = if (searchString.isNotBlank()) {
51 | coffeeList.list.filter {
52 | it.coffeeType.type == selectedCoffeeType.type &&
53 | it.variant.lowercase().contains(searchString.lowercase())
54 | }
55 | } else {
56 | coffeeList.list.filter {
57 | it.coffeeType.type == selectedCoffeeType.type
58 | }
59 | }
60 | }
61 |
62 | fun updateSearchString(newString: String) {
63 | searchString = newString
64 | filterCoffeeList()
65 | }
66 |
67 | fun clearSearchString() {
68 | searchString = ""
69 | filterCoffeeList()
70 | }
71 |
72 | fun updateSelectedCoffeeType(newCoffeeType: CoffeeType) {
73 | selectedCoffeeType = newCoffeeType
74 | filterCoffeeList()
75 | }
76 |
77 | fun changeCurrentScreen(newScreen: String) {
78 | currentScreen = newScreen
79 | }
80 |
81 | fun setSelectedCoffee(id: Int) {
82 | selectedCoffeeID = id
83 | }
84 |
85 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/avatar.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/branding_image.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
23 |
26 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
7 |
9 |
10 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
13 |
16 |
17 |
22 |
23 |
26 |
29 |
32 |
35 |
38 |
41 |
44 |
47 |
50 |
53 |
56 |
59 |
62 |
65 |
68 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_arrow_left.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_clear.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_coffee_cup.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
30 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_heart_filled.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_heart_outline.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_home_filled.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_home_outline.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
28 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_menu.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
30 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_milk_drop.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_notification_filled.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_notification_outline.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
27 |
33 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_plus.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
28 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_search_filter.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_shopping_bag_filled.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_shopping_bag_outline.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
28 |
35 |
42 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_star.xml:
--------------------------------------------------------------------------------
1 |
16 |
21 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_10.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_11.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_12.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_13.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_14.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_15.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_16.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_17.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_18.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_19.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_20.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_4.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_5.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_6.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_7.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_8.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/image_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/drawable/image_9.png
--------------------------------------------------------------------------------
/app/src/main/res/font/circular_std_bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/font/circular_std_bold.otf
--------------------------------------------------------------------------------
/app/src/main/res/font/circular_std_book.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/font/circular_std_book.otf
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v31/splash_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #090C11
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/splash_theme.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 | Coffee Drop
18 | \$
19 | %.2f
20 | (%s reviews)
21 |
22 | Menu Icon
23 | Avatar
24 | Search Icon
25 | Clear Icon
26 | Rating
27 | Add Button
28 | For You Image
29 | No Matches
30 | Coffee Image
31 | Back
32 | Favorite
33 |
34 | Find the best
35 | coffee for you
36 | Find your coffee…
37 | Special For You
38 | Five Coffee Beans You Have to Try
39 | The best that\'ll make you rediscover caffeine wonder
40 | No Coffee Matching this Filter
41 | Description
42 | read more
43 | read less
44 | Size
45 | Price
46 | Order Now
47 |
48 | Cappuccino
49 | Mocha
50 | Espresso
51 | Double Espresso
52 | Cortado
53 | Latte
54 |
55 |
56 | Cappuccino is a popular coffee beverage that originated in Italy. It consists of equal
57 | parts of espresso, steamed milk, and milk foam.\n\nThe drink is typically served in a small cup,
58 | and the espresso is first brewed and poured
59 | into the cup. Then, the steamed milk is added, followed by a layer of milk foam on top.
60 | The foam is often decorated with a sprinkle of cocoa powder or cinnamon.\n\nCappuccinos are known
61 | for their rich, creamy texture and bold coffee flavor.
62 | They are often enjoyed as a breakfast or mid-morning drink, but can be enjoyed anytime throughout
63 | the day.\n\nCappuccinos can be made with a variety of milk types, such as whole, skim, or soy milk,
64 | and can also be flavored with syrups or spices for added sweetness or flavor.
65 |
66 |
67 |
68 | Mocha, also known as a mochaccino, is a type of coffee beverage that combines espresso with chocolate.\n\nTo
69 | make a mocha, a shot of espresso is brewed and mixed with chocolate syrup or melted chocolate. Steamed
70 | milk is then added, along with a layer of milk foam on top. The drink is often finished with a sprinkle of
71 | cocoa powder or shaved chocolate on top.\n\nMochas can be made with various types of chocolate, such as dark, milk,
72 | or white chocolate, depending on
73 | personal preference. They can also be served hot or iced, and with a variety of milk types, such as whole,
74 | skim, or soy milk.\n\nMochas are known for their rich, chocolatey flavor, and are a popular coffee drink among
75 | those with a sweet tooth. They are often enjoyed as a dessert or as an indulgent treat during a coffee break.
76 |
77 |
78 |
79 | Espresso is a strong, concentrated coffee beverage that is made by forcing hot water through finely ground coffee beans
80 | under high pressure.\n\nTo make espresso, a small amount of finely ground coffee beans is packed into a metal filter
81 | basket called a portafilter. The portafilter is then attached to an espresso machine, which uses high pressure to force hot water
82 | through the coffee grounds and extract a small, concentrated shot of coffee.\n\nEspresso is typically served in small, demitasse-sized
83 | cups and has a thick, creamy layer of foam on top called crema. The crema is formed during the brewing process and is a result of the
84 | high pressure used to extract the coffee. Espresso can be enjoyed on its own, as a shot, or can be used as a base for a variety of coffee
85 | beverages, such as cappuccinos, lattes, and macchiatos. It is known for its strong, bold flavor and is a popular choice among coffee lovers
86 | who enjoy a more intense coffee experience.
87 |
88 |
89 |
90 | A double espresso, also known as a doppio, is a coffee beverage made by extracting a double shot of espresso instead of a single shot.\n\nTo
91 | make a double espresso, twice the amount of coffee grounds are used and packed into the portafilter, and twice the amount of hot water
92 | is forced through the grounds to extract a larger, more concentrated shot of coffee.\n\nLike a regular espresso, a double espresso is typically
93 | served in a small, demitasse-sized cup and has a thick layer of crema on top. However, due to the larger amount of coffee used, a double espresso
94 | has a stronger, bolder flavor and a more intense caffeine content than a single shot of espresso.\n\nDouble espressos are often enjoyed by those
95 | who prefer a stronger coffee taste or who need an extra jolt of caffeine to start their day. They can be consumed on their own or used as a base
96 | for other coffee beverages such as lattes, cappuccinos, and macchiatos.
97 |
98 |
99 |
100 | Cortado is a coffee beverage that originated in Spain and is becoming increasingly popular in other parts of the world. It is made by combining equal
101 | parts of espresso and steamed milk.\n\nTo make a cortado, a shot of espresso is brewed and poured into a small glass or ceramic cup. Then, steamed milk
102 | is added to the espresso, creating a creamy and smooth texture. The ratio of espresso to milk is typically equal, although this can vary based on personal
103 | preference.\n\nCortados are known for their balance of strong coffee flavor and rich, velvety texture from the steamed milk. They are often served in smaller
104 | portions than a latte or cappuccino, making them a perfect option for those who prefer a smaller, less milky coffee beverage.\n\nThe word "cortado" comes from
105 | the Spanish word "cortar," which means "to cut." This refers to the way the espresso shot is "cut" with the steamed milk to create the perfect balance of coffee
106 | and milk flavor. Cortados are typically served as a morning or mid-day coffee beverage and are enjoyed by those who
107 | appreciate a rich and flavorful coffee without too much milk.
108 |
109 |
110 |
111 | A latte is a popular coffee beverage that is made with espresso and steamed milk. It is typically served in a tall glass or ceramic cup and is known for
112 | its smooth and creamy texture.\n\nTo make a latte, a shot of espresso is brewed and poured into the bottom of the cup. Then, steamed milk is added, creating
113 | a layer of creamy foam on top.The ratio of milk to espresso can vary, but typically there is more milk than espresso in a latte.\n\nLattes can be customized
114 | with various flavors, such as vanilla, caramel, or hazelnut, by adding flavored syrups or sauces to the espresso and milk mixture. They can also be topped
115 | with whipped cream, cocoa powder, or cinnamon for added flavor and decoration.\n\nLattes are often enjoyed as a morning or mid-day coffee beverage and are a
116 | popular choice among those who prefer a milder coffee taste. They are also a popular option for those who enjoy a milky coffee beverage with a touch of sweetness.
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/test/java/architex/labs/coffeedrop/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package architex.labs.coffeedrop
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | id ("com.android.application") version "8.0.0" apply false
4 | id ("com.android.library") version "8.0.0" apply false
5 | id ("org.jetbrains.kotlin.android") version "1.8.20" apply false
6 | id("com.google.dagger.hilt.android") version "2.44" apply false
7 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dev-xero/coffee-drop-ui/9990c094005abbad8ee56f2dd0d64c09ca940a00/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Apr 30 13:36:47 WAT 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | gradlePluginPortal()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 | rootProject.name = "Coffee Drop"
16 | include(":app")
17 |
--------------------------------------------------------------------------------