diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 437a985f291..e2f3e2ed1b0 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -172,7 +172,7 @@ complexity: LongParameterList: active: true # Updating Common values based on current scenario - functionThreshold: 20 #6 + functionThreshold: 30 #6 constructorThreshold: 30 #7 ignoreDefaultParameters: false ignoreDataClasses: true diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index d37192ab6a6..893d00f3286 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/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/designsystem/src/main/AndroidManifest.xml b/core/designsystem/src/main/AndroidManifest.xml index a5918e68abc..1dc76da0f7e 100644 --- a/core/designsystem/src/main/AndroidManifest.xml +++ b/core/designsystem/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/DrawingState.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/DrawingState.kt new file mode 100644 index 00000000000..d161fb3dd1c --- /dev/null +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/DrawingState.kt @@ -0,0 +1,46 @@ +/* + * 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 + */ +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.mutableStateListOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.snapshots.SnapshotStateList +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Path + +class DrawingState { + var usedColors: MutableState> = mutableStateOf(setOf()) + private set + var paths: SnapshotStateList = mutableStateListOf() + private set + var currentPath: MutableState = mutableStateOf(Path()) + private set + + fun addUsedColor(color: Color) { + usedColors.value = usedColors.value + color + } + + fun addPath(pathState: PathState) { + paths.add(pathState) + } + + fun updateCurrentPath(action: (Path) -> Unit) { + currentPath.value = currentPath.value.also(action) + } + + fun resetCurrentPath() { + currentPath.value = Path() + } +} + +data class PathState( + val path: Path, + val color: Color, + val stroke: Float, +) diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAlertDailog.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAlertDailog.kt index 93cdea9c50b..d43fcadd44c 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAlertDailog.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAlertDailog.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.designsystem.component import androidx.compose.foundation.clickable @@ -34,10 +43,10 @@ fun MifosDialogBox( showDialogState: Boolean, onDismiss: () -> Unit, title: Int, - message: Int? = null, confirmButtonText: Int, onConfirm: () -> Unit, - dismissButtonText: Int + dismissButtonText: Int, + message: Int? = null, ) { if (showDialogState) { AlertDialog( @@ -52,7 +61,7 @@ fun MifosDialogBox( TextButton( onClick = { onConfirm() - } + }, ) { Text(stringResource(id = confirmButtonText)) } @@ -61,12 +70,11 @@ fun MifosDialogBox( TextButton(onClick = onDismiss) { Text(stringResource(id = dismissButtonText)) } - } + }, ) } } - @Composable fun MifosRadioButtonDialog( titleResId: Int, @@ -74,17 +82,18 @@ fun MifosRadioButtonDialog( items: Array, selectItem: (item: String, index: Int) -> Unit, onDismissRequest: () -> Unit, + modifier: Modifier = Modifier, ) { Dialog( - onDismissRequest = { onDismissRequest.invoke() } + onDismissRequest = { onDismissRequest.invoke() }, ) { - Card { + Card(modifier = modifier) { Column(modifier = Modifier.padding(20.dp)) { Text(text = stringResource(id = titleResId)) LazyColumn( modifier = Modifier .fillMaxWidth() - .heightIn(max = 500.dp) + .heightIn(max = 500.dp), ) { itemsIndexed(items = items) { index, item -> Row( @@ -94,18 +103,18 @@ fun MifosRadioButtonDialog( onDismissRequest.invoke() selectItem.invoke(item, index) } - .fillMaxWidth() + .fillMaxWidth(), ) { RadioButton( selected = (item == selectedItem), onClick = { onDismissRequest.invoke() selectItem.invoke(item, index) - } + }, ) Text( text = item, - modifier = Modifier.padding(start = 4.dp) + modifier = Modifier.padding(start = 4.dp), ) } } @@ -120,17 +129,18 @@ fun UpdateEndpointDialogScreen( initialBaseURL: String?, initialTenant: String?, onDismissRequest: () -> Unit, - handleEndpointUpdate: (baseURL: String, tenant: String) -> Unit + handleEndpointUpdate: (baseURL: String, tenant: String) -> Unit, + modifier: Modifier = Modifier, ) { var baseURL by rememberSaveable { mutableStateOf(initialBaseURL) } var tenant by rememberSaveable { mutableStateOf(initialTenant) } Dialog( - onDismissRequest = { onDismissRequest.invoke() } + onDismissRequest = { onDismissRequest.invoke() }, ) { Card { Column( - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(20.dp), ) { @@ -141,7 +151,7 @@ fun UpdateEndpointDialogScreen( OutlinedTextField( value = it, onValueChange = { baseURL = it }, - label = { Text(text = stringResource(id = R.string.core_designsystem_enter_base_url)) } + label = { Text(text = stringResource(id = R.string.core_designsystem_enter_base_url)) }, ) } @@ -151,16 +161,17 @@ fun UpdateEndpointDialogScreen( OutlinedTextField( value = it, onValueChange = { tenant = it }, - label = { Text(text = stringResource(id = R.string.core_designsystem_enter_tenant)) } + label = { Text(text = stringResource(id = R.string.core_designsystem_enter_tenant)) }, ) } Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.End + horizontalArrangement = Arrangement.End, ) { TextButton( - onClick = { onDismissRequest.invoke() }) { + onClick = { onDismissRequest.invoke() }, + ) { Text(text = stringResource(id = R.string.core_designsystem_cancel)) } TextButton( @@ -168,13 +179,12 @@ fun UpdateEndpointDialogScreen( if (baseURL != null && tenant != null) { handleEndpointUpdate.invoke(baseURL ?: "", tenant ?: "") } - } - ) - { + }, + ) { Text(text = stringResource(id = R.string.core_designsystem_dialog_action_ok)) } } } } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAndroidClientIcon.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAndroidClientIcon.kt index 372fdf4a41d..b7a7364a20f 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAndroidClientIcon.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosAndroidClientIcon.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.designsystem.component import androidx.compose.foundation.Image @@ -12,12 +21,10 @@ import androidx.compose.ui.unit.dp */ @Composable -fun MifosAndroidClientIcon(id: Int) { - +fun MifosAndroidClientIcon(id: Int, modifier: Modifier = Modifier) { Image( painter = painterResource(id = id), contentDescription = null, - modifier = Modifier - .size(200.dp, 100.dp) + modifier = modifier.then(Modifier.size(200.dp, 100.dp)), ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosBottomSheet.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosBottomSheet.kt index 051081b9126..65fb8084b25 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosBottomSheet.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosBottomSheet.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 + */ @file:OptIn(ExperimentalMaterial3Api::class) package com.mifos.core.designsystem.component @@ -31,7 +40,6 @@ fun MifosBottomSheet( val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) var showBottomSheet by remember { mutableStateOf(true) } - fun dismissSheet() { coroutineScope.launch { modalSheetState.hide() }.invokeOnCompletion { if (!modalSheetState.isVisible) { @@ -73,4 +81,4 @@ fun MifosBottomSheetPreview() { }, {}, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosDrawingCanvas.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosDrawingCanvas.kt index b473be52be3..bcd3b1509d2 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosDrawingCanvas.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosDrawingCanvas.kt @@ -1,5 +1,16 @@ +/* + * 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.designsystem.component +import DrawingState +import PathState import android.view.MotionEvent import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.fillMaxSize @@ -12,27 +23,28 @@ import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.input.pointer.pointerInteropFilter -import com.mifos.core.designsystem.utility.PathState @ExperimentalComposeUiApi @Composable fun MifosDrawingCanvas( drawColor: Color, drawBrush: Float, - usedColors: MutableSet, - paths: MutableList + modifier: Modifier = Modifier, + drawingState: DrawingState = remember { DrawingState() }, ) { - val currentPath = paths.last().path val movePath = remember { mutableStateOf(null) } Canvas( - modifier = Modifier + modifier = modifier .fillMaxSize() .pointerInteropFilter { when (it.action) { MotionEvent.ACTION_DOWN -> { - currentPath.moveTo(it.x, it.y) - usedColors.add(drawColor) + drawingState.updateCurrentPath { path -> + path.moveTo(it.x, it.y) + } + drawingState.addUsedColor(drawColor) + drawingState.addPath(PathState(drawingState.currentPath.value, drawColor, drawBrush)) } MotionEvent.ACTION_MOVE -> { @@ -41,26 +53,29 @@ fun MifosDrawingCanvas( else -> { movePath.value = null + drawingState.resetCurrentPath() } } true - } + }, ) { movePath.value?.let { - currentPath.lineTo(it.x, it.y) + drawingState.updateCurrentPath { path -> + path.lineTo(it.x, it.y) + } drawPath( - path = currentPath, + path = drawingState.currentPath.value, color = drawColor, - style = Stroke(drawBrush) + style = Stroke(drawBrush), ) } - paths.forEach { + drawingState.paths.forEach { drawPath( path = it.path, - color = Color.Red, - style = Stroke(it.stroke) + color = it.color, + style = Stroke(it.stroke), ) } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEditTextField.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEditTextField.kt index edf4815dbe9..989190c5805 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEditTextField.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEditTextField.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.designsystem.component import androidx.compose.animation.AnimatedVisibility @@ -50,20 +59,20 @@ import com.mifos.core.designsystem.theme.White fun MifosOutlinedTextField( value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, + label: Int, + modifier: Modifier = Modifier, maxLines: Int = 1, singleLine: Boolean = true, icon: ImageVector? = null, - label: Int, visualTransformation: VisualTransformation = VisualTransformation.None, trailingIcon: @Composable (() -> Unit)? = null, - error: Int? + error: Int? = null, ) { - OutlinedTextField( value = value, onValueChange = onValueChange, label = { Text(stringResource(id = label)) }, - modifier = Modifier + modifier = modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp), leadingIcon = if (icon != null) { @@ -71,10 +80,12 @@ fun MifosOutlinedTextField( Icon( imageVector = icon, contentDescription = null, - tint = if (isSystemInDarkTheme()) White else DarkGray + tint = if (isSystemInDarkTheme()) White else DarkGray, ) } - } else null, + } else { + null + }, trailingIcon = trailingIcon, maxLines = maxLines, singleLine = singleLine, @@ -92,18 +103,18 @@ fun MifosOutlinedTextField( Text( modifier = Modifier.fillMaxWidth(), text = stringResource(id = error), - color = MaterialTheme.colorScheme.error + color = MaterialTheme.colorScheme.error, ) } - } + }, ) } @Composable fun MifosOutlinedTextField( - modifier: Modifier = Modifier, value: String, label: String, + modifier: Modifier = Modifier, leadingIcon: ImageVector? = null, maxLines: Int = 1, isError: Boolean = false, @@ -154,13 +165,13 @@ fun MifosOutlinedTextField( if (isPasswordToggleDisplayed) { PasswordToggleIcon( isPasswordVisible = isPasswordVisible, - onPasswordToggleClick = onPasswordToggleClick + onPasswordToggleClick = onPasswordToggleClick, ) } else if (showClearIcon && isFocused) { ClearIconButton( showClearIcon = true, clearIcon = clearIcon, - onClickClearIcon = onClickClearIcon + onClickClearIcon = onClickClearIcon, ) } else { trailingIcon?.invoke() @@ -206,21 +217,20 @@ fun MifosOutlinedTextField( @Composable fun MifosOutlinedTextField( - modifier: Modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp), value: String, onValueChange: (String) -> Unit, + label: String, + error: Int?, + modifier: Modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp), maxLines: Int = 1, - readOnly : Boolean = false, + readOnly: Boolean = false, singleLine: Boolean = true, icon: ImageVector? = null, - label: String, visualTransformation: VisualTransformation = VisualTransformation.None, trailingIcon: @Composable (() -> Unit)? = null, keyboardType: KeyboardType = KeyboardType.Text, - error: Int?, - enabled: Boolean = true + enabled: Boolean = true, ) { - OutlinedTextField( value = value, onValueChange = onValueChange, @@ -233,10 +243,12 @@ fun MifosOutlinedTextField( Icon( imageVector = icon, contentDescription = null, - tint = if (isSystemInDarkTheme()) White else DarkGray + tint = if (isSystemInDarkTheme()) White else DarkGray, ) } - } else null, + } else { + null + }, trailingIcon = trailingIcon, maxLines = maxLines, singleLine = singleLine, @@ -248,7 +260,7 @@ fun MifosOutlinedTextField( textStyle = LocalDensity.current.run { TextStyle(fontSize = 18.sp) }, - keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next,keyboardType = keyboardType), + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next, keyboardType = keyboardType), visualTransformation = visualTransformation, isError = error != null, supportingText = if (error != null) { @@ -256,20 +268,20 @@ fun MifosOutlinedTextField( Text( modifier = Modifier.fillMaxWidth(), text = stringResource(id = error), - color = MaterialTheme.colorScheme.error + color = MaterialTheme.colorScheme.error, ) } } else { null - } + }, ) } @Composable private fun PasswordToggleIcon( - modifier: Modifier = Modifier, isPasswordVisible: Boolean, - onPasswordToggleClick: (Boolean) -> Unit + modifier: Modifier = Modifier, + onPasswordToggleClick: (Boolean) -> Unit, ) { IconButton( onClick = { @@ -295,13 +307,13 @@ private fun PasswordToggleIcon( @Composable private fun ClearIconButton( - modifier: Modifier = Modifier, showClearIcon: Boolean, clearIcon: ImageVector, + modifier: Modifier = Modifier, onClickClearIcon: () -> Unit, ) { AnimatedVisibility( - visible = showClearIcon + visible = showClearIcon, ) { IconButton( onClick = onClickClearIcon, @@ -309,20 +321,19 @@ private fun ClearIconButton( ) { Icon( imageVector = clearIcon, - contentDescription = "trailingIcon" + contentDescription = "trailingIcon", ) } } - } @Composable fun MifosDatePickerTextField( - modifier: Modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp), value: String, + modifier: Modifier = Modifier.fillMaxWidth().padding(start = 16.dp, end = 16.dp), label: Int? = null, labelString: String? = null, - openDatePicker: () -> Unit + openDatePicker: () -> Unit, ) { OutlinedTextField( value = value, @@ -342,6 +353,6 @@ fun MifosDatePickerTextField( IconButton(onClick = { openDatePicker() }) { Icon(imageVector = Icons.Default.CalendarToday, null) } - } + }, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEmptyContent.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEmptyContent.kt index 780a1c8c6e8..f5f4d81b1dc 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEmptyContent.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosEmptyContent.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.designsystem.component import androidx.compose.foundation.layout.Arrangement @@ -15,20 +24,20 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp - @Composable fun MifosErrorContent( message: String, + modifier: Modifier = Modifier, isRefreshEnabled: Boolean = false, imageVector: ImageVector? = null, onRefresh: () -> Unit = {}, refreshButtonText: String = "", ) { Column( - modifier = Modifier.fillMaxSize(), + modifier = modifier + .fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { @@ -48,4 +57,4 @@ fun MifosErrorContent( } } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosMenuDropdown.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosMenuDropdown.kt index 3a4e14160de..231ed54faf3 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosMenuDropdown.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosMenuDropdown.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.designsystem.component import androidx.compose.foundation.layout.padding @@ -10,13 +19,20 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @Composable -fun MifosMenuDropDownItem(option: String, onClick: () -> Unit) { - DropdownMenuItem(text = { - Text( - modifier = Modifier.padding(6.dp), - text = option, style = TextStyle( - fontSize = 17.sp +fun MifosMenuDropDownItem( + option: String, + onClick: () -> Unit, + modifier: Modifier = Modifier, +) { + DropdownMenuItem( + text = { + Text( + modifier = Modifier.padding(6.dp), + text = option, + style = TextStyle(fontSize = 17.sp), ) - ) - }, onClick = { onClick() }) -} \ No newline at end of file + }, + onClick = { onClick() }, + modifier = modifier, + ) +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosPermissionBox.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosPermissionBox.kt index c4763c68e89..0d3cd1a0a97 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosPermissionBox.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosPermissionBox.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.designsystem.component import android.app.Activity @@ -24,9 +33,9 @@ import androidx.lifecycle.LifecycleEventObserver fun PermissionBox( requiredPermissions: List, title: Int, - description: Int? = null, confirmButtonText: Int, dismissButtonText: Int, + description: Int? = null, onGranted: @Composable (() -> Unit)? = null, ) { val context = LocalContext.current @@ -37,9 +46,9 @@ fun PermissionBox( requiredPermissions.all { ContextCompat.checkSelfPermission( context, - it + it, ) == PackageManager.PERMISSION_GRANTED - } + }, ) } @@ -47,7 +56,7 @@ fun PermissionBox( requiredPermissions.all { (context as? Activity)?.let { it1 -> ActivityCompat.shouldShowRequestPermissionRationale( - it1, it + it1, it, ) } == true } @@ -58,17 +67,21 @@ fun PermissionBox( val decideCurrentPermissionStatus: (Boolean, Boolean) -> String = { permissionGranted, shouldShowPermissionRationale -> - if (permissionGranted) "Granted" - else if (shouldShowPermissionRationale) "Rejected" - else "Denied" + if (permissionGranted) { + "Granted" + } else if (shouldShowPermissionRationale) { + "Rejected" + } else { + "Denied" + } } var currentPermissionStatus by remember { mutableStateOf( decideCurrentPermissionStatus( permissionGranted, - shouldShowPermissionRationale - ) + shouldShowPermissionRationale, + ), ) } @@ -85,7 +98,7 @@ fun PermissionBox( requiredPermissions.all { (context as? Activity)?.let { it1 -> ActivityCompat.shouldShowRequestPermissionRationale( - it1, it + it1, it, ) } == false } @@ -94,9 +107,10 @@ fun PermissionBox( !shouldShowPermissionRationale && !permissionGranted currentPermissionStatus = decideCurrentPermissionStatus( permissionGranted, - shouldShowPermissionRationale + shouldShowPermissionRationale, ) - }) + }, + ) DisposableEffect(key1 = lifecycleOwner, effect = { val observer = LifecycleEventObserver { _, event -> @@ -115,7 +129,7 @@ fun PermissionBox( if (shouldShowPermissionRationale) { MifosDialogBox( - showDialogState = shouldShowPermissionRationale, + showDialogState = shouldShowPermissionRationale, onDismiss = { shouldShowPermissionRationale = false }, title = title, message = description, @@ -124,22 +138,20 @@ fun PermissionBox( shouldShowPermissionRationale = false multiplePermissionLauncher.launch(requiredPermissions.toTypedArray()) }, - dismissButtonText = dismissButtonText + dismissButtonText = dismissButtonText, ) } if (shouldDirectUserToApplicationSettings) { Intent( Settings.ACTION_APPLICATION_DETAILS_SETTINGS, - Uri.fromParts("package", context.packageName, null) + Uri.fromParts("package", context.packageName, null), ).also { context.startActivity(it) } } if (permissionGranted) { - if (onGranted != null) { - onGranted() - } + onGranted?.invoke() } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosProgressIndicator.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosProgressIndicator.kt index 08b105d06b8..9b0d7a796c1 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosProgressIndicator.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosProgressIndicator.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.designsystem.component import androidx.compose.foundation.layout.Arrangement @@ -26,37 +35,37 @@ import com.mifos.core.designsystem.theme.DarkGray */ @Composable -fun MifosPagingAppendProgress() { +fun MifosPagingAppendProgress(modifier: Modifier = Modifier) { Box( - modifier = Modifier + modifier = modifier .fillMaxWidth() .wrapContentHeight(), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { CircularProgressIndicator( modifier = Modifier .width(40.dp) .height(40.dp) .padding(8.dp), - strokeWidth = 4.dp + strokeWidth = 4.dp, ) } - } @Preview(showBackground = true) @Composable fun MifosCircularProgress( - contentDesc: String = "loadingIndicator", modifier: Modifier = Modifier - .fillMaxSize() - .semantics { contentDescription = contentDesc }, - text: String? = null + .fillMaxSize(), + contentDesc: String = "loadingIndicator", + text: String? = null, ) { + val resolvedModifier = modifier.semantics { contentDescription = contentDesc } + Column( - modifier = modifier, + modifier = resolvedModifier, horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center + verticalArrangement = Arrangement.Center, ) { CircularProgressIndicator( modifier = Modifier @@ -65,11 +74,10 @@ fun MifosCircularProgress( .height(60.dp) .padding(8.dp), strokeWidth = 4.dp, - color = DarkGray + color = DarkGray, ) text?.let { Text(text = text) } } - -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosScaffold.kt index 49090830388..62bbb00f94c 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosScaffold.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 + */ @file:OptIn(ExperimentalMaterial3Api::class) package com.mifos.core.designsystem.component @@ -31,19 +40,18 @@ import com.mifos.core.designsystem.theme.White @OptIn(ExperimentalMaterial3Api::class) @Composable fun MifosScaffold( + snackbarHostState: SnackbarHostState?, modifier: Modifier = Modifier, isAppBarPresent: Boolean = true, icon: ImageVector? = null, title: String? = null, - fontsizeInSp : Int = 24, + fontsizeInSp: Int = 24, onBackPressed: () -> Unit = {}, actions: @Composable () -> Unit = {}, - snackbarHostState: SnackbarHostState?, bottomBar: @Composable () -> Unit = {}, floatingActionButton: @Composable () -> Unit = {}, - content: @Composable (PaddingValues) -> Unit + content: @Composable (PaddingValues) -> Unit, ) { - Scaffold( modifier = modifier, topBar = { @@ -70,21 +78,21 @@ fun MifosScaffold( style = TextStyle( fontSize = fontsizeInSp.sp, fontWeight = FontWeight.Medium, - fontStyle = FontStyle.Normal + fontStyle = FontStyle.Normal, ), color = Black, - textAlign = TextAlign.Start + textAlign = TextAlign.Start, ) } }, - actions = { actions() } + actions = { actions() }, ) } }, snackbarHost = { snackbarHostState?.let { SnackbarHost(it) } }, containerColor = White, bottomBar = bottomBar, - floatingActionButton = floatingActionButton + floatingActionButton = floatingActionButton, ) { padding -> content(padding) } @@ -100,7 +108,7 @@ fun MifosScaffold( floatingActionButtonPosition: FabPosition = FabPosition.End, containerColor: Color = Color.White, contentColor: Color = contentColorFor(containerColor), - content: @Composable (PaddingValues) -> Unit + content: @Composable (PaddingValues) -> Unit, ) { Scaffold( modifier = modifier, @@ -111,8 +119,8 @@ fun MifosScaffold( bottomBar = bottomBar, containerColor = containerColor, contentColor = contentColor, - contentWindowInsets = WindowInsets(0, 0, 0, 0) + contentWindowInsets = WindowInsets(0, 0, 0, 0), ) { padding -> content(padding) } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosSweetError.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosSweetError.kt index 5298a2e563c..c4566bc160b 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosSweetError.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosSweetError.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.designsystem.component import androidx.compose.foundation.isSystemInDarkTheme @@ -37,25 +46,25 @@ import com.mifos.core.designsystem.theme.DarkGray @Composable fun MifosSweetError( + message: String, modifier: Modifier = Modifier .fillMaxSize() .padding(18.dp) .semantics { contentDescription = "MifosSweetError" }, - message: String, isRetryEnabled: Boolean = true, buttonText: String = stringResource(id = R.string.core_designsystem_try_again), - onclick: () -> Unit = {} + onclick: () -> Unit = {}, ) { Column( modifier = modifier, verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { AsyncImage( modifier = Modifier.size(70.dp), model = R.drawable.core_designsystem_ic_error_black_24dp, contentDescription = null, - colorFilter = ColorFilter.tint(Color.Gray) + colorFilter = ColorFilter.tint(Color.Gray), ) Spacer(modifier = Modifier.height(20.dp)) Text( @@ -64,8 +73,8 @@ fun MifosSweetError( fontSize = 14.sp, fontWeight = FontWeight.Normal, fontStyle = FontStyle.Normal, - color = DarkGray - ) + color = DarkGray, + ), ) Text( text = message, @@ -73,8 +82,8 @@ fun MifosSweetError( fontSize = 14.sp, fontWeight = FontWeight.Normal, fontStyle = FontStyle.Normal, - color = DarkGray - ) + color = DarkGray, + ), ) if (isRetryEnabled) { Spacer(modifier = Modifier.height(20.dp)) @@ -82,36 +91,35 @@ fun MifosSweetError( onClick = { onclick() }, contentPadding = PaddingValues(), colors = ButtonDefaults.buttonColors( - containerColor = if (isSystemInDarkTheme()) BluePrimaryDark else BluePrimary - ) + containerColor = if (isSystemInDarkTheme()) BluePrimaryDark else BluePrimary, + ), ) { Text( modifier = Modifier.padding(start = 20.dp, end = 20.dp), text = buttonText, - fontSize = 15.sp + fontSize = 15.sp, ) } } } } - @Composable fun MifosPaginationSweetError( modifier: Modifier = Modifier, - onclick: () -> Unit + onclick: () -> Unit, ) { Column( modifier = modifier .fillMaxWidth() .padding(18.dp), verticalArrangement = Arrangement.spacedBy(4.dp), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Icon( imageVector = Icons.Default.Info, contentDescription = "Info Image", - tint = Color.Gray + tint = Color.Gray, ) Text( text = stringResource(id = R.string.core_designsystem_unable_to_load), @@ -119,22 +127,22 @@ fun MifosPaginationSweetError( fontSize = 14.sp, fontWeight = FontWeight.Normal, fontStyle = FontStyle.Normal, - color = DarkGray - ) + color = DarkGray, + ), ) Button( onClick = { onclick() }, contentPadding = PaddingValues(), colors = ButtonDefaults.buttonColors( - containerColor = if (isSystemInDarkTheme()) BluePrimaryDark else BluePrimary - ) + containerColor = if (isSystemInDarkTheme()) BluePrimaryDark else BluePrimary, + ), ) { Text( modifier = Modifier .padding(start = 20.dp, end = 20.dp), text = stringResource(id = R.string.core_designsystem_try_again), - fontSize = 15.sp + fontSize = 15.sp, ) } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTabRow.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTabRow.kt index a173bb67995..6b6e6916cdb 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTabRow.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTabRow.kt @@ -1,8 +1,19 @@ +/* + * 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 + */ @file:OptIn(ExperimentalFoundationApi::class) package com.mifos.core.designsystem.component import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.PagerState import androidx.compose.material3.Tab @@ -23,35 +34,37 @@ fun MifosTabRow( modifier: Modifier = Modifier, containerColor: Color = Color.White, selectedContentColor: Color = BluePrimary, - unselectedContentColor: Color = Color.LightGray + unselectedContentColor: Color = Color.LightGray, ) { val scope = rememberCoroutineScope() - TabRow( - containerColor = containerColor, - selectedTabIndex = pagerState.currentPage, - indicator = {}, - divider = {}, - ) { - tabContents.forEachIndexed { index, currentTab -> - Tab( - text = { Text(text = currentTab.tabName) }, - selected = pagerState.currentPage == index, - selectedContentColor = selectedContentColor, - unselectedContentColor = unselectedContentColor, - onClick = { - scope.launch { - pagerState.animateScrollToPage(index) - } - } - ) + Column(modifier = modifier) { + TabRow( + containerColor = containerColor, + selectedTabIndex = pagerState.currentPage, + indicator = {}, + divider = {}, + ) { + tabContents.forEachIndexed { index, currentTab -> + Tab( + text = { Text(text = currentTab.tabName) }, + selected = pagerState.currentPage == index, + selectedContentColor = selectedContentColor, + unselectedContentColor = unselectedContentColor, + onClick = { + scope.launch { + pagerState.animateScrollToPage(index) + } + }, + ) + } } - } - HorizontalPager( - state = pagerState, - modifier = modifier - ) { page -> - tabContents.getOrNull(page)?.content?.invoke() ?: Text("Page $page") + HorizontalPager( + state = pagerState, + modifier = Modifier.fillMaxSize(), + ) { page -> + tabContents.getOrNull(page)?.content?.invoke() ?: Text("Page $page") + } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTextFieldDropdown.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTextFieldDropdown.kt index b9704087ba5..3865a01cb65 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTextFieldDropdown.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/component/MifosTextFieldDropdown.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 + */ @file:OptIn(ExperimentalMaterial3Api::class) package com.mifos.core.designsystem.component @@ -30,22 +39,22 @@ import com.mifos.core.designsystem.theme.BluePrimaryDark @Composable fun MifosTextFieldDropdown( - modifier: Modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp), value: String, onValueChanged: (String) -> Unit, onOptionSelected: (Int, String) -> Unit, + options: List, + modifier: Modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp), label: Int? = null, labelString: String? = null, - options: List, - readOnly: Boolean = false + readOnly: Boolean = false, ) { var isExpended by remember { mutableStateOf(false) } ExposedDropdownMenuBox( expanded = isExpended, - onExpandedChange = { isExpended = it } + onExpandedChange = { isExpended = it }, ) { OutlinedTextField( value = value, @@ -64,12 +73,12 @@ fun MifosTextFieldDropdown( trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(isExpended) }, - readOnly = readOnly + readOnly = readOnly, ) ExposedDropdownMenu( expanded = isExpended, - onDismissRequest = { isExpended = false } + onDismissRequest = { isExpended = false }, ) { options.forEachIndexed { index, value -> DropdownMenuItem( @@ -77,9 +86,9 @@ fun MifosTextFieldDropdown( onClick = { isExpended = false onOptionSelected(index, value) - } + }, ) } } } -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcons.kt similarity index 90% rename from core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt rename to core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcons.kt index a13d758c1ab..78bd2e26c10 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcons.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.designsystem.icon import androidx.compose.material.icons.Icons @@ -60,4 +69,4 @@ object MifosIcons { val gallery = Icons.Filled.Image val ArrowDropDown = Icons.Default.ArrowDropDown val assignmentTurnedIn = Icons.Default.AssignmentTurnedIn -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Color.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Color.kt index 34932289d9b..6df456f2c0c 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Color.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Color.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.designsystem.theme import androidx.compose.ui.graphics.Color @@ -10,4 +19,4 @@ val BluePrimary = Color(0xFF2D5BA8) val BluePrimaryDark = Color(0xFF9BB1E3) val BlueSecondary = Color(0xFFD7E2FC) val LightGreen = Color(0xFF99CC00) -val SummerSky = Color(0xFF29B6F6) \ No newline at end of file +val SummerSky = Color(0xFF29B6F6) diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/MifosTextStyle.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/MifosTextStyle.kt index 4eb93b33aa2..181291048bb 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/MifosTextStyle.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/MifosTextStyle.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.designsystem.theme import androidx.compose.ui.graphics.Color @@ -10,26 +19,26 @@ val aboutItemTextStyle = TextStyle( color = Color.Black, textAlign = TextAlign.Center, fontSize = 16.sp, - fontWeight = FontWeight.Normal + fontWeight = FontWeight.Normal, ) val aboutItemTextStyleBold = TextStyle( color = Color.Black, textAlign = TextAlign.Center, fontSize = 24.sp, - fontWeight = FontWeight.SemiBold + fontWeight = FontWeight.SemiBold, ) val identifierTextStyleDark = TextStyle( color = Color.Black, textAlign = TextAlign.Start, fontSize = 16.sp, - fontWeight = FontWeight.Normal + fontWeight = FontWeight.Normal, ) val identifierTextStyleLight = TextStyle( color = DarkGray, textAlign = TextAlign.Start, fontSize = 16.sp, - fontWeight = FontWeight.Normal -) \ No newline at end of file + fontWeight = FontWeight.Normal, +) diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Theme.kt index 268df5e15e8..6a1f86c35bf 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Theme.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/theme/Theme.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.designsystem.theme import androidx.compose.foundation.isSystemInDarkTheme @@ -15,7 +24,7 @@ private val LightThemeColors = lightColorScheme( onSurface = BlueSecondary, onSecondary = Color.Gray, outlineVariant = Color.Gray, - surfaceTint = BlueSecondary + surfaceTint = BlueSecondary, ) private val DarkThemeColors = darkColorScheme( @@ -28,7 +37,7 @@ private val DarkThemeColors = darkColorScheme( onSurface = Color.White, onSecondary = Color.White, outlineVariant = Color.White, - surfaceTint = BlueSecondary + surfaceTint = BlueSecondary, ) @Composable @@ -43,6 +52,6 @@ fun MifosTheme( MaterialTheme( colorScheme = colors, - content = content + content = content, ) -} \ No newline at end of file +} diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/PathState.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/PathState.kt index 13e0d2a72ae..108241ee99a 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/PathState.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/PathState.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.designsystem.utility import androidx.compose.ui.graphics.Color @@ -6,5 +15,5 @@ import androidx.compose.ui.graphics.Path data class PathState( val path: Path, val color: Color, - val stroke: Float -) \ No newline at end of file + val stroke: Float, +) diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/TabContent.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/TabContent.kt index b97e1a0bd39..84e365ea2ac 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/TabContent.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/utility/TabContent.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.designsystem.utility import androidx.compose.runtime.Composable @@ -6,5 +15,5 @@ data class TabContent( val tabName: String, - val content: @Composable () -> Unit + val content: @Composable () -> Unit, ) diff --git a/core/designsystem/src/main/res/drawable/core_designsystem_ic_error_black_24dp.xml b/core/designsystem/src/main/res/drawable/core_designsystem_ic_error_black_24dp.xml index 05baa0e6e5d..31f93c3e109 100644 --- a/core/designsystem/src/main/res/drawable/core_designsystem_ic_error_black_24dp.xml +++ b/core/designsystem/src/main/res/drawable/core_designsystem_ic_error_black_24dp.xml @@ -1,3 +1,13 @@ + + + Sorry we weren\'t able to load Try Again diff --git a/core/designsystem/src/test/java/com/mifos/core/designsystem/ExampleUnitTest.kt b/core/designsystem/src/test/java/com/mifos/core/designsystem/ExampleUnitTest.kt index 60d09e156c2..ced7220e880 100644 --- a/core/designsystem/src/test/java/com/mifos/core/designsystem/ExampleUnitTest.kt +++ b/core/designsystem/src/test/java/com/mifos/core/designsystem/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.designsystem +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 +}