Luka
09/24/2021, 1:54 PMRow(modifier = modifier) {
Box(
modifier = Modifier.clickable { onConfirmClicked.invoke() },
contentAlignment = Alignment.CenterStart
) {
Text(
text = stringResource(id = R.string.confirm), textAlign = TextAlign.Left,
fontWeight = FontWeight.Medium,
fontSize = 16.sp,
color = colorResource(id = R.color.red)
)
}
Box(
modifier = Modifier
.padding(start = 32.dp)
.clickable { onRemoveClicked.invoke() },
) {
Text(
text = stringResource(id = R.string.dont_repeat),
fontWeight = FontWeight.Medium,
fontSize = 16.sp,
color = colorResource(id = R.color.red_clickable_link)
)
}
if (showEditButton) {
Box(
modifier = Modifier
.padding(start = 32.dp)
.clickable { onEditClicked.invoke() },
) {
Text(
text = stringResource(id = R.string.edit),
fontWeight = FontWeight.Medium,
fontSize = 16.sp,
color = colorResource(id = R.color.red_clickable_link)
)
}
}
}
Akram Bensalem
09/24/2021, 2:16 PMthe new SplashScreen API
Louis
09/24/2021, 2:20 PMCicero
09/24/2021, 2:34 PMAppButton(label = "TE\$T") {
mediaPlayback.playPause()
}
myanmarking
09/24/2021, 4:48 PM<vector xmlns:android="<http://schemas.android.com/apk/res/android>"
android:width="184dp"
android:height="184dp"
android:viewportWidth="184"
android:viewportHeight="184">
<path
android:fillColor="?attr/colorPrimary"
android:fillType="evenOdd"
android:pathData="M22 92a70 70 0 1 1 140 0 70 70 0 1 1-140 0" />
escodro
09/24/2021, 6:48 PMState
only occurs when inside an action from a @Composable
?
For example:
var state by rememberSaveable { mutableStateOf(StateA) }
when (state) {
StateA -> { if(condition) { state = StateB } else { state = StateC } } // This does not trigger
StateB -> Button(onClick = state = StateD) { Text("Click me") } // This works fine when clicked
...
}
I’m trying to do some condition check before showing UI for the user and tried using State
. Any thoughts?
Thanks a lot! ❤️Robert
09/24/2021, 9:29 PMThis version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2020.3.1 or newer.
Rick Regan
09/24/2021, 10:01 PMAnimatedNavHost
and now tried to introduce parameters into my navigation starting with the doc example arguments = listOf(navArgument("userId") { defaultValue = "me" })
but I get the compiler error "Type mismatch: inferred type is List<androidx.navigation.NamedNavArgument> but List<androidx.navigation.compose.NamedNavArgument> was expected". Does anyone know how to fix this (other than going back to regular NavHost
, which works)?brabo-hi
09/24/2021, 10:04 PM@Composable
fun MyAwesomeCompose() {
val cameraPermissionState = rememberPermissionState(Manifest.permission.READ_CONTACTS)
}
@Preview
@Composable
fun MyPreview() {
MyAwesomeCompose()
}
it am getting the following error from the preview
java.lang.IllegalStateException: Permissions should be called in the context of an Activity
at com.google.accompanist.permissions.PermissionsUtilKt.findActivity(PermissionsUtil.kt:105)
at com.google.accompanist.permissions.MutablePermissionStateKt.rememberMutablePermissionState(MutablePermissionState.kt:48)
at com.google.accompanist.permissions.PermissionStateKt.rememberPermissionState(PermissionState.kt:35)
mattinger
09/25/2021, 2:19 AMmaaxgr
09/25/2021, 11:26 AMste
09/25/2021, 3:35 PMSteve C
09/25/2021, 9:20 PMval transition = updateTransition(starState, label = "twinkle transition")
val alpha: State<Float> = transition.animateFloat(transitionSpec = {
if (StarState.IDLE isTransitioningTo StarState.TWINKLE) {
tween(durationMillis = 3000, easing = LinearOutSlowInEasing)
} else {
tween(durationMillis = 1500, easing = LinearOutSlowInEasing)
}
tween(durationMillis = 3000, easing = LinearOutSlowInEasing)
}, label = "alpha transition") { state ->
if (state == StarState.TWINKLE) 1F else 0F
}
Koneko Toujou
09/26/2021, 8:45 AMmeasure child Row
> child Row needs to know how big it will be in order to be able to layout it's children
> child Row needs information from parent Row
> > parent Row has no information because it is still trying to measure child Row
> > parent Row does not know how big child Row should be
> child Row does not know how big parent Row wants child Row to be
> child Row cannot measure itself reliably without assuming how big it is going to be
Bjarne Gelotte
09/26/2021, 9:13 AMelevation
works in Compose. If two Surfaces
with the same elevation
are directly adjacent, they still cast a shadow on each other. How come? Is it possible to avoid this somehow? I would be super grateful for some guidance! Example and code in thread.Hachemi Hamadi
09/26/2021, 9:25 AMste
09/26/2021, 2:55 PM@Composable
fun Err() {
suspend fun AwaitPointerEventScope.handler() {
awaitPointerEvent(pass = PointerEventPass.Initial).changes.forEach {
it // <-- triggers the compiler error
}
}
Spacer(modifier = Modifier.pointerInput(Unit) {
awaitPointerEventScope {
handler()
}
})
}
maaxgr
09/27/2021, 6:02 AMAndroidView(
factory = { context ->
PDFView(context)
})
The problem is that the constructor consumes an AttributeSet Object.
public PDFView(Context context, AttributeSet set) {
From where do i get this object? Didn't find anything on stackoverflow/googleyschimke
09/27/2021, 8:33 AMandroidx.wear.watchface.CanvasRenderer.render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime)
.Zoltan Demant
09/27/2021, 8:57 AMnglauber
09/27/2021, 12:11 PMAnimatedNavHost
which has many screens and the first one is the HomeScreen
.
HomeScreen
has another NavHost
to implement the navigation between the bottom navigation tabs.
Here’s the steps to reproduce:
1. Select second tab in HomeScreen
(or any other tab but the first)
2. Navigate to another screen declared inside the AnimatedNavHost
(let’s say DetailsTab2Screen
3. Press back. So the HomeScreen
is displayed again with the second tab selected.
4. Press back again. The first tab of the HomeScreen
is selected.
5. Press back again.
The expected result is: the application must be closed
The actual result is: the user has to press the back button again to leave the app. And if you repeat the steps 2 and 3, N times, the user has to press the back key N + 2 times to leave the app.
Any thoughts?myanmarking
09/27/2021, 1:58 PMAlex
09/27/2021, 2:20 PMTolriq
09/27/2021, 3:03 PMDaniel Weidensdörfer
09/27/2021, 4:30 PMnilTheDev
09/27/2021, 5:29 PMhttps://youtu.be/Gi-MnWDRcmQ▾
class HelloViewModel : ViewModel() {
// LiveData holds state which is observed by the UI
// (state flows down from ViewModel)
private val _name = MutableLiveData("")
val name: LiveData<String> = _name
// onNameChange is an event we're defining that the UI can invoke
// (events flow up from UI)
fun onNameChange(newName: String) {
_name.value = newName
}
}
@Composable
fun HelloScreen(helloViewModel: HelloViewModel = viewModel()) {
// by default, viewModel() follows the Lifecycle as the Activity or Fragment
// that calls HelloScreen(). This lifecycle can be modified by callers of HelloScreen.
// name is the current value of [helloViewModel.name]
// with an initial value of ""
val name: String by helloViewModel.name.observeAsState("")
HelloContent(name = name, onNameChange = { helloViewModel.onNameChange(it) })
}
@Composable
fun HelloContent(name: String, onNameChange: (String) -> Unit) {
Column(modifier = Modifier.padding(16.dp)) {
Text(
text = "Hello, $name",
modifier = Modifier.padding(bottom = 8.dp),
style = MaterialTheme.typography.h5
)
OutlinedTextField(
value = name,
onValueChange = onNameChange,
label = { Text("Name") }
)
}
}
However I couldn't use it on my environment. Particularly, this line of code fun HelloScreen(helloViewModel: HelloViewModel = viewModel())
is where the problem lies. My IDE isn't able to identify the viewModel()
function here. Where is it coming from? Do I need any other dependency to make it work?Viktor Petrovski
09/27/2021, 5:48 PMprivate const val DEEP_LINK_URI = "<https://example.com>"
This doesn’t:
private const val DEEP_LINK_URI = "<http://www.example.com|www.example.com>"
Is this intentional or I’m missing something?
Thanks 🙏adjpd
09/27/2021, 5:51 PMenighma
09/27/2021, 6:09 PMste
09/27/2021, 7:28 PM@Parcelize @JvmInline value class Err<T>(val value: Int) : Parcelable
ste
09/27/2021, 7:28 PM@Parcelize @JvmInline value class Err<T>(val value: Int) : Parcelable
ephemient
09/27/2021, 7:31 PMste
09/27/2021, 7:36 PMephemient
09/27/2021, 7:37 PM