From f30c71f79333e0aaf620f4f88cb007f883c5f3fe Mon Sep 17 00:00:00 2001 From: Yash Chaudhary Date: Sat, 5 Oct 2024 14:06:10 +0530 Subject: [PATCH 1/4] Fixed #2713 Adjusted status bar to dynamically follow the app's theme, ensuring consistency between the UI and the status bar. --- androidApp/build.gradle.kts | 5 +++++ .../main/kotlin/org/mifos/mobile/HomeActivity.kt | 2 ++ .../main/kotlin/org/mifos/mobile/ui/MifosApp.kt | 14 ++++++++++++-- androidApp/src/main/res/values/colors.xml | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index a92f3972a..d5da879fb 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -144,4 +144,9 @@ dependencies { androidTestImplementation(libs.hilt.android.testing) debugApi(libs.androidx.compose.ui.tooling) + + implementation("com.google.accompanist:accompanist-systemuicontroller:0.34.0") + + + } diff --git a/androidApp/src/main/kotlin/org/mifos/mobile/HomeActivity.kt b/androidApp/src/main/kotlin/org/mifos/mobile/HomeActivity.kt index 7ced2b270..09e71738d 100644 --- a/androidApp/src/main/kotlin/org/mifos/mobile/HomeActivity.kt +++ b/androidApp/src/main/kotlin/org/mifos/mobile/HomeActivity.kt @@ -63,6 +63,8 @@ class HomeActivity : ComponentActivity() { when (uiState) { HomeActivityUiState.Loading -> true is Success -> false + HomeActivityUiState.Loading -> TODO() + is Success -> TODO() } } diff --git a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt index c8a46c215..cd5240572 100644 --- a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt +++ b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt @@ -34,6 +34,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.google.accompanist.systemuicontroller.rememberSystemUiController import org.mifos.mobile.R import org.mifos.mobile.core.designsystem.theme.MifosBackground import org.mifos.mobile.navigation.MifosNavHost @@ -45,11 +46,20 @@ fun MifosApp( onClickLogout: () -> Unit, modifier: Modifier = Modifier, ) { + val systemUiController = rememberSystemUiController() + val isOffline by appState.isOffline.collectAsStateWithLifecycle() + + // Set the status bar color based on your theme + val statusBarColor = MaterialTheme.colorScheme.primary // Use the defined primary color + + // Apply the status bar color + LaunchedEffect(Unit) { + systemUiController.setStatusBarColor(color = statusBarColor) + } + MifosBackground(modifier) { val snackbarHostState = remember { SnackbarHostState() } - val isOffline by appState.isOffline.collectAsStateWithLifecycle() - // If user is not connected to the internet show a snack bar to inform them. val notConnectedMessage = stringResource(R.string.not_connected) LaunchedEffect(isOffline) { diff --git a/androidApp/src/main/res/values/colors.xml b/androidApp/src/main/res/values/colors.xml index 94394e4c5..47162dccf 100644 --- a/androidApp/src/main/res/values/colors.xml +++ b/androidApp/src/main/res/values/colors.xml @@ -72,6 +72,7 @@ #EEEEEE #00000000 + @color/blue_light From 904348321ec8be0cc29a74e434e60785fa2add35 Mon Sep 17 00:00:00 2001 From: Yash Chaudhary Date: Sat, 5 Oct 2024 14:11:05 +0530 Subject: [PATCH 2/4] Fixed #2713 Adjusted status bar to dynamically follow the app's theme, ensuring consistency between the UI and the status bar. --- androidApp/dependencies/releaseRuntimeClasspath.tree.txt | 9 +++++++-- androidApp/dependencies/releaseRuntimeClasspath.txt | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/androidApp/dependencies/releaseRuntimeClasspath.tree.txt b/androidApp/dependencies/releaseRuntimeClasspath.tree.txt index 6a0c7328e..33b1107e9 100644 --- a/androidApp/dependencies/releaseRuntimeClasspath.tree.txt +++ b/androidApp/dependencies/releaseRuntimeClasspath.tree.txt @@ -1096,7 +1096,7 @@ | | | +--- com.google.dagger:hilt-android:2.52 (*) | | | +--- com.squareup.retrofit2:converter-gson:2.11.0 (*) | | | +--- com.github.Raizlabs.DBFlow:dbflow:4.2.4 -| | | | \--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 +| | | | +--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 | | | | \--- com.android.support:support-annotations:26.0.1 -> androidx.annotation:annotation:1.8.1 (*) | | | +--- com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 | | | +--- io.reactivex.rxjava2:rxandroid:2.1.1 @@ -1627,4 +1627,9 @@ | +--- com.google.android.gms:play-services-base:18.5.0 (*) | +--- com.google.android.gms:play-services-basement:18.4.0 (*) | \--- com.google.android.gms:play-services-tasks:18.2.0 (*) -\--- androidx.multidex:multidex:2.0.1 ++--- androidx.multidex:multidex:2.0.1 +\--- com.google.accompanist:accompanist-systemuicontroller:0.34.0 + +--- androidx.core:core-ktx:1.8.0 -> 1.13.1 (*) + +--- androidx.compose.ui:ui:1.6.0 -> 1.7.0-rc01 (*) + +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 -> 1.8.0 (*) + \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 -> 2.0.20 (*) diff --git a/androidApp/dependencies/releaseRuntimeClasspath.txt b/androidApp/dependencies/releaseRuntimeClasspath.txt index 02741937d..db6c19e1d 100644 --- a/androidApp/dependencies/releaseRuntimeClasspath.txt +++ b/androidApp/dependencies/releaseRuntimeClasspath.txt @@ -160,10 +160,11 @@ co.touchlab:stately-concurrent-collections-jvm:2.0.6 co.touchlab:stately-concurrent-collections:2.0.6 co.touchlab:stately-strict-jvm:2.0.6 co.touchlab:stately-strict:2.0.6 -com.github.Raizlabs.DBFlow:dbflow:4.2.4 com.github.Raizlabs.DBFlow:dbflow-core:4.2.4 +com.github.Raizlabs.DBFlow:dbflow:4.2.4 com.google.accompanist:accompanist-pager:0.34.0 com.google.accompanist:accompanist-permissions:0.34.0 +com.google.accompanist:accompanist-systemuicontroller:0.34.0 com.google.android.datatransport:transport-api:3.2.0 com.google.android.datatransport:transport-backend-cct:3.3.0 com.google.android.datatransport:transport-runtime:3.3.0 From 561e88ba057774133a8a5537433da269fa1edfdb Mon Sep 17 00:00:00 2001 From: Yash Chaudhary Date: Sat, 5 Oct 2024 14:32:29 +0530 Subject: [PATCH 3/4] Fixed #2713 Adjusted status bar to dynamically follow the app's theme, ensuring consistency between the UI and the status bar. --- androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt index cd5240572..fe0e3f947 100644 --- a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt +++ b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt @@ -32,7 +32,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.google.accompanist.systemuicontroller.rememberSystemUiController import org.mifos.mobile.R @@ -73,7 +72,7 @@ fun MifosApp( Scaffold( modifier = Modifier.semantics { - testTagsAsResourceId = true + }, containerColor = Color.Transparent, contentColor = MaterialTheme.colorScheme.onBackground, From c9810f3dde831d2363de9d2dae4e55d04a58f43f Mon Sep 17 00:00:00 2001 From: Yash Chaudhary Date: Sat, 5 Oct 2024 14:53:25 +0530 Subject: [PATCH 4/4] Fixed #2713 Adjusted status bar to dynamically follow the app's theme, ensuring consistency between the UI and the status bar. --- androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt index fe0e3f947..fa31fd6c4 100644 --- a/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt +++ b/androidApp/src/main/kotlin/org/mifos/mobile/ui/MifosApp.kt @@ -72,7 +72,6 @@ fun MifosApp( Scaffold( modifier = Modifier.semantics { - }, containerColor = Color.Transparent, contentColor = MaterialTheme.colorScheme.onBackground,