myanmarking
12/07/2022, 10:33 AMMehdi Haghgoo
12/07/2022, 10:51 AManimate
and AnimationState
?chanjungskim
12/07/2022, 11:37 AMchanjungskim
12/07/2022, 11:38 AMElio Maroun
12/07/2022, 11:54 AMIssa
12/07/2022, 12:41 PMLazyColumn
of LazyRow
items, it seems that the items of each LazyRow
does not keep the values of any remember
function across composition if the list is scrolled vertically. Is this a known issue?myanmarking
12/07/2022, 1:52 PMTower Guidev2
12/07/2022, 2:38 PMLandry Norris
12/07/2022, 2:45 PMfilipegoncalves
12/07/2022, 8:45 PMLazyRow
, but with two specific requirements:
1. start centered on the 2nd element (I can scroll to it, but i would need some callback regarding the visible/centered element to be able to keep state after scroll)
2. the centered element should be slightly bigger than the rest (to be highlighted).
But I have absolutely no idea how to do this. Do any of you have any idea or can you give me any tip on how to advance?
Image added below to show the desired viewfilipegoncalves
12/07/2022, 8:49 PMColton Idle
12/07/2022, 9:06 PMHorizontalPager
and VerticalPager
, a way of showing composables in a Pager manner. Introduced PagerState
to control the Pagers as well as query information about the Pager's current state. Introduced PageSize
, a way of controlling the size of a Pager's page, this can be used to create a carousel like Pagers. Introduced PagerSnapDistance
, a way to control how snapping will work in Pager's fling behavior. (I01120)
• Introduced an overload in SnapFlingBehavior.performFling
to help to understand where the fling will settle. (I569f6)
• ^^ So it looks like accompanist pager is basically not needed anymore? cc: Chris banes?
• Removed OverscrollEffect#isEnabled
.
• Added ScrollableState#canScrollForward
and ScrollableState#canScrollBackward
to query whether a ScrollableState
has room to scroll in either direction
• Added an Modifier API to query ancestors scroll info. (I2ba9d, b/203141462)
• Used in Clickable
to correctly delay press interactions, when gestures could become scroll events.
• Fixed Clickables
not correctly delaying ripples, when used inside an Scrollable ViewGroup
.
• Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
• Update snapStepSize
naming to be consistent with other methods in SnapLayoutInfoProvider
. (Ife67c)
• Added EmojiCompat
to Compose
(Ibf6f9, b/139326806)
• Renamed consumedWindowInsets()
to consumeWindowInsets()
and withConsumedWindowInsets()
to onConsumedWindowInsetsChanged()
and made the Modifiers public. (Ie44e1)
• Added EmojiCompat
to Compose
WOOO
• Adding @JvmDefaultWithCompatibility
annotation (I8f206)
• Incorporated changes in the Swipeable
APIs in ModalDrawer
. `DrawerState`'s animateTo
has been replaced by the open
and close
methods and the offset is now nullable. Use requireOffset
to require the offset. (I3de9e)
• Updated Drawers and Sheets to correctly delay presses in case gestures can become scroll events.
• Fixed an issue where PullRefreshIndicator
could get stuck after onRefresh
is called, if the refreshing state was not changed to true. (Ie2416, b/248274004)
• Add new default content padding for text button with icon to use. (I8f662)
• Added disabled colors for navigation bar and rail. (Ia7892, b/258867034)
• Snapshot apply notifications are now sent after the Recomposer
finishes applying changes. (Iad6c0, b/222093277)
• Added new wallpaper parameter to @Preview
for dynamic colour support (I9f512)
• Introduced changes in captureToImage
to allow for capturing multi window screenshots. This is useful for screenshot tests that use compose PopUps. (I169c5)chanjungskim
12/08/2022, 5:29 AMPHondogo
12/08/2022, 8:46 AMKhan
12/08/2022, 11:54 AMviewGroup.addView()
ViewGroup is passed to the method and i am using it as a container now to add more elements.
Can i do similar thing in Compose? What i want to achieve is inflate my compose content under Toolbar (which is already created and the dynamic content needs to be added under that in later stage based on conditions and states)kenkyee
12/08/2022, 12:09 PMAhaisting
12/08/2022, 2:23 PMLocalConfiguration.current
like resources()
does (https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/res/Resources.android.kt;l=31-34?q=Resources.android) and I have configChanges
added to manifest.
@Composable
fun LocalDateTime.localized(): String {
LocalConfiguration.current // was hoping this would recompose when it changes, like resources() call
LocalContext.current // same here
val pattern = if (DateFormat.is24HourFormat(LocalContext.current)) {
"H:mm"
} else {
"h:mm a"
}
// format the date:
anyone have any ideas?Pablo
12/08/2022, 3:15 PMEric Ampire [MOD]
12/08/2022, 6:19 PMfrancisco
12/08/2022, 6:28 PMperformClick
is not toggling the state.
Do you have suggestions? Thank you!
found the issue: I was not passing selected
to the chip. 🤦Pablichjenkov
12/08/2022, 10:33 PMCreating a state object during composition without using remember
xxfast
12/09/2022, 12:03 AMRow {
Box {
AnimatedVisibility()
}
}
this gives you an error
'fun RowScope.AnimatedVisibility(visible: Boolean, modifier: Modifier = ..., enter: EnterTransition = ..., exit: ExitTransition = ..., label: String = ..., content: AnimatedVisibilityScope.() -> Unit): Unit' can't be called in this context by implicit receiver. Use the explicit one if necessary
I understand that there are three AnimatedVisibility
functions
@Composable fun AnimatedVisibility
@Composable fun RowScope.AnimatedVisibility
@Composable fun ColumnScope.AnimatedVisibility
But how do I invoke the first one without any scope?eygraber
12/09/2022, 5:52 AM@Composable
fun ColorPicker(
modifier: Modifier = Modifier
) {
BoxWithConstraints(
modifier = modifier.aspectRatio(1F)
) {
val diameter = constraints.maxWidth
...
}
}
The problem is that it looks like if a user passes a Modifier
to ColorPicker
with size constraints, it would follow those. However, BoxWithConstraints
uses the incoming constraints to size itself, not the constraints in its Modifier
.
In a case like this, should I be wrapping BoxWithConstraints
in a Box
that uses the Modifier
parameter, or is it expected that the caller of ColorPicker
should wrap it in whatever layout it needs, and set the size constraints appropriately?Lucas
12/09/2022, 8:50 AMChristoph Wiesner
12/09/2022, 12:37 PMLazyColumn
that should be always scrolled to the bottom (chat style list)
I do that with
LaunchedEffect(listState.items) { scrollState....}
problem is that i have a list item that changes it’s size depending on an interaction
this change is not picked up, bc. the items list itself is not altered. don’t want to expose the in-memory state if the item to the list so i could listen to it on list-level.
is there any other way apart from providing a scrollToBottom callback down to the item - that it can call when it’s size changes?Dave Scheck
12/09/2022, 3:39 PMdata class ScreenState(val intValue: Int = 0, val boolValue: Boolean = false)
We have a screen composable that uses a composable based on the state. For the example we increment the integer value within the state once per second. Note that the boolean isn't modified.
@Composable
fun TestScreen() {
// Screen state managed by the composable
val screenState = remember { mutableStateOf(ScreenState()) }
/**
Update the integer value of the state once per second
Note that the boolean value is never changed and is always false
**/
LaunchedEffect(key1 = null) {
while (true) {
delay(1000)
screenState.value = screenState.value.copy(
intValue = screenState.value.intValue + 1,
)
}
}
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(0xFF272727)),
contentAlignment = Alignment.Center
) {
// Simple composable that takes the state object as an input
ContainerBox(screenState.value)
}
}
The ContainterBox is an outlined column that takes the state in and uses the boolean to selectively include a composable using the integer value
@Composable
fun ContainerBox(value: ScreenState) {
Column(
modifier = Modifier
.width(300.dp)
.height(300.dp)
.border(
border = BorderStroke(1.dp, Color(0xFF23C42A)),
shape = RoundedCornerShape(10.dp)
)
.clip(RoundedCornerShape(10.dp))
.background(Color(0xFF75757A)),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
if (value.boolValue) {
Text("Dynamic Text ${value.intValue}")
} else {
Text("Static Text")
}
}
}
The expectation is that since boolValue isn't being modified that ContainerBox wouldn't need to recompose. However, we see a recomposition every second. After quite a bit of debugging, we found the border modifier to be the culprit. If we take the border modifier out, the recomposition isn't performed until boolValue is changed.
Does anybody know what about the border modifier is triggering the unneeded recompositions?Anton Afanasev
12/09/2022, 4:05 PMExperimentalMaterial3Api
like Scaffold, which makes it a little bit confusing. Is it safe to use Experimental api in prod? Are there going to be breaking changes for that api?Adel Ayman
12/09/2022, 4:27 PMOthman El Jazouli
12/09/2022, 5:09 PMOthman El Jazouli
12/09/2022, 5:09 PMIan Lake
12/09/2022, 5:23 PMOthman El Jazouli
12/09/2022, 6:19 PMCasey Brooks
12/09/2022, 6:42 PMStateFlow
.
That’s kind-of the whole point of Repository layer, that it is a place where data is stored, but the actual storage mechanism is an implementation detail. It’s not simply a wrapper over your local databaseStateFlow
. And the same idea can hold with much of the data that would be shared throughout your application, without necessarily needing to cache it in a local DBFrancesc
12/09/2022, 7:28 PMOthman El Jazouli
12/09/2022, 7:32 PMFrancesc
12/09/2022, 7:33 PMCasey Brooks
12/09/2022, 7:35 PMIan Lake
12/09/2022, 7:35 PMFrancesc
12/09/2022, 7:38 PMCasey Brooks
12/09/2022, 7:40 PMSavedStateHandle
, for exampleOthman El Jazouli
12/09/2022, 7:40 PMCasey Brooks
12/09/2022, 7:41 PMIan Lake
12/09/2022, 7:42 PMOthman El Jazouli
12/09/2022, 7:42 PMIan Lake
12/09/2022, 7:43 PMTell us what your data looks like, what the source of truth of your data is, who loads it, who needs to read it, etc.
Othman El Jazouli
12/09/2022, 7:50 PMCoin
, and they can be either Fiat
or Crypto
- there are multiple api calls to construct them
our usecase call doesn’t know about any of those, it just expects a list of Coin
in compose we list them all and you can tap on a Fiat
to view some things
there are many modules involved, including one with a core compose navigation, from my current module that shows the list, I have to pass that Fiat
object up to the compose navigation, and send it through to open a different screenIan Lake
12/09/2022, 8:10 PMOthman El Jazouli
12/09/2022, 8:12 PMIan Lake
12/09/2022, 8:14 PMOthman El Jazouli
12/09/2022, 8:15 PMIan Lake
12/09/2022, 8:18 PMOthman El Jazouli
12/09/2022, 8:18 PMIan Lake
12/09/2022, 8:20 PMOthman El Jazouli
12/09/2022, 8:21 PMIan Lake
12/09/2022, 8:23 PMOthman El Jazouli
12/09/2022, 8:24 PMCasey Brooks
12/09/2022, 8:30 PMPablichjenkov
12/09/2022, 10:18 PMIan Lake
12/09/2022, 10:40 PMCasey Brooks
12/09/2022, 10:47 PMSavedStateHandle
, etc.Pablichjenkov
12/10/2022, 1:30 AM