dima.avdeev
2 years ago
committed by
GitHub
7 changed files with 88 additions and 18 deletions
@ -0,0 +1,19 @@
|
||||
package example.imageviewer.view |
||||
|
||||
import androidx.compose.foundation.Image |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.layout.ContentScale |
||||
import org.jetbrains.compose.resources.ExperimentalResourceApi |
||||
import org.jetbrains.compose.resources.painterResource |
||||
|
||||
@OptIn(ExperimentalResourceApi::class) |
||||
@Composable |
||||
internal actual fun LocationVisualizer(modifier: Modifier) { |
||||
Image( |
||||
painter = painterResource("dummy_map.png"), |
||||
contentDescription = "Map", |
||||
contentScale = ContentScale.Crop, |
||||
modifier = modifier |
||||
) |
||||
} |
@ -0,0 +1,7 @@
|
||||
package example.imageviewer.view |
||||
|
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
|
||||
@Composable |
||||
internal expect fun LocationVisualizer(modifier: Modifier) |
@ -0,0 +1,19 @@
|
||||
package example.imageviewer.view |
||||
|
||||
import androidx.compose.foundation.Image |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.layout.ContentScale |
||||
import org.jetbrains.compose.resources.ExperimentalResourceApi |
||||
import org.jetbrains.compose.resources.painterResource |
||||
|
||||
@OptIn(ExperimentalResourceApi::class) |
||||
@Composable |
||||
internal actual fun LocationVisualizer(modifier: Modifier) { |
||||
Image( |
||||
painter = painterResource("dummy_map.png"), |
||||
contentDescription = "Map", |
||||
contentScale = ContentScale.Crop, |
||||
modifier = modifier |
||||
) |
||||
} |
@ -0,0 +1,30 @@
|
||||
package example.imageviewer.view |
||||
|
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.interop.UIKitInteropView |
||||
import platform.CoreLocation.CLLocationCoordinate2DMake |
||||
import platform.MapKit.MKCoordinateRegionMakeWithDistance |
||||
import platform.MapKit.MKMapView |
||||
import platform.MapKit.MKPointAnnotation |
||||
|
||||
@Composable |
||||
internal actual fun LocationVisualizer(modifier: Modifier) { |
||||
//todo get real geo coordinates |
||||
UIKitInteropView( |
||||
modifier = modifier, |
||||
factory = { |
||||
val mkMapView = MKMapView() |
||||
val cityAmsterdam = CLLocationCoordinate2DMake(52.3676, 4.9041) |
||||
mkMapView.setRegion( |
||||
MKCoordinateRegionMakeWithDistance( |
||||
centerCoordinate = cityAmsterdam, |
||||
5000.0, 5000.0 |
||||
), |
||||
animated = false |
||||
) |
||||
mkMapView.addAnnotation(MKPointAnnotation(cityAmsterdam, title = null, subtitle = null)) |
||||
mkMapView |
||||
}, |
||||
) |
||||
} |
Loading…
Reference in new issue