Stylianos Gakis
08/31/2021, 2:12 AMFelix Schütz
08/31/2021, 6:52 AMStefan Oltmann
08/31/2021, 6:59 AMdefaultMinSize
, but that has not the effect I expected.
Row(
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = text
)
Spacer(
modifier = Modifier.weight(1.0f)
)
Text(
text = photoCount.toString(),
maxLines = 1,
modifier = Modifier.padding(horizontal = defaultPadding).border(1.dp, Color.Red)
)
}
Anders Kielsholm
08/31/2021, 8:25 AMDropdownMenu
and I don't know if it's me doing something wrong. I want the `DropdownMenuItem`s to contain an icon and text. It however seems like the width of the items are based on the text solely and not the combined width. I have this implementation as an example (in the actions
part of a TopAppBar
):
IconButton(onClick = { showMenu = !showMenu }) {
Icon(<http://Icons.Default.Menu|Icons.Default.Menu>, contentDescription = null)
}
DropdownMenu(
expanded = showMenu,
onDismissRequest = { showMenu = false }
) {
DropdownMenuItem(
onClick = { }
) {
Icon(Icons.Default.ThumbUp, contentDescription = null)
Text("This is a line", maxLines = 1)
}
DropdownMenuItem(
onClick = { }
) {
Icon(Icons.Default.Clear, contentDescription = null)
Text("This is another line", maxLines = 1)
}
}
I've attached some Screenshots. The first is how it looks with the above implementation (see the second line is cut off). The second is how it looks without the icons - notice how the width of the box is exactly the same as the first. The third is how I want it to look in the end (I achieved this by setting a static with on one of the `Text`s to 170 dp).
Does anyone know what I'm doing wrong - or could it be a bug?Tin Tran
08/31/2021, 8:54 AMcomposable(route = "a") {
Component1(hiltViewModel())
Component1(hiltViewModel())
}
Erlich
08/31/2021, 2:35 PMView
class internally to draw the UI.rsktash
08/31/2021, 3:08 PMCicero
08/31/2021, 3:10 PMdeviant
08/31/2021, 3:42 PMcontentDescription
generation for every composable in the project?
modifier = Modifier.semantics {
contentDescription = "back button"
}
maybe with reflection or some AOP tool?
ideally i would name each contentDescription with a current composable function nameAngeles Bilbao
08/31/2021, 5:53 PMScott Kruse
08/31/2021, 6:26 PMmkrussel
08/31/2021, 7:00 PMSanendak
08/31/2021, 7:54 PMStylianos Gakis
08/31/2021, 8:24 PM@Preview
extensively and I would say that providing all the fake data sometimes gets repetitive. Doing for example getFakeUserModel(id)
functions work great, but… where do you put those? Where in the package structure do you put your fake preview data? And polluting every class with something like
data class Whatever(...) {
companion object {
fakePreviewWhatever(something: String): Whatever
}
}
is not necessarily something that I love doing.
At the rate that I am doing it now, a big chunk of my files in the package structure would need to be there just to provide fake models which sounds like a great way to confuse newcomers to the codebase. Any tips or tricks on how to do this better?tad
08/31/2021, 9:09 PMSurface
to Compose? Would be useful for, say, camerax.Sanendak
08/31/2021, 10:18 PMNapa Ram
09/01/2021, 5:15 AMNipun Rajput
09/01/2021, 6:38 AMMjahangiry75
09/01/2021, 1:36 PMMohamed Ibrahim
09/01/2021, 2:31 PMrobnik
09/01/2021, 5:25 PMSergey B
09/01/2021, 7:30 PMChris Johnson
09/01/2021, 7:43 PMColumn {
TopAppBar(){}
Divider()
Surface() {} // Essentially an elevated Row. Picture below
Content() {}
}
Nthily
09/01/2021, 9:59 PMjetpack compose navigation
, I want to ask when I use Navigate with arguments
it will go back to the previous page by clicking the back button on the phone, but if I want to make a back button inside this interface and also go back to the previous page, how should I do it?Mohammad Jahidul Islam
09/02/2021, 4:34 AMJustin Yue
09/02/2021, 6:30 AMimplementation "androidx.navigation:navigation-compose:2.4.0-alpha08"
in my build.gradle. Sync works fine, but when I try to build, I get this error (in thread) stating that min sdk is not 31. I'm a bit confused by this since sdk 31 is android 12, which hasn't come out yet?
Edit: Resolved!galex
09/02/2021, 7:05 AMenum class Hierarchy(
backgroundColor: Color,
contentColor: Color,
pressedBackgroundColor: Color,
pressedContentColor: Color,
disabledBackgroundColor: Color,
disabledContentColor: Color,
border: BorderStroke? = null,
) {
Primary(
backgroundColor = MyTheme.colors.accentDefault,
contentColor = MyTheme.colors.contentInverse,
disabledBackgroundColor = MyTheme.colors.accentDisabled,
disabledContentColor = MyTheme.colors.contentInverse)
}
But as the enum is not a Composable I am hit with an error @Composable invocations can only happen from the context of a @Composable function
. Is there a workaround this error?Felix Schütz
09/02/2021, 8:40 AMContentResolver
, I need to explicitly pass the fetcher to the request builder, otherwise Coil cannot process the video (since the URI does not contain the file type). E.g.:
Image(
painter = rememberImagePainter(
data = contentUri,
builder = {
fetcher(VideoFrameUriFetcher(LocalContext.current))
},
),
contentDescription = null,
)
Creating the VideoFrameUriFetcher
instance for every video seems kind of inefficient. Is there a better Compose way?mario
09/02/2021, 9:48 AMK Merle
09/02/2021, 11:40 AMdelay
inside LaunchedEffect
coroutine scope in androidTests? I am unable to test if following lambda has been called when delay
is present.
LaunchedEffect(Unit){
delay(splashTime)
navigate(viewModel.isAuthenticated())
}
K Merle
09/02/2021, 11:40 AMdelay
inside LaunchedEffect
coroutine scope in androidTests? I am unable to test if following lambda has been called when delay
is present.
LaunchedEffect(Unit){
delay(splashTime)
navigate(viewModel.isAuthenticated())
}
runBlockingTest
and advanceTimeBy()
do not help.Zach Klippenstein (he/him) [MOD]
09/02/2021, 1:53 PMmainClock
to control time on compose coroutines. https://developer.android.com/reference/kotlin/androidx/compose/ui/test/junit4/ComposeTestRuleK Merle
09/02/2021, 2:04 PMRekha
09/02/2021, 7:34 PMK Merle
09/02/2021, 8:41 PMsplashTime
and it works.