Abhimanyu
06/24/2023, 9:40 AMcomposed
lambda?
How to get size of composable in a custom Modifier?Asad Mukhtar
06/24/2023, 10:48 PMval mediaPath = "<content://media/external/file/252819>"
AsyncImage(
model = mediaPath,
contentDescription = stringResource(id = R.string.thumbnail),
placeholder = painterResource(id = R.drawable.ic_default_thumbnail),
error = painterResource(id = R.drawable.ic_default_thumbnail),
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
contentScale = ContentScale.Crop
)
Asad Mukhtar
06/25/2023, 1:16 AMGlideImage(
model = media.mediaPath, contentDescription = stringResource(id = R.string.thumbnail),
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
contentScale = ContentScale.Crop,
)
AsyncImage(
model = { media.mediaPath },
contentDescription = stringResource(id = R.string.thumbnail),
placeholder = painterResource(id = R.drawable.ic_default_thumbnail),
error = painterResource(id = R.drawable.ic_default_thumbnail),
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
contentScale = ContentScale.Crop
)
Asad Mukhtar
06/25/2023, 1:54 AMGlideImage(
model = media.mediaPath, contentDescription = stringResource(id = R.string.thumbnail),
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
contentScale = ContentScale.Crop,
)
Karthick
06/25/2023, 6:48 AMTransition
has a default
name supporting from and to states. How to try multiple transition with 3 constraint sets like start
, mid
, end
by controlling transition on clicking a buttonAsad Mukhtar
06/25/2023, 8:48 AMGlideImage(
imageModel = { media.mediaPath },
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
requestOptions = {
RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE)
},
imageOptions = ImageOptions(
contentScale = ContentScale.Crop,
contentDescription = stringResource(id = R.string.thumbnail)
),
loading = {
Image(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
painter = painterResource(id = R.drawable.ic_default_thumbnail),
contentDescription = stringResource(
id = R.string.thumbnail
),
contentScale = ContentScale.Crop
)
},
failure = {
Image(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),
painter = painterResource(id = R.drawable.ic_default_thumbnail),
contentDescription = stringResource(
id = R.string.thumbnail
),
contentScale = ContentScale.Crop
)
},
)
Tran An
06/25/2023, 12:09 PMMarcin Wisniowski
06/25/2023, 3:50 PMJames Black
06/25/2023, 4:05 PMval configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
MyApplicationTheme {
Surface(
modifier = Modifier
.height(screenHeight + 25.dp),
Marcin Wisniowski
06/26/2023, 12:43 PMNavGraphBuilder
extension for each screen: https://developer.android.com/guide/navigation/design/type-safety#split-navigation
But in the JetNews sample, they instead create Route
composables like this: https://github.com/android/compose-samples/blob/main/JetNews/app/src/main/java/com/example/jetnews/ui/interests/InterestsRoute.kt
Which one is the actual recommendation?jun chen
06/26/2023, 12:57 PMxxfast
06/26/2023, 2:02 PMColton Idle
06/26/2023, 2:38 PM@Composable
fun MySettingDialog(visible: Boolean, seedValue: String, saveEvent: () -> Unit){
var tempValue by remember { mutableStateOf(seedValue) }
if (visible){
//DialogWithTextField...
// use tempValue in textField, and onTextUpdate, update tempValue
}
}
this works fine the first time... but messes up every subsequent time because if the user types something in... it will be remembered, and then when you comes back to the dialog it will have the only remembered value even though the user didn't hit save.
It seems like an easy way to do this is for the seedValue to replace tempValue in a LaunchedEffect, but maybe kinda seems hacky. Am I missing something simple here?nuhkoca
06/26/2023, 3:20 PM1.3
to 1.4.3
but our obfuscated app crashes with
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'kotlin.jvm.functions.Function1 androidx.compose.ui.platform.n0$a.getOnViewCreatedCallback()' on a null object reference
Is this a known thing?Stylianos Gakis
06/26/2023, 3:27 PMAlexandru Hadăr
06/26/2023, 9:21 PMTextFieldColors
is not a data class
?
They seem to be implementing the equals
method by hand.Christopher Mederos
06/27/2023, 7:21 AMremember { mutableStateListOf("item 1", "item 2", "item 3") }
However - what is the best practice when you would like to store the list items in a view model? In my case, I'm trying to keep track of a list of things a user enters into a form and eventually uploading it to a server.Florian Eula
06/27/2023, 11:32 AMTower Guidev2
06/27/2023, 12:00 PMColumn(
modifier = Modifier
._fillMaxSize_()
._verticalScroll_(rememberScrollState())
) *{...}*
and i would like to add PullRefreshIndicator(isRefreshing, pullRefreshState, Modifier._align_(Alignment.TopCenter))
Ive tried this, however it doesnt work 😞,Chris Johnson
06/27/2023, 5:06 PMHarold Scissors
06/27/2023, 9:45 PM@Composable
function from a .map{}
but not .flatMap{}
?Mark
06/28/2023, 8:23 AMK Merle
06/28/2023, 11:33 AMdimsuz
06/28/2023, 2:44 PM@Immutable
. This is the quote from Chris Banes' article:
An object that is immutable means that ‘all publicly accessible properties and fields will not change after the instance is constructed’. This characteristic means that Compose can detect ‘changes’ between two instances very easily.But how exactly does compose "detect changes"? If function parameter is immutable, what compose will do with it? referentially compare prev/next values? run
prev.equals(next)
? I can't seem to find any info about this in docs, most places say that "this enables some optimizations".B Norr
06/28/2023, 4:04 PMmattinger
06/28/2023, 5:51 PMSayali N
06/28/2023, 6:50 PMPierre Schrodinger
06/28/2023, 10:36 PMMalachi Holden
06/28/2023, 11:31 PMzt
06/29/2023, 5:16 AM