Sololo
06/01/2021, 8:22 AMPhilip S
06/01/2021, 8:52 AM@Composable
fun MyList(items: List<Items>, isLoading: Boolean)
I thought about using a flag as shown above and then if-else to determine if it should show the real view or just the shimmer variant. If you have implemented shimmer loading what worked best for you? Did you perhaps find a more elegant solution?Vitaliy Zarubin
06/01/2021, 9:23 AMval user by viewModel.loadingUser.collectAsState(initial = null)
when {
user.isSucceeded -> navController.navigate(NavScreen.Home.route)
user.isError -> ErrorConnect { viewModel.repeat() }
else -> Splash()
}
Aditya Thakar
06/01/2021, 9:49 AMNipun Rajput
06/01/2021, 10:28 AMAccompanist
image loading library, I am using compose pagination in combination with LazyColumn
and LazyRow
, But when i scroll up and down images of row which is immediate above current viewing elements got disappear and when i scroll back after sometimes items reappeared, Is this bug in accompanist or LazyColumn
? I guess this is Issue in image loading only because in that row text is visible but not the image, strange isn't it?Marcin Środa
06/01/2021, 10:35 AMAlbert Chang
06/01/2021, 10:37 AMinline class
syntax and suppressing the deprecated warning as shown here instead of replacing it with value class
after supporting Kotlin 1.5? I tried using value classes (with snapshot version of compose) in my app and there seems no problem.Daniel
06/01/2021, 10:58 AMSaiedmomen
06/01/2021, 11:20 AMinternal
or private
.
I know the reason for limiting the public API but an optIn annotation might be enough.
Right now we have to copy huge amounts of code in order to have a working custom component. Code that won't get maintained or fixed easily.
If we could opt in to them, our code would break on upgrades but we would still get the benefits and fixes after fixing them.Daniele Segato
06/01/2021, 11:59 AMColumn: tag A
TextField: tag field
Text: tag error
Column: tag B
TextField: tag field
Text: tag error
Column: tag C
TextField: tag field
Text: tag error
If i want to match the TextField tagged "field" inside the column tagged "B", how do I write the SemanticMatcher?Paul Woitaschek
06/01/2021, 12:21 PMiamthevoid
06/01/2021, 12:53 PMParameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter
This parameter declared as default argument in function body and not passed in calling place. If i passing exactly the same value into funtion call app works well and not crashes on recomposition. Looks like default argument of composable function stores somewhere and GC (or somethig else) remove it when composable is recomposing, but ref stay the same and i get this error.Zach Klippenstein (he/him) [MOD]
06/01/2021, 1:06 PMErlan Amanatov
06/01/2021, 1:14 PMcomposable
function
@Composable
fun modified(
object1: A,
object2: B) : Boolean {...}
Where A
is a Data Class, B
is a regular class with MutableState
variables.
I use this function to control the Button
, so it's enabled only if there are any differences between the objects.
Button(
...
enabled = modified(object1, object2)
...
)
How does it work? Any changes to MutableState
variables of object2
trigger the modified
function?len
06/01/2021, 2:14 PMLaunchedEffect
and DisposableEffect
when you don't actually need any cleanup? I've seen in the official samples some `DisposableEffect`s with an empty onDispose {}
, and that makes me think LaunchedEffect
should be a better option, but I'm in doubt 🤔Tin Tran
06/01/2021, 2:18 PMModalBottomSheetLayout
, the app crashed. Has anyone had the same problem?Tiago Nunes
06/01/2021, 2:51 PMlifecycleScope.launch {
val bitmap = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
getLocalImageAsBitmap(imageName) ?: run {
val file = requireContext().cacheDir.resolve("places").apply { mkdirs() }.resolve(imageName)
try {
repository.downloadFile(imageName, file)
getLocalImageAsBitmap(imageName)
} catch (e: Exception) {
e.printStackTrace()
null
}
} ?: return@withContext null
}
binding.imageView.setImageBitmap(bitmap)
}
How can I migrate this to Compose (LazyColumn)?Rodri Represa
06/01/2021, 3:01 PMHorizontalPager
. The idea is extend it in the future for LazyRow
.
If you like you can check my Jetpack Compose animations repo here https://github.com/rodrirepresa/ComposeAnimationsSe7eN
06/01/2021, 4:04 PMDaniel
06/01/2021, 6:24 PMnglauber
06/01/2021, 8:28 PMTextField
without implement it from BasicTextView
?
Or have this “LineTextField” + everything from “Material Design TextField” (label, leading icon, trailing icon, …)?tad
06/01/2021, 10:54 PMMuhammad Zaryab Rafique
06/02/2021, 3:09 AMms
06/02/2021, 5:46 AMInsets
API?Zan Skamljic
06/02/2021, 7:59 AMLaw Gimenez
06/02/2021, 7:59 AMSuperblazer
06/02/2021, 8:16 AMNicolas Acart
06/02/2021, 9:38 AMval image = animatedVectorResource(id = R.drawable.avd_pathmorph_arrowoverflow_arrow_to_overflow)
val atEnd by remember { mutableStateOf(false) }
Image(
painter = image.painterFor(atEnd = atEnd),
contentDescription = null,
)
LaunchedEffect(Unit) {
atEnd = !atEnd
}
The drawable comes from here : https://github.com/SmartToolFactory/Animation-Tutorials/blob/master/Tutorial2-1Ani[…]/res/drawable/avd_pathmorph_arrowoverflow_arrow_to_overflow.xml
When I run this code, it seems that only the first object animator is done : It moves the point but does not morph to become lines etc.
Android Studio Canary's Design window can run the animation correctly but when I run it in my code it fails.
Am I launching it correctly ? Do I misunderstand something ?allan.conda
06/02/2021, 10:33 AMsuspend fun
which returns the operation’s result and navigate accordingly.
Works fine so far, and now I encountered a new use-case integrating with non-Kotlin code.
I use CameraX ImageCapture use case with takes a listener for successful capture, I can’t use suspend fun to wait for the result.
So now I’m looking for options.
I wonder if we could represent capture events from the ViewModel, and I remember discussions on SingleLiveEvents and we now prefer representing state instead of events in Compose. For example we now use state for snackbar or dialog visibility instead of SingleLiveEvent.
I’m not sure how to do this for navigation events.
I’ve seen articles suggesting StateFlow
, SharedFlow
, Channel
for navigation events, but I’m curious what the Compose team thinks.
I haven’t found an official example where the navigation is handled within the ViewModel, is it deliberate that we want to decouple ViewModels from the Views’ navigations completely (no mention of “navigation” within a ViewModel)?
We’re also having internal discussions how to handle navigation in our Compose+MVVM architecture and we’re split on what we need to do about whether we should call the navigation lambda directly on user event (like onClick) or whether we should keep our Composables pure&passive.than_
06/02/2021, 11:06 AM@Stable
or @Immutable
on a class you don't own?