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

fixed color of action button #342

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -3,6 +3,7 @@ package com.alfresco.content.process.ui.components
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlaylistAdd
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.FloatingActionButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -11,6 +12,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.airbnb.mvrx.compose.collectAsState
import com.alfresco.content.component.ComponentBuilder
import com.alfresco.content.component.ComponentData
Expand Down Expand Up @@ -57,8 +59,14 @@ fun FloatingActionButton(outcomes: List<OptionsModel>, fragment: ProcessFragment
.show()
}
},
containerColor = MaterialTheme.colorScheme.primary,
containerColor = if (state.enabledOutcomes) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
icon = { Icon(Icons.Filled.PlaylistAdd, stringResource(id = R.string.accessibility_process_actions), tint = Color.White) },
text = { Text(text = stringResource(id = R.string.title_actions), color = Color.White) },
elevation = FloatingActionButtonDefaults.elevation(
defaultElevation = 0.dp,
pressedElevation = 0.dp,
focusedElevation = 0.dp,
hoveredElevation = 0.dp,
),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,12 @@ class FormViewModel(
requireNotNull(state.parent)
viewModelScope.launch {
repository::actionOutcomes.asFlow(
outcome, state.parent.taskEntry,
outcome,
state.parent.taskEntry,
convertFieldsToValues(
state.formFields
.filter { it.type !in listOf(FieldType.READONLY.value(), FieldType.READONLY_TEXT.value()) },
)
),
).execute {
when (it) {
is Loading -> copy(requestOutcomes = Loading())
Expand Down Expand Up @@ -542,8 +543,10 @@ class FormViewModel(

private fun hasFieldValidData(fields: List<FieldsData>): Boolean {
val hasValidDataInRequiredFields = !fields.filter { it.required }.any { (it.value == null || it.errorData.first) }
val hasValidDataInDropDownRequiredFields = fields.filter { it.required && it.options.isNotEmpty() }
.any { field -> (field.options.find { option -> option.name == field.value }?.id != "empty") }
val hasValidDataInOtherFields = !fields.filter { !it.required }.any { it.errorData.first }
return (hasValidDataInRequiredFields && hasValidDataInOtherFields)
return (hasValidDataInRequiredFields && hasValidDataInOtherFields && hasValidDataInDropDownRequiredFields)
}

fun setListener(listener: EntryListener) {
Expand Down
Loading