android-jetpack-compose

Upgrading to Jetpack Compose Alpha 12 causes errors on setContent

喜欢而已 提交于 2021-02-20 05:51:10
问题 I upgraded to Jetpack Compose 1.0.0-alpha12 and started to run into issues. Firstly, the setContent method I was using showed as deprecated. From the Alpha 12 release notes, I noticed that it said: ComponentActivity.setContent has moved to androidx.activity.compose.setContent in the androidx.activity:activity-compose module. (Icf416) So I removed my import androidx.compose.ui.platform.setContent and switched it to import androidx.activity.compose.setContent , which removed the deprecation.

How request permissions with Jetpack Compose?

随声附和 提交于 2021-02-19 02:18:34
问题 How should be implemented requesting permission from Jetpack Compose View? I'm trying implement application accessing Camera with Jetpack Compose. I tried example from How to get Current state or context in Jetpack Compose Unfortunately example is no longer working with dev06. fun hasPermissions(context: Context) = PERMISSIONS_REQUIRED.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED } } } 回答1: A little late but this might help as I had the problem

How request permissions with Jetpack Compose?

孤人 提交于 2021-02-19 02:16:54
问题 How should be implemented requesting permission from Jetpack Compose View? I'm trying implement application accessing Camera with Jetpack Compose. I tried example from How to get Current state or context in Jetpack Compose Unfortunately example is no longer working with dev06. fun hasPermissions(context: Context) = PERMISSIONS_REQUIRED.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED } } } 回答1: A little late but this might help as I had the problem

How request permissions with Jetpack Compose?

落花浮王杯 提交于 2021-02-19 02:16:22
问题 How should be implemented requesting permission from Jetpack Compose View? I'm trying implement application accessing Camera with Jetpack Compose. I tried example from How to get Current state or context in Jetpack Compose Unfortunately example is no longer working with dev06. fun hasPermissions(context: Context) = PERMISSIONS_REQUIRED.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED } } } 回答1: A little late but this might help as I had the problem

Jetpack Compose Overlays - Build Software Keyboard with Jetpack Compose

 ̄綄美尐妖づ 提交于 2021-02-10 05:44:43
问题 Building a simple keyboard is fairly simple and straightforward in Jetpack Compose. I built a really simple KeyRow by using this: Key.kt @Composable fun Key(modifier: Modifier = Modifier, label: String, onClick: () -> Unit) { val shape = RoundedCornerShape(4.dp) //TODO: make clickable outside but don't show ripple Box(modifier = modifier .padding(2.dp) .clip(shape) .clickable(onClick = onClick) .background(Color.White) .padding(vertical = 12.dp, horizontal = 4.dp), contentAlignment =

Jetpack Compose Overlays - Build Software Keyboard with Jetpack Compose

不羁的心 提交于 2021-02-10 05:44:10
问题 Building a simple keyboard is fairly simple and straightforward in Jetpack Compose. I built a really simple KeyRow by using this: Key.kt @Composable fun Key(modifier: Modifier = Modifier, label: String, onClick: () -> Unit) { val shape = RoundedCornerShape(4.dp) //TODO: make clickable outside but don't show ripple Box(modifier = modifier .padding(2.dp) .clip(shape) .clickable(onClick = onClick) .background(Color.White) .padding(vertical = 12.dp, horizontal = 4.dp), contentAlignment =

How to achieve this layout in Jetpack Compose

社会主义新天地 提交于 2021-02-09 08:18:22
问题 I'm trying to use the new Jetpack Compose UI framework, but i'm running into an issue. I'd like to achieve this layout, wich in xml is pretty easy to achieve: But i can't figure out hou to make the vertical divider take up the available vertical space, without specifying a fixed height. This code that I've tried doesn't seem to work: @Composable fun ListItem(item: PlateUI.Plate) { Surface( modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), elevation = 2.dp ) { Row( modifier

How to achieve this layout in Jetpack Compose

女生的网名这么多〃 提交于 2021-02-09 08:18:01
问题 I'm trying to use the new Jetpack Compose UI framework, but i'm running into an issue. I'd like to achieve this layout, wich in xml is pretty easy to achieve: But i can't figure out hou to make the vertical divider take up the available vertical space, without specifying a fixed height. This code that I've tried doesn't seem to work: @Composable fun ListItem(item: PlateUI.Plate) { Surface( modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), elevation = 2.dp ) { Row( modifier

How to achieve this layout in Jetpack Compose

て烟熏妆下的殇ゞ 提交于 2021-02-09 08:17:41
问题 I'm trying to use the new Jetpack Compose UI framework, but i'm running into an issue. I'd like to achieve this layout, wich in xml is pretty easy to achieve: But i can't figure out hou to make the vertical divider take up the available vertical space, without specifying a fixed height. This code that I've tried doesn't seem to work: @Composable fun ListItem(item: PlateUI.Plate) { Surface( modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), elevation = 2.dp ) { Row( modifier

How to achieve this layout in Jetpack Compose

淺唱寂寞╮ 提交于 2021-02-09 08:17:13
问题 I'm trying to use the new Jetpack Compose UI framework, but i'm running into an issue. I'd like to achieve this layout, wich in xml is pretty easy to achieve: But i can't figure out hou to make the vertical divider take up the available vertical space, without specifying a fixed height. This code that I've tried doesn't seem to work: @Composable fun ListItem(item: PlateUI.Plate) { Surface( modifier = Modifier.fillMaxWidth(), shape = RoundedCornerShape(8.dp), elevation = 2.dp ) { Row( modifier