diff --git a/android/engine/src/main/java/org/smartregister/fhircore/engine/ui/components/register/RegisterFooter.kt b/android/engine/src/main/java/org/smartregister/fhircore/engine/ui/components/register/RegisterFooter.kt index 421e01315e..e507abb83f 100644 --- a/android/engine/src/main/java/org/smartregister/fhircore/engine/ui/components/register/RegisterFooter.kt +++ b/android/engine/src/main/java/org/smartregister/fhircore/engine/ui/components/register/RegisterFooter.kt @@ -34,6 +34,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import org.smartregister.fhircore.engine.R +import org.smartregister.fhircore.engine.configuration.navigation.NavigationMenuConfig import org.smartregister.fhircore.engine.ui.theme.GreyTextColor import org.smartregister.fhircore.engine.util.annotation.PreviewWithBackgroundExcludeGenerated @@ -42,6 +43,8 @@ const val SEARCH_FOOTER_TAG = "searchFooterTag" const val SEARCH_FOOTER_PREVIOUS_BUTTON_TAG = "searchFooterPreviousButtonTag" const val SEARCH_FOOTER_NEXT_BUTTON_TAG = "searchFooterNextButtonTag" const val SEARCH_FOOTER_PAGINATION_TAG = "searchFooterPaginationTag" +const val PADDING_BOTTOM_WITH_FAB = 80 +const val PADDING_BOTTOM_WITHOUT_FAB = 32 @Composable fun RegisterFooter( @@ -51,9 +54,21 @@ fun RegisterFooter( previousButtonClickListener: () -> Unit, nextButtonClickListener: () -> Unit, modifier: Modifier = Modifier, + fabActions: List? = null, ) { if (resultCount > 0) { - Row(modifier = modifier.fillMaxWidth().testTag(SEARCH_FOOTER_TAG).padding(bottom = 32.dp)) { + Row( + modifier = + modifier + .fillMaxWidth() + .testTag(SEARCH_FOOTER_TAG) + .padding( + bottom = + if (!fabActions.isNullOrEmpty() && fabActions.first().visible) { + PADDING_BOTTOM_WITH_FAB.dp + } else PADDING_BOTTOM_WITHOUT_FAB.dp, + ), + ) { Box( modifier = modifier.weight(1f).padding(4.dp).wrapContentWidth(Alignment.Start), ) { diff --git a/android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/ui/report/measure/components/MeasureReportListScreenTest.kt b/android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/ui/report/measure/components/MeasureReportListScreenTest.kt index 4796a33552..925a356599 100644 --- a/android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/ui/report/measure/components/MeasureReportListScreenTest.kt +++ b/android/quest/src/androidTest/java/org/smartregister/fhircore/quest/integration/ui/report/measure/components/MeasureReportListScreenTest.kt @@ -20,9 +20,10 @@ import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onNodeWithText -import androidx.navigation.NavController +import androidx.navigation.testing.TestNavHostController import androidx.paging.Pager import androidx.paging.PagingConfig +import androidx.test.core.app.ApplicationProvider import io.mockk.mockk import org.junit.Rule import org.junit.Test @@ -34,7 +35,7 @@ import org.smartregister.fhircore.quest.ui.report.measure.screens.SHOW_PROGRESS_ class MeasureReportListScreenTest { @get:Rule(order = 0) val composeTestRule = createComposeRule() - private val navController: NavController = mockk(relaxUnitFun = true) + private val navController = TestNavHostController(ApplicationProvider.getApplicationContext()) private val dataList = Pager(PagingConfig(10)) { MeasureReportPagingSource( diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/profile/ProfileScreen.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/profile/ProfileScreen.kt index a4a1eacc23..2cb4adcdf1 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/profile/ProfileScreen.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/profile/ProfileScreen.kt @@ -79,6 +79,8 @@ const val DROPDOWN_MENU_TEST_TAG = "dropDownMenuTestTag" const val FAB_BUTTON_TEST_TAG = "fabButtonTestTag" const val PROFILE_TOP_BAR_TEST_TAG = "profileTopBarTestTag" const val PROFILE_TOP_BAR_ICON_TEST_TAG = "profileTopBarIconTestTag" +const val PADDING_BOTTOM_WITH_FAB = 80 +const val PADDING_BOTTOM_WITHOUT_FAB = 32 @Composable fun ProfileScreen( @@ -94,7 +96,7 @@ fun ProfileScreen( LaunchedEffect(Unit) { snackStateFlow.hookSnackBar(scaffoldState, profileUiState.resourceData, navController) } - + val fabActions = profileUiState.profileConfiguration?.fabActions Scaffold( scaffoldState = scaffoldState, topBar = { @@ -118,8 +120,6 @@ fun ProfileScreen( } }, floatingActionButton = { - val fabActions = profileUiState.profileConfiguration?.fabActions - if (!fabActions.isNullOrEmpty() && fabActions.first().visible) { ExtendedFab( modifier = Modifier.testTag(FAB_BUTTON_TEST_TAG), @@ -154,7 +154,16 @@ fun ProfileScreen( color = MaterialTheme.colors.primary, ) } - LazyColumn(state = lazyListState) { + LazyColumn( + state = lazyListState, + modifier = + Modifier.padding( + bottom = + if (!fabActions.isNullOrEmpty() && fabActions.first().visible) { + PADDING_BOTTOM_WITH_FAB.dp + } else PADDING_BOTTOM_WITHOUT_FAB.dp, + ), + ) { item(key = profileUiState.resourceData?.baseResourceId) { ViewRenderer( viewProperties = profileUiState.profileConfiguration?.views ?: emptyList(), diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/components/RegisterCardList.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/components/RegisterCardList.kt index b678876666..2351ce3643 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/components/RegisterCardList.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/register/components/RegisterCardList.kt @@ -106,6 +106,7 @@ fun RegisterCardList( resultCount = pagingItems.itemCount, currentPage = currentPage.value.plus(1), pagesCount = registerUiState.pagesCount, + fabActions = registerUiState.registerConfiguration?.fabActions, previousButtonClickListener = { onEvent(RegisterEvent.MoveToPreviousPage) }, nextButtonClickListener = { onEvent(RegisterEvent.MoveToNextPage) }, ) diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/report/measure/screens/MeasureReportListScreen.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/report/measure/screens/MeasureReportListScreen.kt index 9d84119707..a7b3e69ac0 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/report/measure/screens/MeasureReportListScreen.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/report/measure/screens/MeasureReportListScreen.kt @@ -58,7 +58,6 @@ fun MeasureReportListScreen( showProgressIndicator: Boolean = false, ) { val lazyReportItems = dataList.collectAsLazyPagingItems().itemSnapshotList.groupBy { it?.module } - Scaffold( topBar = { TopAppBar( @@ -92,7 +91,9 @@ fun MeasureReportListScreen( } } } else { - LazyColumn(modifier = modifier.background(Color.White).fillMaxSize()) { + LazyColumn( + modifier = modifier.background(Color.White).fillMaxSize().padding(bottom = 32.dp), + ) { lazyReportItems.keys.forEach { key -> item { key?.let { it1 ->