diff --git a/feature/about/build.gradle.kts b/feature/about/build.gradle.kts
index 38dd9e33cae..99a4c8e80ef 100644
--- a/feature/about/build.gradle.kts
+++ b/feature/about/build.gradle.kts
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
plugins {
alias(libs.plugins.mifos.android.feature)
alias(libs.plugins.mifos.android.library.compose)
diff --git a/feature/about/src/androidTest/java/com/mifos/feature/about/ExampleInstrumentedTest.kt b/feature/about/src/androidTest/java/com/mifos/feature/about/ExampleInstrumentedTest.kt
index 7ba134dc4b5..ac83676a99f 100644
--- a/feature/about/src/androidTest/java/com/mifos/feature/about/ExampleInstrumentedTest.kt
+++ b/feature/about/src/androidTest/java/com/mifos/feature/about/ExampleInstrumentedTest.kt
@@ -1,13 +1,20 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
-import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
-
+import androidx.test.platform.app.InstrumentationRegistry
+import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
-import org.junit.Assert.*
-
/**
* Instrumented test, which will execute on an Android device.
*
@@ -21,4 +28,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mifos.feature.about.test", appContext.packageName)
}
-}
\ No newline at end of file
+}
diff --git a/feature/about/src/main/AndroidManifest.xml b/feature/about/src/main/AndroidManifest.xml
index a5918e68abc..1dc76da0f7e 100644
--- a/feature/about/src/main/AndroidManifest.xml
+++ b/feature/about/src/main/AndroidManifest.xml
@@ -1,4 +1,13 @@
+
\ No newline at end of file
diff --git a/feature/about/src/main/java/com/mifos/feature/about/AboutItem.kt b/feature/about/src/main/java/com/mifos/feature/about/AboutItem.kt
index 3d33fddd8d1..9d67d99e6ab 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/AboutItem.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/AboutItem.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
import androidx.compose.ui.graphics.Color
@@ -7,5 +16,5 @@ data class AboutItem(
val title: Int,
val subtitle: Int?,
val color: Color,
- val id: AboutItems
-)
\ No newline at end of file
+ val id: AboutItems,
+)
diff --git a/feature/about/src/main/java/com/mifos/feature/about/AboutScreen.kt b/feature/about/src/main/java/com/mifos/feature/about/AboutScreen.kt
index 868ad7862a6..c0883cff854 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/AboutScreen.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/AboutScreen.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
import androidx.compose.foundation.Image
@@ -42,11 +51,11 @@ import com.mifos.core.designsystem.theme.White
import com.mifos.core.designsystem.theme.aboutItemTextStyle
import com.mifos.core.designsystem.theme.aboutItemTextStyleBold
-
@Composable
-fun AboutScreen(onBackPressed: () -> Unit) {
-
- val viewModel: AboutViewModel = hiltViewModel()
+internal fun AboutScreen(
+ onBackPressed: () -> Unit,
+ viewModel: AboutViewModel = hiltViewModel()
+) {
val state by viewModel.aboutUiState.collectAsStateWithLifecycle()
val uriHandler = LocalUriHandler.current
@@ -72,35 +81,34 @@ fun AboutScreen(onBackPressed: () -> Unit) {
AboutItems.LICENSE -> uriHandler.openUri("https://github.com/openMF/android-client/blob/master/LICENSE.md")
}
- }
+ },
)
}
@Composable
-fun AboutScreen(
+internal fun AboutScreen(
state: AboutUiState,
onBackPressed: () -> Unit,
onRetry: () -> Unit,
- onOptionClick: (AboutItems) -> Unit
+ onOptionClick: (AboutItems) -> Unit,
) {
-
val snackbarHostState = remember { SnackbarHostState() }
MifosScaffold(
icon = MifosIcons.arrowBack,
title = stringResource(R.string.feature_about),
onBackPressed = onBackPressed,
- snackbarHostState = snackbarHostState
+ snackbarHostState = snackbarHostState,
) { paddingValues ->
Column(
modifier = Modifier.padding(paddingValues),
- horizontalAlignment = Alignment.CenterHorizontally
+ horizontalAlignment = Alignment.CenterHorizontally,
) {
when (state) {
is AboutUiState.AboutOptions -> {
AboutScreenContent(
aboutOptions = state.aboutOptions,
- onOptionClick = onOptionClick
+ onOptionClick = onOptionClick,
)
}
@@ -115,76 +123,79 @@ fun AboutScreen(
}
@Composable
-fun AboutScreenContent(
+private fun AboutScreenContent(
aboutOptions: List,
- onOptionClick: (AboutItems) -> Unit
+ onOptionClick: (AboutItems) -> Unit,
) {
- Image(
- modifier = Modifier.size(100.dp),
- painter = painterResource(id = R.drawable.feature_about_ic_launcher),
- contentDescription = null
- )
- Text(
- modifier = Modifier
- .fillMaxWidth()
- .padding(16.dp),
- text = stringResource(id = R.string.feature_about_mifos_x_droid),
- style = aboutItemTextStyleBold
- )
- Text(
- modifier = Modifier
- .fillMaxWidth()
- .padding(start = 16.dp, end = 16.dp),
- text = stringResource(id = R.string.feature_about_app),
- style = aboutItemTextStyle
- )
- Text(
- modifier = Modifier
- .fillMaxWidth()
- .padding(16.dp)
- .clickable {
- onOptionClick(AboutItems.CONTRIBUTIONS)
- },
- text = stringResource(id = R.string.feature_about_mifos),
- style = TextStyle(
- fontSize = 16.sp
- ),
- color = BluePrimary,
- textAlign = TextAlign.Center
- )
- LazyColumn {
- items(aboutOptions) { about ->
- AboutCardItem(about = about, onOptionClick = onOptionClick)
+ Column {
+
+ Image(
+ modifier = Modifier.size(100.dp),
+ painter = painterResource(id = R.drawable.feature_about_ic_launcher),
+ contentDescription = null,
+ )
+ Text(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(16.dp),
+ text = stringResource(id = R.string.feature_about_mifos_x_droid),
+ style = aboutItemTextStyleBold,
+ )
+ Text(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(start = 16.dp, end = 16.dp),
+ text = stringResource(id = R.string.feature_about_app),
+ style = aboutItemTextStyle,
+ )
+ Text(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(16.dp)
+ .clickable {
+ onOptionClick(AboutItems.CONTRIBUTIONS)
+ },
+ text = stringResource(id = R.string.feature_about_mifos),
+ style = TextStyle(
+ fontSize = 16.sp,
+ ),
+ color = BluePrimary,
+ textAlign = TextAlign.Center,
+ )
+ LazyColumn {
+ items(aboutOptions) { about ->
+ AboutCardItem(about = about, onOptionClick = onOptionClick)
+ }
}
}
}
@Composable
-fun AboutCardItem(
+private fun AboutCardItem(
about: AboutItem,
- onOptionClick: (AboutItems) -> Unit
+ onOptionClick: (AboutItems) -> Unit,
) {
ElevatedCard(
modifier = Modifier.padding(
start = 16.dp,
end = 16.dp,
top = 8.dp,
- bottom = 8.dp
+ bottom = 8.dp,
),
elevation = CardDefaults.elevatedCardElevation(0.dp),
colors = CardDefaults.elevatedCardColors(about.color),
onClick = {
onOptionClick(about.id)
- }
+ },
) {
Row(
modifier = Modifier.padding(16.dp),
- verticalAlignment = Alignment.CenterVertically
+ verticalAlignment = Alignment.CenterVertically,
) {
about.icon?.let {
Icon(
painter = painterResource(it),
- contentDescription = null
+ contentDescription = null,
)
}
Column {
@@ -194,9 +205,9 @@ fun AboutCardItem(
.padding(start = 16.dp, end = 16.dp),
text = stringResource(id = about.title),
style = TextStyle(
- fontSize = 16.sp
+ fontSize = 16.sp,
),
- color = Black
+ color = Black,
)
about.subtitle?.let {
Text(
@@ -205,9 +216,9 @@ fun AboutCardItem(
.padding(start = 16.dp, end = 16.dp),
text = stringResource(id = it),
style = TextStyle(
- fontSize = 16.sp
+ fontSize = 16.sp,
),
- color = Black
+ color = Black,
)
}
}
@@ -215,28 +226,26 @@ fun AboutCardItem(
}
}
-class AboutUiStateProvider : PreviewParameterProvider {
+private class AboutUiStateProvider : PreviewParameterProvider {
override val values: Sequence
get() = sequenceOf(
AboutUiState.Loading,
AboutUiState.Error(R.string.feature_about_failed_to_load),
- AboutUiState.AboutOptions(sampleAboutItem)
+ AboutUiState.AboutOptions(sampleAboutItem),
)
-
}
-
@Preview(showBackground = true)
@Composable
private fun AboutScreenPreview(
- @PreviewParameter(AboutUiStateProvider::class) state: AboutUiState
+ @PreviewParameter(AboutUiStateProvider::class) state: AboutUiState,
) {
AboutScreen(
state = state,
onBackPressed = {},
onRetry = {},
- onOptionClick = {}
+ onOptionClick = {},
)
}
@@ -246,6 +255,6 @@ val sampleAboutItem = List(4) {
title = R.string.feature_about_support_twitter,
subtitle = R.string.feature_about_license_sub,
color = White,
- id = AboutItems.TWITTER
+ id = AboutItems.TWITTER,
)
-}
\ No newline at end of file
+}
diff --git a/feature/about/src/main/java/com/mifos/feature/about/AboutUiState.kt b/feature/about/src/main/java/com/mifos/feature/about/AboutUiState.kt
index be699182a77..50b6df6fd92 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/AboutUiState.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/AboutUiState.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
sealed class AboutUiState {
@@ -7,4 +16,4 @@ sealed class AboutUiState {
data class Error(val message: Int) : AboutUiState()
data class AboutOptions(val aboutOptions: List) : AboutUiState()
-}
\ No newline at end of file
+}
diff --git a/feature/about/src/main/java/com/mifos/feature/about/AboutViewModel.kt b/feature/about/src/main/java/com/mifos/feature/about/AboutViewModel.kt
index 1b4419581a7..be4f1b0e907 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/AboutViewModel.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/AboutViewModel.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
import androidx.lifecycle.ViewModel
@@ -24,36 +33,36 @@ class AboutViewModel @Inject constructor() : ViewModel() {
title = R.string.feature_about_app_version,
subtitle = null,
color = BlueSecondary,
- id = AboutItems.APP_VERSION
+ id = AboutItems.APP_VERSION,
),
AboutItem(
icon = R.drawable.feature_about_ic_website,
title = R.string.feature_about_website,
subtitle = null,
color = White,
- id = AboutItems.OFFICIAL_WEBSITE
+ id = AboutItems.OFFICIAL_WEBSITE,
),
AboutItem(
icon = R.drawable.feature_about_icon_twitter,
title = R.string.feature_about_support_twitter,
subtitle = null,
color = White,
- id = AboutItems.TWITTER
+ id = AboutItems.TWITTER,
),
AboutItem(
icon = R.drawable.feature_about_ic_source_code,
title = R.string.feature_about_support_github,
subtitle = null,
color = White,
- id = AboutItems.SOURCE_CODE
+ id = AboutItems.SOURCE_CODE,
),
AboutItem(
icon = null,
title = R.string.feature_about_license,
subtitle = R.string.feature_about_license_sub,
color = BlueSecondary,
- id = AboutItems.LICENSE
- )
+ id = AboutItems.LICENSE,
+ ),
)
_aboutUiState.value = AboutUiState.AboutOptions(options)
} catch (exception: Exception) {
@@ -63,5 +72,10 @@ class AboutViewModel @Inject constructor() : ViewModel() {
}
enum class AboutItems {
- CONTRIBUTIONS, APP_VERSION, OFFICIAL_WEBSITE, TWITTER, SOURCE_CODE, LICENSE
-}
\ No newline at end of file
+ CONTRIBUTIONS,
+ APP_VERSION,
+ OFFICIAL_WEBSITE,
+ TWITTER,
+ SOURCE_CODE,
+ LICENSE,
+}
diff --git a/feature/about/src/main/java/com/mifos/feature/about/navigation/AboutScreens.kt b/feature/about/src/main/java/com/mifos/feature/about/navigation/AboutScreens.kt
index a12e9cf564a..fd5299e5b3f 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/navigation/AboutScreens.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/navigation/AboutScreens.kt
@@ -1,8 +1,17 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about.navigation
/**
* Created by Pronay Sarker on 18/08/2024 (2:42 PM)
*/
sealed class AboutScreens(val route: String) {
- data object AboutScreen : AboutScreens(route = "about_screen_route")
-}
\ No newline at end of file
+ data object AboutScreen : AboutScreens(route = "about_screen_route")
+}
diff --git a/feature/about/src/main/java/com/mifos/feature/about/navigation/AccountNavigation.kt b/feature/about/src/main/java/com/mifos/feature/about/navigation/AccountNavigation.kt
index 9d30bc51813..edfa9e7a0ad 100644
--- a/feature/about/src/main/java/com/mifos/feature/about/navigation/AccountNavigation.kt
+++ b/feature/about/src/main/java/com/mifos/feature/about/navigation/AccountNavigation.kt
@@ -1,6 +1,14 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about.navigation
-import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.about.AboutScreen
@@ -9,11 +17,11 @@ import com.mifos.feature.about.AboutScreen
* Created by Pronay Sarker on 10/08/2024 (7:56 AM)
*/
fun NavGraphBuilder.aboutScreen(
- onBackPressed: () -> Unit
+ onBackPressed: () -> Unit,
) {
composable(AboutScreens.AboutScreen.route) {
AboutScreen(
- onBackPressed = onBackPressed
+ onBackPressed = onBackPressed,
)
}
}
diff --git a/feature/about/src/main/res/drawable/feature_about_ic_source_code.xml b/feature/about/src/main/res/drawable/feature_about_ic_source_code.xml
index b18546b0369..d3aca4f2859 100644
--- a/feature/about/src/main/res/drawable/feature_about_ic_source_code.xml
+++ b/feature/about/src/main/res/drawable/feature_about_ic_source_code.xml
@@ -1,4 +1,13 @@
+
+
+
+
About
MifosXDroid
diff --git a/feature/about/src/test/java/com/mifos/feature/about/ExampleUnitTest.kt b/feature/about/src/test/java/com/mifos/feature/about/ExampleUnitTest.kt
index be818fa532d..ffb6b6ba8b9 100644
--- a/feature/about/src/test/java/com/mifos/feature/about/ExampleUnitTest.kt
+++ b/feature/about/src/test/java/com/mifos/feature/about/ExampleUnitTest.kt
@@ -1,9 +1,17 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.feature.about
+import org.junit.Assert.assertEquals
import org.junit.Test
-import org.junit.Assert.*
-
/**
* Example local unit test, which will execute on the development machine (host).
*
@@ -14,4 +22,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
-}
\ No newline at end of file
+}