loloof64
04/19/2021, 6:48 PMmutableStateOf()
has an immutable version ? Or would that have no sense ? Because I want to have a state, but that would never change : just in order to avoid to create it each timeloloof64
04/19/2021, 8:54 PMvar engineName by rememberSaveable { mutableStateOf("") }
but sometimes, and initially, I want it to be null, how should I declare it ?Luis Daivid
04/20/2021, 1:09 AMBig Chungus
04/20/2021, 7:48 AMwisdom
04/20/2021, 7:49 AMTlaster
04/20/2021, 8:42 AMText
is not automatically align the text to the right when the text's language is RTL (Arabic for example), meanwhile the View base TextView
does align the text to the right when the text's language is RTL, is it a bug or desired design?loloof64
04/20/2021, 8:52 AMMainActivity
the activity which defines the navigation, and TargetComposable
the composable of the pushed page. How can I force a reload of TargetComposable
when application is back in foreground ? Is using MainActivity
's onStart()
method mandatory (and can it lead to a kind a mess, coupled with Navigation) ? Or is there a simpler solution ?Olivier Patry
04/20/2021, 9:41 AMescodro
04/20/2021, 12:19 PMadjustResize
in my Compose project in landscape. The flag does work when the TextField
is inside another smaller Composable
, like a BottomSheet
. If the the EditText
is in a Scaffold
, it does not seen to work.
Could someone help me please? I attached a video to better explain it.
Thanks a lot in advance!YASAN
04/20/2021, 3:40 PM.clickable(indication = null)
even tho Android Studio autocompletes it, it becomes red instantly and wont build. Any ideas?YASAN
04/20/2021, 7:39 PMcoroutines
in a LazyVerticalGrid
item. I have this:
val coroutineScope = rememberCoroutineScope()
and this in a `Column`:
val drawable = mutableStateOf<Drawable?>(null)
coroutineScope.launch {
drawable.value = app.requireIcon(activity)
}
But the code inside launch
does not even start. What am I doing wrong?
I need to load a Drawable inside each lazy item and it can take a few seconds so I cannot do it on the main thread.Chris Fillmore
04/20/2021, 8:52 PM@Composable
fun WeightedBox() {
Row {
Box(modifier = Modifier.weight(0.3f)) {
// Hypothetical @Composable Image
Image(...)
}
}
}
Basically I am trying to load an image in a Box that will be weighted to 30% width of the display. The API I’m calling to fetch the image allows me to filter the url to only fetch the size of image I need. For example, if I’m fetching /images/pic1.jpg
but I only need it at max 400px width/height, I could fetch /images/pic1_400x400.jpg
. Is there any way for me to know the calculated width in pixels, so that I can pass this information along with my request?
Fwiw I don’t need to use Box exactly. If there’s another composable that would provide this behaviour, I can use that.
I guess my use case is similar to, say, if I were making a grid of images.
Thanks for any help!Timo Drick
04/20/2021, 9:22 PMZach Klippenstein (he/him) [MOD]
04/20/2021, 10:34 PMgraphicsLayer
changes that don’t require recomposition perhaps)?Walter Berggren
04/21/2021, 8:24 AMonValueChangeFinished
for Slider doesn’t seem to be behaving I expect it to. I expect it to be called a single time once the user has finished dragging, but it is also called at the very beginning of a user drag. Is this the intended behavior?Samir Basnet
04/21/2021, 8:53 AMjava.lang.NoSuchFieldError: No static field Companion of type Landroidx/compose/foundation/layout/BoxScope$Companion; in class Landroidx/compose/foundation/layout/BoxScope; or its superclasses (declaration of 'androidx.compose.foundation.layout.BoxScope' appears in /data/app/com.view9.mahal-Zh5TQ66RD7sgpFKhGyXOyg==/base.apk)
at com.google.accompanist.pager.Pager.Pager(Pager.kt:461)
at com.google.accompanist.pager.Pager.HorizontalPager(Pager.kt:147)
allan.conda
04/21/2021, 9:19 AM<navigation>
<navigation>
<argument... />
<fragment />
</navigation>
</navigation>
I know that arguments inside <fragment>
can be translated as
composable(
route = "screenA",
arguments = listOf(navArgument(...)),
) { ... }
But I’m not sure how we can pass arguments to a nested navigation itself which encapsulates its start destination.nitrog42
04/21/2021, 9:51 AMBox {
Column(Modifier.padding(bottom = /* height of the snackbar*/)) {
//content
}
Snackbar {
Text("My text")
}
}
what is the best method to do that? a custom layout ? Do you have any resources that could show me some code sample about this?Marcin Środa
04/21/2021, 12:02 PMYASAN
04/21/2021, 1:49 PMonBackPressed
to not let the user exit the app (its a launcher so that's the expected behavior).
But I have not found a way to check if the current destination is the main/last destination or if back stack is empty so I dont call super.onBackpressed
on that condition.David Edwards
04/21/2021, 2:37 PMnitrog42
04/21/2021, 3:33 PMYuri Drigin
04/21/2021, 4:33 PMval tokens = viewModel.tokens.observeAsState(listOf())
I use mock viewModel for preview with hardcoded livedata
override val stables: LiveData<List<StableTokenWithMetaAndRate>> = liveData {
listOf(StableTokenWithMetaAndRate.USDp, StableTokenWithMetaAndRate.EURp)
}
However in the preview show me an empty list (((PHondogo
04/21/2021, 4:34 PMjefbit
04/21/2021, 5:55 PMdewildte
04/21/2021, 6:43 PMBackHandler
?dewildte
04/21/2021, 7:16 PMAnimatedVisibilty
for pretty much everything.
But that composable does not have a callback, perhaps I could use a LaunchedEffect
or DisposableEffect
for that piece?
I am not sure if this is an architectural question or a compose question.
It’s kind of a cross cutting thing.Gabriel Melo
04/21/2021, 7:39 PMColton Idle
04/21/2021, 8:10 PMeygraber
04/21/2021, 8:59 PMstaticCompositionLocalOf
says:
A static CompositionLocal should be only be used when the value provided is highly unlikely to change.What if the value provided is always the same instance, but
provides
would be called on each composition?eygraber
04/21/2021, 8:59 PMstaticCompositionLocalOf
says:
A static CompositionLocal should be only be used when the value provided is highly unlikely to change.What if the value provided is always the same instance, but
provides
would be called on each composition?Dominaezzz
04/21/2021, 9:08 PM