Skip to content

Commit

Permalink
suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
prupani-7 committed Oct 20, 2023
1 parent 1680058 commit d2d99b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Slider
Expand All @@ -41,13 +40,11 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme
import com.esri.arcgismaps.sample.sampleslib.theme.SampleTypography

/**
* Composable component to display Dynamic Entity Layer Settings
*/
Expand All @@ -66,18 +63,16 @@ fun DynamicEntityLayerProperties(

Column(Modifier.background(MaterialTheme.colorScheme.background)) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
modifier = Modifier.fillMaxWidth().padding(20.dp, 20.dp, 20.dp, 0.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
modifier = Modifier.weight(5f),
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
style = SampleTypography.titleMedium,
text = "Dynamic Entity Settings",
color = MaterialTheme.colorScheme.primary
)
TextButton(
modifier = Modifier.weight(1f),
onClick = onDismiss
) {
Text(text = "Done")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.LifecycleOwner
import com.arcgismaps.mapping.view.MapView
import com.arcgismaps.mapping.view.SingleTapConfirmedEvent
import kotlinx.coroutines.launch

/**
* Wraps the MapView in a Composable function.
*/
@Composable
fun ComposeMapView(
modifier: Modifier = Modifier,
mapViewModel: MapViewModel,
onSingleTap: (SingleTapConfirmedEvent) -> Unit = {}
mapViewModel: MapViewModel
) {
// get an instance of the current lifecycle owner
val lifecycleOwner = LocalLifecycleOwner.current
Expand All @@ -60,8 +59,15 @@ fun ComposeMapView(

// launch coroutine functions in the composition's CoroutineContext
LaunchedEffect(Unit) {
mapView.onSingleTapConfirmed.collect {
onSingleTap(it)
launch {
mapView.onSingleTapConfirmed.collect {
mapViewModel.dismissBottomSheet()
}
}
launch {
mapView.onPan.collect{
mapViewModel.dismissBottomSheet()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down

0 comments on commit d2d99b7

Please sign in to comment.