Skip to content

Commit

Permalink
update: [ANDROAPP-4826] design system version updated, custom message…
Browse files Browse the repository at this point in the history
… added in form
  • Loading branch information
DavidAparicioAlbaAsenjo committed Feb 13, 2024
1 parent e8f0244 commit 031e2ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
37 changes: 10 additions & 27 deletions form/src/main/java/org/dhis2/form/ui/Form.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.ErrorOutline
Expand All @@ -25,6 +27,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusDirection
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.graphics.Color
Expand All @@ -43,6 +46,8 @@ import org.hisp.dhis.mobile.ui.designsystem.component.InfoBar
import org.hisp.dhis.mobile.ui.designsystem.component.InfoBarData
import org.hisp.dhis.mobile.ui.designsystem.component.Section
import org.hisp.dhis.mobile.ui.designsystem.component.SectionState
import org.hisp.dhis.mobile.ui.designsystem.theme.Radius
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

@OptIn(ExperimentalFoundationApi::class)
Expand Down Expand Up @@ -114,6 +119,7 @@ fun Form(
state = section.state,
errorCount = section.errorCount(),
warningCount = section.warningCount(),
warningMessage = resources.getString(R.string.form_without_fields),
onNextSection = onNextSection,
onSectionClick = {
intentHandler.invoke(FormIntent.OnSection(section.uid))
Expand Down Expand Up @@ -144,42 +150,18 @@ fun Form(
},
)
}
} else {
Column(
modifier = Modifier
.height(120.dp),
) {
InfoBar(
infoBarData = InfoBarData(
text = resources.getString(R.string.form_without_fields),
icon = {
Icon(
imageVector = Icons.Outlined.ErrorOutline,
contentDescription = "no fields",
tint = SurfaceColor.Warning,
)
},
color = SurfaceColor.Warning,
backgroundColor = SurfaceColor.WarningContainer,
actionText = null,
onClick = null,
),
modifier = Modifier
.background(SurfaceColor.WarningContainer),
)
}
}
},
)
}
item(sections.size - 1) {
Spacer(modifier = Modifier.height(120.dp))
Spacer(modifier = Modifier.height(Spacing.Spacing120))
}
}
} else {
Column(
modifier = Modifier
.height(120.dp),
.padding(Spacing.Spacing16),
) {
InfoBar(
infoBarData = InfoBarData(
Expand All @@ -197,6 +179,7 @@ fun Form(
onClick = null,
),
modifier = Modifier
.clip(shape = RoundedCornerShape(Radius.Full))
.background(SurfaceColor.WarningContainer),
)
}
Expand Down Expand Up @@ -226,4 +209,4 @@ private fun getNextSection(section: FormSection, sections: List<FormSection>): F
return sections[currentIndex + 1]
}
return null
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kotlin = '1.9.21'
hilt = '2.47'
hiltCompiler = '1.0.0'
jacoco = '0.8.10'
designSystem = "0.2-20240208.105715-18"
designSystem = "0.2-20240212.145552-20"
dhis2sdk = "1.10.0-20240129.132841-8"
ruleEngine = "2.1.9"
appcompat = "1.6.1"
Expand Down

0 comments on commit 031e2ca

Please sign in to comment.