Skip to content

Commit 4637b55

Browse files
authored
Merge pull request #11 from DanielRendox/develop
Merge develop into production
2 parents 5037d09 + 695196e commit 4637b55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+498
-902
lines changed

.idea/deploymentTargetDropDown.xml

Lines changed: 1 addition & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<br />
88

9-
Grocery Genius is a reliable Android app for your grocery needs, where you can add, edit, and delete items with the finesse of a ninja. And we’re gearing up to introduce real-time sharing! Soon, you’ll be able to sync your shopping lists with friends and family as you go. Apart from that, Grocery Genius offers a visually appealing interface featuring grocery images, autocomplete suggestions, and an intuitive user experience.
9+
Grocery Genius is a reliable shopping list Android app for your grocery needs. It offers a visually appealing interface featuring grocery images, autocomplete suggestions, and an intuitive user experience.
1010

1111
## Motivation
1212

@@ -20,11 +20,13 @@ My motivation for this project is to learn how to talk to the server effectively
2020

2121
## Tech stack
2222

23-
- Jetpack Compose for the user interface, with a single Activity and no Fragments.
23+
- Jetpack Compose for the user interface, with a single Activity and no Fragments
2424
- View model for business logic separation
25+
- RecyclerView for lists with drag-and-drop functionality
2526
- Room database for local data storage
2627
- Kotlin coroutines and flow for asynchronous requests
2728
- Hilt for dependency injection
28-
- MVVM pattern but with intents from MVI
29-
- CLEAN architecture with both repository and use cases
30-
- SOLID principles
29+
- MVI pattern
30+
- CLEAN architecture data and presentation layer
31+
- Retrofit for working with REST API
32+
- Work Manager for synching data in the background

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ android {
1616
minSdk = 21
1717
targetSdk = 34
1818
versionCode = 1
19-
versionName = "1.0"
19+
versionName = "0.1.1"
2020

2121
testInstrumentationRunner = "com.rendox.grocerygenius.testing.GroceryGeniusTestRunner"
2222
vectorDrawables {

app/proguard-rules.pro

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@
2222

2323
-keepclassmembers class * extends androidx.datastore.preferences.protobuf.GeneratedMessageLite {
2424
<fields>;
25-
}
25+
}
26+
27+
# With R8 full mode generic signatures are stripped for classes that are not
28+
# kept. Suspend functions are wrapped in continuations where the type argument
29+
# is used.
30+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
31+
32+
# R8 full mode strips generic signatures from return types if not kept.
33+
-if interface * { @retrofit2.http.* public *** *(...); }
34+
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
35+
36+
# With R8 full mode generic signatures are stripped for classes that are not kept.
37+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
12.6 KB
Binary file not shown.
12.6 KB
Binary file not shown.
5.6 MB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.rendox.grocerygenius",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "0.1.1",
16+
"outputFile": "app-release.apk"
17+
}
18+
],
19+
"elementType": "File",
20+
"baselineProfiles": [
21+
{
22+
"minApi": 28,
23+
"maxApi": 30,
24+
"baselineProfiles": [
25+
"baselineProfiles/1/app-release.dm"
26+
]
27+
},
28+
{
29+
"minApi": 31,
30+
"maxApi": 2147483647,
31+
"baselineProfiles": [
32+
"baselineProfiles/0/app-release.dm"
33+
]
34+
}
35+
],
36+
"minSdkVersionForDexing": 21
37+
}

app/src/main/java/com/rendox/grocerygenius/MainActivity.kt

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import androidx.compose.ui.ExperimentalComposeUiApi
2424
import androidx.compose.ui.Modifier
2525
import androidx.compose.ui.semantics.semantics
2626
import androidx.compose.ui.semantics.testTagsAsResourceId
27+
import androidx.core.content.ContextCompat
2728
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
29+
import androidx.core.view.WindowCompat
2830
import androidx.lifecycle.Lifecycle
2931
import androidx.lifecycle.lifecycleScope
3032
import androidx.lifecycle.repeatOnLifecycle
@@ -59,37 +61,53 @@ class MainActivity : ComponentActivity() {
5961
uiState == null
6062
}
6163

62-
enableEdgeToEdge()
64+
val statusBarLightScrim = ContextCompat.getColor(this, R.color.status_bar_light_scrim)
65+
66+
if (Build.VERSION.SDK_INT < 23) {
67+
WindowCompat.setDecorFitsSystemWindows(window, false)
68+
window.statusBarColor = statusBarLightScrim
69+
window.navigationBarColor = navBarDarkScrim
70+
} else {
71+
enableEdgeToEdge()
72+
}
6373

6474
// app's UI has bottom sheets that don't look good in landscape mode on small screen sizes
6575
if (resources.configuration.smallestScreenWidthDp < 600) {
6676
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
6777
}
6878

6979
setContent {
70-
val darkTheme = shouldUseDarkTheme(uiState)
71-
DisposableEffect(darkTheme) {
72-
enableEdgeToEdge(
73-
statusBarStyle = SystemBarStyle.auto(
74-
Color.TRANSPARENT,
75-
Color.TRANSPARENT,
76-
) { darkTheme },
77-
navigationBarStyle = SystemBarStyle.auto(
78-
lightScrim,
79-
darkScrim,
80-
) { darkTheme },
81-
)
80+
val useDarkTheme = shouldUseDarkTheme(uiState)
81+
DisposableEffect(useDarkTheme) {
82+
if (Build.VERSION.SDK_INT >= 23) {
83+
enableEdgeToEdge(
84+
statusBarStyle = SystemBarStyle.auto(
85+
Color.TRANSPARENT,
86+
Color.TRANSPARENT,
87+
) { useDarkTheme },
88+
navigationBarStyle = SystemBarStyle.auto(
89+
navBarLightScrim,
90+
navBarDarkScrim,
91+
) { useDarkTheme },
92+
)
93+
}
8294
onDispose {}
8395
}
84-
LaunchedEffect(Unit) {
96+
LaunchedEffect(useDarkTheme) {
8597
if (Build.VERSION.SDK_INT >= 29) {
8698
window.isNavigationBarContrastEnforced = false
8799
}
88100
}
101+
LaunchedEffect(useDarkTheme) {
102+
if (Build.VERSION.SDK_INT < 23) {
103+
window.statusBarColor =
104+
if (useDarkTheme) Color.TRANSPARENT else statusBarLightScrim
105+
}
106+
}
89107

90108
uiState?.let { uiState ->
91109
GroceryGeniusTheme(
92-
useDarkTheme = darkTheme,
110+
useDarkTheme = useDarkTheme,
93111
disableDynamicColor = !uiState.useSystemAccentColor,
94112
requestedColorScheme = uiState.selectedTheme,
95113
) {
@@ -125,10 +143,10 @@ private fun shouldUseDarkTheme(
125143
* The default light scrim, as defined by androidx and the platform:
126144
* https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt;l=35-38;drc=27e7d52e8604a080133e8b842db10c89b4482598
127145
*/
128-
private val lightScrim = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
146+
private val navBarLightScrim = Color.argb(0xe6, 0xFF, 0xFF, 0xFF)
129147

130148
/**
131149
* The default dark scrim, as defined by androidx and the platform:
132150
* https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt;l=40-44;drc=27e7d52e8604a080133e8b842db10c89b4482598
133151
*/
134-
private val darkScrim = Color.argb(0x80, 0x1b, 0x1b, 0x1b)
152+
private val navBarDarkScrim = Color.argb(0x80, 0x1b, 0x1b, 0x1b)

0 commit comments

Comments
 (0)