diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts
index 08a12706cfc..0bbc807bd5f 100644
--- a/core/ui/build.gradle.kts
+++ b/core/ui/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.library)
alias(libs.plugins.mifos.android.library.compose)
diff --git a/core/ui/src/androidTest/java/com/mifos/core/ui/ExampleInstrumentedTest.kt b/core/ui/src/androidTest/java/com/mifos/core/ui/ExampleInstrumentedTest.kt
index 71758e71622..8182815382c 100644
--- a/core/ui/src/androidTest/java/com/mifos/core/ui/ExampleInstrumentedTest.kt
+++ b/core/ui/src/androidTest/java/com/mifos/core/ui/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.core.ui
-import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
-
+import androidx.test.platform.app.InstrumentationRegistry
+import junit.framework.TestCase.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.core.ui.test", appContext.packageName)
}
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/AndroidManifest.xml b/core/ui/src/main/AndroidManifest.xml
index a5918e68abc..1dc76da0f7e 100644
--- a/core/ui/src/main/AndroidManifest.xml
+++ b/core/ui/src/main/AndroidManifest.xml
@@ -1,4 +1,13 @@
+
\ No newline at end of file
diff --git a/core/ui/src/main/java/com/mifos/core/ui/components/MifosEmptyUi.kt b/core/ui/src/main/java/com/mifos/core/ui/components/MifosEmptyUi.kt
index 684e0280163..1df0ad4f11d 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/components/MifosEmptyUi.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/components/MifosEmptyUi.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.core.ui.components
import androidx.compose.foundation.layout.Arrangement
@@ -26,8 +35,8 @@ import com.mifos.core.designsystem.theme.DarkGray
@Composable
fun MifosEmptyUi(
- modifier: Modifier = Modifier,
text: String,
+ modifier: Modifier = Modifier,
icon: ImageVector = Icons.Default.Info,
) {
Box(
@@ -36,7 +45,7 @@ fun MifosEmptyUi(
.semantics {
contentDescription = "MifosEmptyUi"
},
- contentAlignment = Alignment.Center
+ contentAlignment = Alignment.Center,
) {
Column(
modifier = Modifier
@@ -44,13 +53,13 @@ fun MifosEmptyUi(
.padding(18.dp)
.align(Alignment.Center),
horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.spacedBy(20.dp, Alignment.CenterVertically)
+ verticalArrangement = Arrangement.spacedBy(20.dp, Alignment.CenterVertically),
) {
Icon(
imageVector = icon,
contentDescription = text + icon.name,
tint = Color.Gray,
- modifier = Modifier.size(70.dp)
+ modifier = Modifier.size(70.dp),
)
Text(
@@ -59,9 +68,9 @@ fun MifosEmptyUi(
fontSize = 14.sp,
fontWeight = FontWeight.Normal,
fontStyle = FontStyle.Normal,
- color = DarkGray
- )
+ color = DarkGray,
+ ),
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/java/com/mifos/core/ui/components/MifosFAB.kt b/core/ui/src/main/java/com/mifos/core/ui/components/MifosFAB.kt
index 07b27c19b99..5c29b3bcba6 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/components/MifosFAB.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/components/MifosFAB.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.core.ui.components
import androidx.compose.foundation.layout.Box
@@ -12,23 +21,23 @@ import com.mifos.core.designsystem.theme.BlueSecondary
@Composable
fun MifosFAB(
- modifier: Modifier = Modifier,
icon: ImageVector,
onClick: () -> Unit,
+ modifier: Modifier = Modifier,
containerColor: Color = BlueSecondary,
) {
Box(
modifier = modifier,
- contentAlignment = Alignment.BottomEnd
+ contentAlignment = Alignment.BottomEnd,
) {
FloatingActionButton(
onClick = onClick,
- containerColor = containerColor
+ containerColor = containerColor,
) {
Icon(
imageVector = icon,
- contentDescription = "MifosFab"
+ contentDescription = "MifosFab",
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/java/com/mifos/core/ui/components/MifosToolbar.kt b/core/ui/src/main/java/com/mifos/core/ui/components/MifosToolbar.kt
index c4953151d6a..e4747560e91 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/components/MifosToolbar.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/components/MifosToolbar.kt
@@ -1,11 +1,18 @@
+/*
+ * 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.core.ui.components
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Close
-import androidx.compose.material.icons.rounded.Sync
import androidx.compose.material3.ExperimentalMaterial3Api
-import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
@@ -19,16 +26,16 @@ import com.mifos.core.designsystem.theme.BlueSecondary
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SelectionModeTopAppBar(
- modifier: Modifier = Modifier,
itemCount: Int,
resetSelectionMode: () -> Unit,
+ modifier: Modifier = Modifier,
containerColor: Color = BlueSecondary,
- actions : @Composable RowScope.() -> Unit = {}
+ actions: @Composable RowScope.() -> Unit = {},
) {
TopAppBar(
modifier = modifier,
colors = TopAppBarDefaults.topAppBarColors(
- containerColor = containerColor
+ containerColor = containerColor,
),
title = {
Text(text = "$itemCount selected")
@@ -43,6 +50,6 @@ fun SelectionModeTopAppBar(
)
}
},
- actions = actions
+ actions = actions,
)
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/java/com/mifos/core/ui/components/MultiFloatingActionButton.kt b/core/ui/src/main/java/com/mifos/core/ui/components/MultiFloatingActionButton.kt
index 9e7ec8c869c..9b07e03a357 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/components/MultiFloatingActionButton.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/components/MultiFloatingActionButton.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.core.ui.components
import androidx.compose.animation.AnimatedVisibility
@@ -23,7 +32,9 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
enum class FabType {
- CLIENT, CENTER, GROUP
+ CLIENT,
+ CENTER,
+ GROUP,
}
sealed class FabButtonState {
@@ -47,53 +58,55 @@ data class FabButton(
@Composable
fun FabItem(
- modifier: Modifier = Modifier,
fabButton: FabButton,
- onFabClick: (FabType) -> Unit
+ modifier: Modifier = Modifier,
+ onFabClick: (FabType) -> Unit,
) {
FloatingActionButton(
onClick = {
onFabClick(fabButton.fabType)
},
modifier = modifier
- .size(48.dp)
+ .size(48.dp),
) {
Icon(
painter = painterResource(id = fabButton.iconRes),
- contentDescription = fabButton.fabType.name
+ contentDescription = fabButton.fabType.name,
)
}
}
@Composable
fun MultiFloatingActionButton(
- modifier: Modifier = Modifier,
fabButtons: List,
fabButtonState: FabButtonState,
onFabButtonStateChange: (FabButtonState) -> Unit,
+ modifier: Modifier = Modifier,
onFabClick: (FabType) -> Unit,
) {
val rotation by animateFloatAsState(
- if (fabButtonState.isExpanded())
+ if (fabButtonState.isExpanded()) {
45f
- else
- 0f, label = "mainFabRotation"
+ } else {
+ 0f
+ },
+ label = "mainFabRotation",
)
Column(
modifier = modifier,
- horizontalAlignment = Alignment.CenterHorizontally
+ horizontalAlignment = Alignment.CenterHorizontally,
) {
AnimatedVisibility(
visible = fabButtonState.isExpanded(),
enter = fadeIn() + expandVertically(),
- exit = fadeOut() + shrinkVertically()
+ exit = fadeOut() + shrinkVertically(),
) {
Column {
fabButtons.forEach {
FabItem(
fabButton = it,
- onFabClick = onFabClick
+ onFabClick = onFabClick,
)
Spacer(modifier = Modifier.height(24.dp))
}
@@ -105,12 +118,12 @@ fun MultiFloatingActionButton(
onFabButtonStateChange(fabButtonState.toggleValue())
},
modifier = Modifier
- .rotate(rotation)
+ .rotate(rotation),
) {
Icon(
imageVector = Icons.Default.Add,
- contentDescription = "mainFabIcon"
+ contentDescription = "mainFabIcon",
)
}
}
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/java/com/mifos/core/ui/util/DevicePreviews.kt b/core/ui/src/main/java/com/mifos/core/ui/util/DevicePreviews.kt
index 087f61b2414..e79b9f452d1 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/util/DevicePreviews.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/util/DevicePreviews.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.core.ui.util
import androidx.compose.ui.tooling.preview.Preview
@@ -10,4 +19,4 @@ import androidx.compose.ui.tooling.preview.Preview
@Preview(name = "landscape", device = "spec:shape=Normal,width=640,height=360,unit=dp,dpi=480")
@Preview(name = "foldable", device = "spec:shape=Normal,width=673,height=841,unit=dp,dpi=480")
@Preview(name = "tablet", device = "spec:shape=Normal,width=1280,height=800,unit=dp,dpi=480")
-annotation class DevicePreviews
\ No newline at end of file
+annotation class DevicePreviews
diff --git a/core/ui/src/main/java/com/mifos/core/ui/util/GroupListPreviewParameterProvider.kt b/core/ui/src/main/java/com/mifos/core/ui/util/GroupListPreviewParameterProvider.kt
index d4d73e6282a..c77dc63f286 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/util/GroupListPreviewParameterProvider.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/util/GroupListPreviewParameterProvider.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.core.ui.util
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@@ -12,57 +21,65 @@ import kotlinx.coroutines.flow.flowOf
class GroupListSuccessPreviewParameterProvider : PreviewParameterProvider>> {
override val values: Sequence>>
get() = sequenceOf(
- flowOf(PagingData.from(
- data = sampleGroups,
- sourceLoadStates = LoadStates(
- refresh = LoadState.NotLoading(false),
- append = LoadState.NotLoading(false),
- prepend = LoadState.NotLoading(false)
- )
- ))
+ flowOf(
+ PagingData.from(
+ data = sampleGroups,
+ sourceLoadStates = LoadStates(
+ refresh = LoadState.NotLoading(false),
+ append = LoadState.NotLoading(false),
+ prepend = LoadState.NotLoading(false),
+ ),
+ ),
+ ),
)
}
class GroupListEmptyPreviewParameterProvider : PreviewParameterProvider>> {
override val values: Sequence>>
get() = sequenceOf(
- flowOf(PagingData.empty(
- sourceLoadStates = LoadStates(
- refresh = LoadState.NotLoading(false),
- append = LoadState.NotLoading(false),
- prepend = LoadState.NotLoading(false)
- )
- ))
+ flowOf(
+ PagingData.empty(
+ sourceLoadStates = LoadStates(
+ refresh = LoadState.NotLoading(false),
+ append = LoadState.NotLoading(false),
+ prepend = LoadState.NotLoading(false),
+ ),
+ ),
+ ),
)
}
class GroupListLoadingPreviewParameterProvider : PreviewParameterProvider>> {
override val values: Sequence>>
get() = sequenceOf(
- flowOf(PagingData.empty(
- sourceLoadStates = LoadStates(
- refresh = LoadState.Loading,
- append = LoadState.Loading,
- prepend = LoadState.Loading
- )
- ))
+ flowOf(
+ PagingData.empty(
+ sourceLoadStates = LoadStates(
+ refresh = LoadState.Loading,
+ append = LoadState.Loading,
+ prepend = LoadState.Loading,
+ ),
+ ),
+ ),
)
}
class GroupListErrorPreviewParameterProvider : PreviewParameterProvider>> {
override val values: Sequence>>
get() = sequenceOf(
- flowOf(PagingData.empty(
- sourceLoadStates = LoadStates(
- refresh = LoadState.Error(Throwable("Unable to fetch data from server")),
- append = LoadState.Loading,
- prepend = LoadState.NotLoading(false)
- )
- ))
+ flowOf(
+ PagingData.empty(
+ sourceLoadStates = LoadStates(
+ refresh = LoadState.Error(Throwable("Unable to fetch data from server")),
+ append = LoadState.Loading,
+ prepend = LoadState.NotLoading(false),
+ ),
+ ),
+ ),
)
}
-class GroupListItemPreviewParameterProvider: PreviewParameterProvider {
+class GroupListItemPreviewParameterProvider : PreviewParameterProvider {
override val values: Sequence
get() = sequenceOf(sampleGroups[1])
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/java/com/mifos/core/ui/util/SearchResultPreviewParameter.kt b/core/ui/src/main/java/com/mifos/core/ui/util/SearchResultPreviewParameter.kt
index c2604763393..14b8c7326f8 100644
--- a/core/ui/src/main/java/com/mifos/core/ui/util/SearchResultPreviewParameter.kt
+++ b/core/ui/src/main/java/com/mifos/core/ui/util/SearchResultPreviewParameter.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.core.ui.util
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@@ -18,7 +27,7 @@ object SearchResultPreviewData {
entityType = "Clients",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 2,
@@ -27,7 +36,7 @@ object SearchResultPreviewData {
entityType = "Clients",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 3,
@@ -36,7 +45,7 @@ object SearchResultPreviewData {
entityType = "Groups",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 4,
@@ -45,7 +54,7 @@ object SearchResultPreviewData {
entityType = "Clients",
parentId = 3,
parentName = "Acme Group",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 5,
@@ -54,7 +63,7 @@ object SearchResultPreviewData {
entityType = "Loans",
parentId = 1,
parentName = "John Doe",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 6,
@@ -63,7 +72,7 @@ object SearchResultPreviewData {
entityType = "Savings",
parentId = 2,
parentName = "Jane Smith",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 7,
@@ -72,7 +81,7 @@ object SearchResultPreviewData {
entityType = "Center",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 8,
@@ -81,7 +90,7 @@ object SearchResultPreviewData {
entityType = "Center",
parentId = 7,
parentName = "Central Office",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 9,
@@ -90,7 +99,7 @@ object SearchResultPreviewData {
entityType = "Center",
parentId = 7,
parentName = "Central Office",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 10,
@@ -99,7 +108,7 @@ object SearchResultPreviewData {
entityType = "Loans",
parentId = 4,
parentName = "Bob Johnson",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 11,
@@ -108,7 +117,7 @@ object SearchResultPreviewData {
entityType = "Savings",
parentId = 4,
parentName = "Bob Johnson",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 12,
@@ -117,7 +126,7 @@ object SearchResultPreviewData {
entityType = "Clients",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 13,
@@ -126,7 +135,7 @@ object SearchResultPreviewData {
entityType = "Groups",
parentId = 0,
parentName = null,
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 14,
@@ -135,7 +144,7 @@ object SearchResultPreviewData {
entityType = "Loans",
parentId = 12,
parentName = "New Client",
- entityStatus = null
+ entityStatus = null,
),
SearchedEntity(
entityId = 15,
@@ -144,7 +153,7 @@ object SearchResultPreviewData {
entityType = "Savings",
parentId = 13,
parentName = "Small Group",
- entityStatus = null
- )
+ entityStatus = null,
+ ),
)
-}
\ No newline at end of file
+}
diff --git a/core/ui/src/main/res/drawable/core_ui_ic_centers_24dp.xml b/core/ui/src/main/res/drawable/core_ui_ic_centers_24dp.xml
index 0eeaea8898c..cf147af187f 100644
--- a/core/ui/src/main/res/drawable/core_ui_ic_centers_24dp.xml
+++ b/core/ui/src/main/res/drawable/core_ui_ic_centers_24dp.xml
@@ -1,3 +1,13 @@
+
+
+
+
+
#000000
\ No newline at end of file
diff --git a/core/ui/src/test/java/com/mifos/core/ui/ExampleUnitTest.kt b/core/ui/src/test/java/com/mifos/core/ui/ExampleUnitTest.kt
index 04e36c5d38a..69f6798a5c3 100644
--- a/core/ui/src/test/java/com/mifos/core/ui/ExampleUnitTest.kt
+++ b/core/ui/src/test/java/com/mifos/core/ui/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.core.ui
+import junit.framework.TestCase.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
+}