Landry Norris
10/03/2022, 5:44 PMjossiwolf
10/03/2022, 7:00 PModay
10/03/2022, 7:11 PM"recomposition is the process of removing all of the views on the screen > going over your code again > depending on state > adding different views to the screen"
?Aaron Waller
10/04/2022, 6:17 AMAnton Shilov
10/04/2022, 8:29 AMLazyVerticalGrid
and noticed that factory param in AndroidView
Composable is called each time an item loses and obtains visibility. It’s not ideal, as creating and destroying heavy Views makes scroll not smooth due to janky frames.
Is there any mechanism in Compose that would allow me recycle Views inside LazyVerticalGrid apart from creating a pool of Views and managing it myself?dniHze
10/04/2022, 9:52 AMOleksandr Balan
10/04/2022, 10:59 AMelye
10/04/2022, 11:34 AMrememberSaveable
, are the variables restore sequence per the order of the line coded? I have a case where it seems that way (or perhaps a Google bug?). To explain clearly what I meant with full code in https://stackoverflow.com/questions/73947154/remembersaveable-restore-value-type-influenced-by-the-order-of-the-code
Can someone help? 🙏KotlinLeaner
10/04/2022, 12:07 PModay
10/04/2022, 2:15 PMZach Klippenstein (he/him) [MOD]
10/04/2022, 2:40 PMVinay Gaba
10/04/2022, 4:41 PMDaniele Segato
10/04/2022, 4:52 PMjim
10/04/2022, 5:04 PMAbhishek Dewan
10/04/2022, 6:20 PMChuck Stein
10/04/2022, 6:52 PMAbhishek Dewan
10/04/2022, 10:52 PMelye
10/05/2022, 2:24 AM@Composable
fun MyComposableFun(textValue: String) {
val newTextValue = remember(textValue) { mutableStateOf(textvalue) }
val myComposeView = remember {
MyComposable().apply {
setContent { Text(newTextValue) }
}
}
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("Title: $newTextValue")
myComposeView.myComposable?.invoke()
}
}
class MyComposable {
var myComposable: (@Composable () -> Unit)? = null
fun setContent(content: @Composable () -> Unit) {
myComposable = content
}
}
On initial load it's okay. But when textValue
changed, and the function got called again,
• The Text("Title: $newTextValue")
got updated - which is good
• The setContent { Text(newTextValue) }
don't get updated. Why?
Did I get anything wrong?Stylianos Gakis
10/05/2022, 7:30 AMDaniele Segato
10/05/2022, 8:41 AMvalues/colors.xml
and values-widecg/colors.xml
that were picked up by my theme.
There's a constructor for Color()
that takes colorSpace = ColorSpaces.ExtendedSrgb
, I assume i have to use this.
Than what? Just check if the current window display is wide gamut to pic one color or the other? Anything else i need to do? Any handy Local provider to obtain this or do i need to go through the LocalContext
, find the activity etc...?
Do I need the activity android:colorMode="wideColorGamut"
?
Couldn't find much documentation around this topic.
ThanksSebastian Höbarth
10/05/2022, 9:53 AMFatal Exception: java.lang.IndexOutOfBoundsException: offset(13) should be less than line limit(12)
at android.text.TextLine.measure(TextLine.java:389)
at android.text.Layout.getHorizontal(Layout.java:1246)
at android.text.Layout.getHorizontal(Layout.java:1222)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1192)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1181)
at androidx.compose.ui.text.android.LayoutHelper.getDownstreamHorizontal(LayoutHelper.java:11)
at androidx.compose.ui.text.android.TextLayout.getPrimaryHorizontal(TextLayout.java:11)
at androidx.compose.ui.text.platform.AndroidParagraph.b(AndroidParagraph.java:11)
at androidx.compose.ui.text.MultiParagraph.getBoundingBox(MultiParagraph.java:42)
at androidx.compose.ui.text.TextLayoutResult.getBoundingBox(TextLayoutResult.java:42)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.addExtraDataToAccessibilityNodeInfoHelper(AndroidComposeViewAccessibilityDelegateCompat.java:164)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.addExtraDataToAccessibilityNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.java:164)
at android.view.AccessibilityInteractionController.populateAccessibilityNodeInfoForView(AccessibilityInteractionController.java:430)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:363)
at android.view.AccessibilityInteractionController.-$$Nest$mfindAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1647)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Kefas
10/05/2022, 9:54 AMdata class User(val id: Int) {
private var name = "a"
}
unstable class User {
stable val id: Int
stable var name: String
<runtime stability> = Unstable
}
Michal Klimczak
10/05/2022, 9:59 AMKata
10/05/2022, 10:01 AMCollapsingToolbarLayout
? With the new material design 3 I can see that it is possible to use LargeTopAppBar
and it has a scrollBehaviour
but it is not working with images and also it is not high enough and it is always reopening if I scroll up not just when I reach the top of the screen.Nikolas Guillen Leon
10/05/2022, 10:18 AMOleksandr Balan
10/05/2022, 11:24 AM.border()
modifier. Also I think .clip()
is not needed in this case.Asad Mukhtar
10/05/2022, 11:28 AMmattinger
10/05/2022, 12:39 PM@RunWith(Parameterized::class)
class ScreenshotTest(val selectedLocale: Locale) {
@get:Rule
val paparazzi: Paparazzi = Paparazzi(
theme = "android:Theme.MaterialComponents.Light.NoActionBar",
deviceConfig = DeviceConfig.NEXUS_5.copy(softButtons = false, screenHeight = 3000),
renderingMode = SessionParams.RenderingMode.V_SCROLL
)
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun locales() = listOf(
Locale("en", "US"),
Locale("es", "US"),
Locale("fr", "CA"),
Locale("it", "IT"),
)
}
}
But i’m having trouble getting the locale to change. I tried Locale.setDefault before calling paparazzi.snapshot, but that didn’t seem to have any effect. I’m still getting english strings.Djaka Pradana Jaya Priambudi
10/05/2022, 12:47 PM@Composable
fun foo(): Int {
var counter by mutableStateOf(0)
LaunchedEffect(Unit) {
while (true) {
delay(500)
counter++
println("Foo: $counter")
}
}
return counter
}
@Composable
fun bar() {
val foo = foo()
LaunchedEffect(Unit) {
while (true) {
delay(500)
println("Bar: $foo")
}
}
}
Output in thread, but the the second composable will always returns: "Bar: 0"Tower Guidev2
10/05/2022, 12:47 PMTower Guidev2
10/05/2022, 12:47 PMKirill Grouchnikov
10/05/2022, 2:55 PMTower Guidev2
10/05/2022, 3:02 PM