Chris Johnson
09/07/2021, 11:18 PMtoolbarMaxHeight
) and then adding a spacer of height toolbarMaxHeight
so it gives the content space to scroll upwards... but I'm ending up with a blank screen. Even though if I look in layout inspector it shows everything is where it's supposed to be. Is there a way to provide space to a composable so that it can be placed above the top of your screen and then allowed to scroll upwards? Code in commentsrajesh
09/08/2021, 12:23 AMTextField
? I'm implementing search screen and need to make network call based on input value. I'm using paging for response data and collecting as LazyPagingItem
Sanendak
09/08/2021, 3:37 AM@Composable
fun TestScreen(viewModel: TestViewModel = hiltViewModel()) {
//content
}
@Composable
fun TestScreen() {
val viewModel: TestViewModel = hiltViewModel()
//content
}
Hatice Sarp
09/08/2021, 6:21 AMBasicInputText
for change password. I use focusRequester
to focus with BasicInputText. When I enter the screen, the last textfield is focused and the cursor is in that textfield. How can I change it to put it in the first textfield?Tash
09/08/2021, 6:45 AM@Immutable
when they wrap primitives, or is that implied?RE
09/08/2021, 7:36 AMModifier.blur()
api, but it only can blur the content, is there any way to blur the background like this library? https://github.com/mmin18/RealtimeBlurViewfabiocollini
09/08/2021, 8:29 AMAndroidView
. Using just views a FrameLayout
above something else it doesn’t intercept any touches, instead using an AndroidView
on top of a composable all the touches are interceptedalorma
09/08/2021, 11:13 AM@Composable
but they need some composable code... code in 🧵PHondogo
09/08/2021, 12:00 PMbitkiller
09/08/2021, 1:04 PMColumn
TextField
DropdownMenu (height set)
(X is 183 in my tests, haven't tested on other devices to see if that changes)
If height <= X, ok, DropdownMenu shows up below the textfield. But if height >= X + 1, then it moves up covering the TextField.Stefan Oltmann
09/08/2021, 1:13 PMFillSpacer()
everywhere I would write the long form instead?
@Composable
fun FillSpacer() =
Spacer(modifier = Modifier.weight(1.0f))
estevanfick
09/08/2021, 2:30 PMgraphicsLayer
to flip the card component and it’s working. But the problem is with the content, I dont know how to sync the both sides with the flip. Any tips?Bradleycorn
09/08/2021, 3:55 PMDarkSurface
composable that wraps a surface and sets up some CompositionLocals to handle the color inversions. But the more I go down that path, the more cumbersome and wrong it seems. Now I’m wondering if I should create a new theme for these screens to use. Anyone else ran into something like this before and have any ideas on how to handle it?Colton Idle
09/08/2021, 4:46 PMVinay Gaba
09/08/2021, 5:25 PMJan Skrasek
09/08/2021, 5:33 PMEspresso.onView(ViewMatchers.isRoot()).perform(ViewActions.pressBack())
With Compose I'm trying this:
val keyEvent = NativeKeyEvent(NativeKeyEvent.ACTION_DOWN, NativeKeyEvent.KEYCODE_BACK)
composeTestRule.onRoot().performKeyPress(KeyEvent(keyEvent))
but getting:
KeyEvent can't be processed because this key input node is not active.
Sergey Y.
09/08/2021, 5:44 PMmattinger
09/08/2021, 5:54 PMCLOVIS
09/08/2021, 7:43 PMAhmed Sellami
09/08/2021, 9:11 PMval funnelTranslation by animateFloatAsState(
targetValue = if (isDeleted.value)
-radius * 3f - particleRadius
else
(offsetX.value - radius * 3f - particleRadius).coerceAtMost(0f)
)
isDeleted is a boolean state, and offsetX is an Animateable.
Usage:
Box {
Canvas(
Modifier.height(imageSizeDp)
)
{
translate(funnelTranslation) {
drawPath(
path = drawSideShape(radius = radius, particleRadius = particleRadius * 3 / 4f),
color = shoesArticle.color
)
}
}
}
adjpd
09/08/2021, 10:42 PMDialog
and DropDownMenu
unexpand and hide, respectively, when the user touches outside the composables.
How can I implement this myself? I want to hide a composable if the user touches outside the composable.Slackbot
09/08/2021, 11:07 PMbrabo-hi
09/09/2021, 2:06 AMsuppressKotlinVersionCompatibilityCheck
but don’t say I didn’t warn you!).Matej Drobnič
09/09/2021, 6:16 AMallan.conda
09/09/2021, 9:56 AMfun DecoratedImage(
data: Any?
) {
val painter = rememberImagePainter(data) {
crossfade(true)
// lots of styling/customization
}
val state = (painter as? Success)?.state // I want to expose this state
Image(painter)
}
myanmarking
09/09/2021, 11:15 AMmyanmarking
09/09/2021, 11:46 AMmyanmarking
09/09/2021, 12:20 PMdata class State(
val state1: State1,
val state2: State2
)
class ViewModel{
val state = flowOf<State?>(...)
.distinctUntilChanged()
}
fun screen1(){
Surface{
val viewState by viewModel.state.collectAsState(null)
composeFun1(viewState.state1)
composeFun2(viewState.state2)
}
}
fun screen2(){
Surface{
val viewState1 by viewModel.state.map{it.state1}.collectAsState(null)
val viewState2 by viewModel.state.map{it.state2}.collectAsState(null)
composeFun1(viewState1)
composeFun2(viewState2)
}
}
Zoltan Demant
09/09/2021, 12:24 PMLazy<Foo>
in my MainActivity that takes 1000 ms to resolve; how can I .get()
it inside a @Composable
function such that it happens in the background (e.g. with Dispatchers.Default
)?Anastasia Rozovskaya
09/09/2021, 1:14 PManimationDrawable
or something which will enable me to have .png images replacing one another?Anastasia Rozovskaya
09/09/2021, 1:14 PManimationDrawable
or something which will enable me to have .png images replacing one another?Doris Liu
09/09/2021, 6:45 PMAnimatedContent
, where each image is associated with one state.Anastasia Rozovskaya
09/10/2021, 9:00 AMDoris Liu
09/10/2021, 5:36 PMAnastasia Rozovskaya
09/11/2021, 1:50 PMvar isClicked by remember { mutableStateOf(false) }
val imagePath: String =
if (isClicked) pressedImagePath else defaultImagePath
AssetImage(
path = imagePath,
modifier = Modifier
.size(68.dp)
.clickable(enabled = !isDisabled) {
isClicked = !isClicked
onClick.invoke()
})
// AssetImage is just a wrapper around CoilImage()
@Composable
fun AssetImage(
path: String,
modifier: Modifier,
contentScale: ContentScale = ContentScale.Crop,
) {
val context = LocalContext.current
val imageLoader = buildImageLoader(context = context)
CoilImage(
imageModel = stringResource(id = R.string.assets_path) + path,
imageLoader = imageLoader,
modifier = modifier,
contentScale = contentScale,
)
}
LaunchedEffect()
but is seems useless for the case, and also AnimatedContent
as you suggested, but didn’t get the resultDoris Liu
09/11/2021, 11:36 PMvar isClicked by remember { mutableStateOf(false) }
val transitionState = remember { MutableTransitionState(defaultImagePath) }
val transition = updateTranistion(transitionState)
transition.AnimatedContent(modifier = Modifier
.clickable(enabled = !isDisabled) {
isClicked = !isClicked
transitionState.targetState = if (isClicked) pressedImagePath else defaultImagePath)
onClick.invoke()
}
) {
AssetImage(Modifier.size(68.dp),path = it)
}
onClick
wouldn't give you enough info.detectTapGestures
API to get the accurate timing on pressed and released, like this: https://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testData/compose/samples/animation/samples/TransitionSamples.kt;l=64-72Anastasia Rozovskaya
09/16/2021, 4:13 PMvar isClicked by remember { mutableStateOf(false) }
val imagePath: String =
if (isClicked) pressedImagePath else defaultImagePath
val reversedImagePath: String =
if (isClicked) defaultImagePath else pressedImagePath
val zIndex = if (isClicked) -1f else 1f
Box {
AssetImage(
path = imagePath,
modifier = Modifier
.size(68.dp)
.zIndex(zIndex)
.clip(RoundedCornerShape(50.dp))
.clickable(enabled = !isDisabled) {
isClicked = !isClicked
onClick.invoke()
}
)
AnimatedContent(targetState = reversedImagePath) { target ->
AssetImage(path = target, modifier = Modifier
.size(68.dp)
)
}
}