Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Image and ActionableButton Widget to add ability to copy text #3040

Merged
merged 25 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8dd2984
Enhance Actionable Button to add ability to copy text
SebaMutuku Feb 6, 2024
b653da5
Remove unnecessary icon
SebaMutuku Feb 6, 2024
37f8b56
Run spotlessApply
SebaMutuku Feb 6, 2024
ffdad0f
Remove context as param from Composable function
SebaMutuku Feb 6, 2024
bae78d8
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
SebaMutuku Feb 6, 2024
889926a
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
pld Feb 6, 2024
23e2cab
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
SebaMutuku Feb 8, 2024
4028f40
Refactor Image Widget to enable on click
SebaMutuku Feb 8, 2024
0d9565f
Merge branch 'fix_issue_3033_add_copy_text_widget' of github.com:open…
SebaMutuku Feb 8, 2024
0e97195
Remove unnecessary ActionableButton previews
SebaMutuku Feb 8, 2024
84182ef
Add text property
SebaMutuku Feb 8, 2024
5723b56
Run spotlessApply
SebaMutuku Feb 8, 2024
43fcd0f
Fix failing tests and add test to confirm toast is shown
SebaMutuku Feb 9, 2024
e70a605
Run spotlessApply
SebaMutuku Feb 9, 2024
870e97a
Add text color
SebaMutuku Feb 12, 2024
a6ac600
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
pld Feb 12, 2024
fc5091d
Update button as per design requirements
SebaMutuku Feb 13, 2024
e0d88fa
Merge branch 'fix_issue_3033_add_copy_text_widget' of github.com:open…
SebaMutuku Feb 13, 2024
e2b9fb6
Add condition when clicking an image
SebaMutuku Feb 13, 2024
90e5857
Run spotlessApply on Image.kt
SebaMutuku Feb 13, 2024
2d956e9
Add docs for Copy data on actionable button
SebaMutuku Feb 14, 2024
ec0c421
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
SebaMutuku Feb 16, 2024
815aab9
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
SebaMutuku Feb 19, 2024
1658100
Add tests for ConfigurationRegistry.writeFile()
SebaMutuku Feb 20, 2024
eb48629
Merge branch 'main' into fix_issue_3033_add_copy_text_widget
SebaMutuku Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

init {
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
Process.killProcess(Process.myPid())

Check warning on line 112 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L112

Added line #L112 was not covered by tests
}
}

Expand Down Expand Up @@ -343,8 +343,8 @@
try {
val configBinary = fhirEngine.get<Binary>(extractedId)
configsJsonMap[configIdentifier] = configBinary.content.decodeToString()
} catch (resourceNotFoundException: ResourceNotFoundException) {
Timber.e("Missing Binary file with ID :$extractedId")

Check warning on line 347 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L346-L347

Added lines #L346 - L347 were not covered by tests
withContext(dispatcherProvider.main()) { configsLoadedCallback(false) }
}
}
Expand Down Expand Up @@ -416,7 +416,7 @@
} // is focus.identifier a necessary check
.groupBy { section ->
section.focus.reference.substringBefore(
ConfigurationRegistry.TYPE_REFERENCE_DELIMITER,
TYPE_REFERENCE_DELIMITER,
missingDelimiterValue = "",
)
}
Expand All @@ -428,16 +428,16 @@
patientRelatedResourceTypes = patientRelatedResourceTypes,
)
} else {
val chunkedResourceIdList = entry.value.chunked(MANIFEST_PROCESSOR_BATCH_SIZE)

Check warning on line 431 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L431

Added line #L431 was not covered by tests

chunkedResourceIdList.forEach { parentIt ->
Timber.d(
"Fetching config resource ${entry.key}: with ids ${StringUtils.join(parentIt,",")}",

Check warning on line 435 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L433-L435

Added lines #L433 - L435 were not covered by tests
)
processCompositionManifestResources(
entry.key,
parentIt.map { sectionComponent -> sectionComponent.focus.extractId() },
patientRelatedResourceTypes,

Check warning on line 440 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L438-L440

Added lines #L438 - L440 were not covered by tests
)
}
}
Expand Down Expand Up @@ -477,11 +477,11 @@
if (isNonProxy()) {
fhirResourceDataSourceGetBundle(resourceType, resourceIdList)
} else
fhirResourceDataSource.post(

Check warning on line 480 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L480

Added line #L480 was not covered by tests
requestBody =
generateRequestBundle(resourceType, resourceIdList)
.encodeResourceToString()
.toRequestBody(NetworkModule.JSON_MEDIA_TYPE),

Check warning on line 484 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L482-L484

Added lines #L482 - L484 were not covered by tests
)

processResultBundleEntries(resultBundle, patientRelatedResourceTypes)
Expand Down Expand Up @@ -528,8 +528,8 @@
}
}
is Binary -> {
val binary = bundleEntryComponent.resource as Binary
processResultBundleBinaries(binary, patientRelatedResourceTypes)

Check warning on line 532 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L531-L532

Added lines #L531 - L532 were not covered by tests
addOrUpdate(bundleEntryComponent.resource)
}
else -> {
Expand Down Expand Up @@ -576,33 +576,33 @@
*/
try {
if (resource is MetadataResource && resource.name != null) {
knowledgeManager.install(
writeToFile(resource.overwriteCanonicalURL()),

Check warning on line 580 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L579-L580

Added lines #L579 - L580 were not covered by tests
)
}
} catch (exception: Exception) {
Timber.e(exception)

Check warning on line 584 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L583-L584

Added lines #L583 - L584 were not covered by tests
}
}
}

private fun MetadataResource.overwriteCanonicalURL() =
this.apply {
url =

Check warning on line 591 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L590-L591

Added lines #L590 - L591 were not covered by tests
url
?: "${openSrpApplication?.getFhirServerHost().toString()?.trimEnd { it == '/' }}/${this.referenceValue()}"
}

private fun writeToFile(resource: Resource): File {
val fileName =

Check warning on line 597 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L597

Added line #L597 was not covered by tests
if (resource is MetadataResource && resource.name != null) {
resource.name

Check warning on line 599 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L599

Added line #L599 was not covered by tests
} else {
resource.idElement.idPart

Check warning on line 601 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L601

Added line #L601 was not covered by tests
}

return File(context.filesDir, "$fileName.json").apply {
writeText(jsonParser.encodeResourceToString(resource))

Check warning on line 605 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L604-L605

Added lines #L604 - L605 were not covered by tests
}
}

Expand Down Expand Up @@ -630,11 +630,11 @@
}

private fun generateRequestBundle(resourceType: String, idList: List<String>): Bundle {
val bundleEntryComponents = mutableListOf<Bundle.BundleEntryComponent>()

Check warning on line 633 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L633

Added line #L633 was not covered by tests

idList.forEach {
bundleEntryComponents.add(
Bundle.BundleEntryComponent().apply {

Check warning on line 637 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L637

Added line #L637 was not covered by tests
request =
Bundle.BundleEntryRequestComponent().apply {
url = "$resourceType/$it"
Expand Down Expand Up @@ -671,7 +671,7 @@
}
}

fun clearConfigsCache() = configCacheMap.clear()

Check warning on line 674 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L674

Added line #L674 was not covered by tests

private suspend fun processCompositionListResources(
resourceGroup:
Expand Down Expand Up @@ -724,13 +724,13 @@
}

private fun FhirResourceConfig.dependentResourceTypes(target: MutableList<ResourceType>) {
this.baseResource.dependentResourceTypes(target)
this.relatedResources.forEach { it.dependentResourceTypes(target) }

Check warning on line 728 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L727-L728

Added lines #L727 - L728 were not covered by tests
}

private fun ResourceConfig.dependentResourceTypes(target: MutableList<ResourceType>) {
target.add(resource)
relatedResources.forEach { it.dependentResourceTypes(target) }

Check warning on line 733 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L732-L733

Added lines #L732 - L733 were not covered by tests
}

fun processResultBundleBinaries(
Expand All @@ -738,17 +738,17 @@
patientRelatedResourceTypes: MutableList<ResourceType>,
) {
binary.data.decodeToString().decodeBase64()?.string(StandardCharsets.UTF_8)?.let {
val config =

Check warning on line 741 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L741

Added line #L741 was not covered by tests
it.tryDecodeJson<RegisterConfiguration>() ?: it.tryDecodeJson<ProfileConfiguration>()

when (config) {

Check warning on line 744 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L744

Added line #L744 was not covered by tests
is RegisterConfiguration ->
config.fhirResource.dependentResourceTypes(
patientRelatedResourceTypes,

Check warning on line 747 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L746-L747

Added lines #L746 - L747 were not covered by tests
)
is ProfileConfiguration ->
config.fhirResource.dependentResourceTypes(
patientRelatedResourceTypes,

Check warning on line 751 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/ConfigurationRegistry.kt#L750-L751

Added lines #L750 - L751 were not covered by tests
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ data class NavigationMenuConfig(
data class ImageConfig(
val type: String = ICON_TYPE_LOCAL,
val reference: String? = null,
val color: String? = null,
@Contextual var decodedBitmap: Bitmap? = null,
) : Parcelable, java.io.Serializable {
fun interpolate(computedValuesMap: Map<String, Any>): ImageConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.graphics.Shape
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
import org.smartregister.fhircore.engine.configuration.navigation.ImageConfig
import org.smartregister.fhircore.engine.domain.model.ActionConfig
import org.smartregister.fhircore.engine.domain.model.ViewType
import org.smartregister.fhircore.engine.util.extension.interpolate

Expand All @@ -40,9 +41,12 @@ data class ImageProperties(
override val clickable: String = "false",
override val visible: String = "true",
val tint: String? = null,
val text: String? = null,
val imageConfig: ImageConfig? = null,
val size: Int? = null,
val shape: ImageShape? = null,
val textColor: String? = null,
val actions: List<ActionConfig> = emptyList(),
) : ViewProperties(), Parcelable {
override fun interpolate(computedValuesMap: Map<String, Any>): ViewProperties {
return this.copy(
Expand All @@ -53,6 +57,7 @@ data class ImageProperties(
),
tint = this.tint?.interpolate(computedValuesMap),
backgroundColor = this.backgroundColor?.interpolate(computedValuesMap),
text = this.text?.interpolate(computedValuesMap),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@
CHANGE_MANAGING_ENTITY,

/** A workflow that launches the dialer with the phone number ready to place a call */
LAUNCH_DIALLER,

Check warning on line 52 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt#L52

Added line #L52 was not covered by tests

/** A workflow that launches user insight screen */
LAUNCH_INSIGHT_SCREEN,

Check warning on line 55 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt#L55

Added line #L55 was not covered by tests

/** A workflow that copies text to keyboard */
COPY_TEXT,

Check warning on line 58 in android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt

View check run for this annotation

Codecov / codecov/patch

android/engine/src/main/java/org/smartregister/fhircore/engine/configuration/workflow/ApplicationWorkflow.kt#L58

Added line #L58 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.unit.dp
import androidx.navigation.testing.TestNavHostController
import androidx.test.core.app.ApplicationProvider
import org.hl7.fhir.r4.model.ResourceType
import org.junit.Rule
import org.junit.Test
Expand All @@ -43,7 +42,6 @@ import org.smartregister.fhircore.quest.ui.shared.components.ActionableButton

class ActionableButtonTest {
@get:Rule val composeRule = createComposeRule()
private val navController = TestNavHostController(ApplicationProvider.getApplicationContext())

@Test
fun testActionableButtonRendersAncClickWorksCorrectlyWithStatusDue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,19 @@ class ViewGeneratorTest {
fun testImageIsRenderedFromLocalAsset() {
composeRule.setContent {
GenerateView(
properties = ImageProperties(imageConfig = ImageConfig(ICON_TYPE_LOCAL, "ic_walk")),
properties =
ImageProperties(
imageConfig = ImageConfig(ICON_TYPE_LOCAL, "ic_walk", color = "#FFF000"),
text = "Copy text",
),
resourceData = resourceData,
navController = TestNavHostController(LocalContext.current),
)
}
composeRule.onNodeWithTag(SIDE_MENU_ITEM_LOCAL_ICON_TEST_TAG).assertExists().assertIsDisplayed()
composeRule
.onNodeWithTag(SIDE_MENU_ITEM_LOCAL_ICON_TEST_TAG, useUnmergedTree = true)
.assertExists()
.assertIsDisplayed()
}

@Test
Expand All @@ -375,7 +382,7 @@ class ViewGeneratorTest {
)
}
composeRule
.onNodeWithTag(SIDE_MENU_ITEM_REMOTE_ICON_TEST_TAG)
.onNodeWithTag(SIDE_MENU_ITEM_REMOTE_ICON_TEST_TAG, useUnmergedTree = true)
.assertExists()
.assertIsDisplayed()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ constructor(
val workManager: WorkManager,
val fhirCarePlanGenerator: FhirCarePlanGenerator,
) : ViewModel() {

val appMainUiState: MutableState<AppMainUiState> =
mutableStateOf(
appMainUiStateOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ private fun SideMenuItem(
paddingEnd = 10,
imageProperties = ImageProperties(imageConfig = imageConfig, size = 32),
tint = MenuItemColor,
navController = rememberNavController(),
)
SideMenuItemText(title = title, textColor = Color.White)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ private fun ProfileTopAppBarMenuAction(
Image(
imageProperties = ImageProperties(imageConfig = overflowMenuItemConfig.icon),
tint = contentColor,
navController = navController,
resourceData = profileUiState.resourceData!!,
)
if (overflowMenuItemConfig.icon != null) Spacer(modifier = Modifier.width(4.dp))
Text(text = overflowMenuItemConfig.title, color = contentColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class RegisterFragment : Fragment(), OnSyncListener {
.collectAsState(emptyFlow())
.value
.collectAsLazyPagingItems()

// Register screen provides access to the side navigation
Scaffold(
drawerGesturesEnabled = scaffoldState.drawerState.isOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.compose.material.icons.filled.Check
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -80,6 +81,7 @@ fun ActionableButton(
val clickable = buttonProperties.clickable.toBoolean()
val backgroundOpacity = buttonProperties.backgroundOpacity
val colorOpacity = buttonProperties.colorOpacity
val context = LocalContext.current
OutlinedButton(
onClick = {
if (
Expand All @@ -89,6 +91,7 @@ fun ActionableButton(
buttonProperties.actions.handleClickEvent(
navController = navController,
resourceData = resourceData,
context = context,
)
}
},
Expand Down Expand Up @@ -154,6 +157,8 @@ fun ActionableButton(
Image(
imageProperties = ImageProperties(imageConfig = buttonProperties.startIcon, size = 16),
tint = iconTintColor,
resourceData = resourceData,
navController = navController,
)
} else {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,55 +51,58 @@ fun CardView(
resourceData: ResourceData,
navController: NavController,
) {
val headerActionVisible = viewProperties.headerAction?.visible.toBoolean()
Column(modifier = modifier.background(viewProperties.headerBackgroundColor.parseColor())) {
// Header section
Row(
modifier =
modifier
.fillMaxWidth()
.conditional(viewProperties.header != null, { padding(top = 24.dp, bottom = 8.dp) }),
verticalAlignment = Alignment.Top,
horizontalArrangement = Arrangement.SpaceBetween,
) {
if (viewProperties.header != null) {
CompoundText(
modifier =
modifier
.conditional(headerActionVisible, { weight(if (headerActionVisible) 0.6f else 1f) })
.wrapContentWidth(Alignment.Start),
compoundTextProperties = viewProperties.header!!.copy(textCase = TextCase.UPPER_CASE),
resourceData = resourceData,
navController = navController,
)
if (viewProperties.headerAction != null && headerActionVisible) {
// Check if card is visible
if (viewProperties.visible.toBoolean()) {
val headerActionVisible = viewProperties.headerAction?.visible.toBoolean()
Column(modifier = modifier.background(viewProperties.headerBackgroundColor.parseColor())) {
// Header section
Row(
modifier =
modifier
.fillMaxWidth()
.conditional(viewProperties.header != null, { padding(top = 24.dp, bottom = 8.dp) }),
verticalAlignment = Alignment.Top,
horizontalArrangement = Arrangement.SpaceBetween,
) {
if (viewProperties.header != null) {
CompoundText(
modifier = modifier.wrapContentWidth(Alignment.End).weight(0.4f),
compoundTextProperties = viewProperties.headerAction!!,
modifier =
modifier
.conditional(headerActionVisible, { weight(if (headerActionVisible) 0.6f else 1f) })
.wrapContentWidth(Alignment.Start),
compoundTextProperties = viewProperties.header!!.copy(textCase = TextCase.UPPER_CASE),
resourceData = resourceData,
navController = navController,
)
if (viewProperties.headerAction != null && headerActionVisible) {
CompoundText(
modifier = modifier.wrapContentWidth(Alignment.End).weight(0.4f),
compoundTextProperties = viewProperties.headerAction!!,
resourceData = resourceData,
navController = navController,
)
}
}
}
}
// Card section
Card(
elevation = viewProperties.elevation.dp,
modifier =
modifier
.padding(
start = viewProperties.padding.dp,
end = viewProperties.padding.dp,
// Card section
Card(
elevation = viewProperties.elevation.dp,
modifier =
modifier
.padding(
start = viewProperties.padding.dp,
end = viewProperties.padding.dp,
)
.fillMaxWidth()
.clip(RoundedCornerShape(viewProperties.cornerSize.dp)),
) {
Column(modifier = modifier.padding(viewProperties.contentPadding.dp)) {
ViewRenderer(
viewProperties = viewProperties.content,
resourceData = resourceData,
navController = navController,
)
.fillMaxWidth()
.clip(RoundedCornerShape(viewProperties.cornerSize.dp)),
) {
Column(modifier = modifier.padding(viewProperties.contentPadding.dp)) {
ViewRenderer(
viewProperties = viewProperties.content,
resourceData = resourceData,
navController = navController,
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ fun ExtendedFab(
modifier = modifier.testTag(FAB_BUTTON_ROW_ICON_TEST_TAG),
imageProperties = ImageProperties(imageConfig = firstMenuIconConfig),
tint = if (firstFabEnabled) Color.White else DefaultColor,
navController = navController,
resourceData = resourceData!!,
)
}
if (text.isNotEmpty()) {
Expand Down
Loading
Loading