This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
import android.telephony.TelephonyManager | |
class Country( | |
val nameCode: String, | |
val code: String, | |
val fullName: String | |
) {} | |
fun getFlagEmojiFor(countryCode: String): String { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box{ | |
TextField( | |
value = text, | |
onValueChange = { | |
text = it | |
if(!viewModel.isMapEditable.value) | |
viewModel.onTextChanged(context, text) | |
}, | |
modifier = Modifier.fillMaxWidth().padding(end = 80.dp), | |
enabled = !viewModel.isMapEditable.value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box(modifier = Modifier.height(500.dp)){ | |
currentLocation.value.let { | |
MapViewContainer(viewModel.isMapEditable.value, mapView, viewModel) | |
} | |
MapPinOverlay() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun MapPinOverlay(){ | |
Column(modifier = Modifier.fillMaxWidth()) { | |
Box( | |
modifier = Modifier | |
.weight(1f) | |
.fillMaxWidth(), | |
contentAlignment = Alignment.BottomCenter | |
){ | |
Image( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getAddressFromLocation(context: Context): String { | |
val geocoder = Geocoder(context, Locale.getDefault()) | |
var addresses: List<Address>? = null | |
val address: Address? | |
var addressText = "" | |
try { | |
addresses = geocoder.getFromLocation(location.value.latitude, location.value.longitude, 1) | |
}catch(ex: Exception){ | |
ex.printStackTrace() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
private fun MapViewContainer( | |
isEnabled: Boolean, | |
mapView: MapView, | |
viewModel: MapViewModel | |
) { | |
AndroidView( | |
factory = { mapView } | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun CartItemsList( | |
modifier: Modifier = Modifier, | |
items: List<CartItem>, | |
cartItemDispatcher: CartItemDispatcher | |
) { | |
LazyColumn(modifier = modifier) { | |
items(items) { item -> | |
CartItemView(item, cartItemDispatcher) | |
} |
NewerOlder