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

fix: [ANDROAPP-6457] limit max height of expanded cards in maps #3910

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
22 changes: 19 additions & 3 deletions dhis2_android_maps/src/main/java/org/dhis2/maps/views/MapScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,23 @@ import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.Icon
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import org.dhis2.maps.R
import org.dhis2.maps.location.LocationState
Expand All @@ -34,7 +41,15 @@ fun MapScreen(
onItem: @Composable LazyItemScope.(item: MapItemModel) -> Unit,

) {
Box(modifier = Modifier.fillMaxSize()) {
var pagerMaxHeight by remember { mutableStateOf(Dp.Unspecified) }

Box(
modifier = Modifier
.fillMaxSize()
.onGloballyPositioned {
pagerMaxHeight = (it.size.height * 0.7).dp
},
) {
map()
Column(
modifier = Modifier
Expand All @@ -46,7 +61,8 @@ fun MapScreen(
MapItemHorizontalPager(
modifier = Modifier
.align(Alignment.BottomCenter)
.testTag("MAP_CAROUSEL"),
.testTag("MAP_CAROUSEL")
.heightIn(max = pagerMaxHeight),
state = listState,
items = items,
onItem = onItem,
Expand Down