Reondz
09/06/2020, 11:25 AMflosch
09/06/2020, 2:35 PMandroidx.compose.ui.graphics.Color
to a ColorInt
?flosch
09/06/2020, 3:08 PMrememberCoroutineScope { Dispatchers.Default }
. When trying to build it leads to e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:...
(full stack trace in thread). When using rememberCoroutineScope()
without a custom context, everything works fine. Is this a known issue?
Running AS 4.2 Canary 9
and 1.0.0-alpha02
.amar_1995
09/06/2020, 3:10 PMisSystemInDarkTheme
but how to change theme using user input ?Archie
09/06/2020, 4:41 PMComposable
s getting "disposed".
When changing state in compose it is usually done this way:
Surface(color = selectorExpandedColor, elevation = 3.dp) {
when (currentSelector) {
InputSelector.EMOJI -> EmojiSelector(onTextAdded, focusRequester)
<http://InputSelector.DM|InputSelector.DM> -> NotAvailablePopup(onCloseRequested)
InputSelector.PICTURE -> FunctionalityNotAvailablePanel()
InputSelector.MAP -> FunctionalityNotAvailablePanel()
InputSelector.PHONE -> FunctionalityNotAvailablePanel()
else -> { throw NotImplementedError() }
}
}
(Note: Code above is taken from JetChat
)
But doing so, creates a jarring experience where contents just pops-out and pops-in in an instant. Is it possible to trigger/create transition or animation when changing states (animate composable out and then animate composable coming in)?
Is there any guide for this out there?manueldidonna
09/06/2020, 5:09 PMLazyColumn
doesn't consider the contentPadding to show items
https://issuetracker.google.com/issues/167913500
I've reported this bug almost a month ago but I mistakenly believed it was due to the translucent TopAppBar
Mehdi Haghgoo
09/07/2020, 4:37 AMMutableState: A mutable value holder where reads to the value property during the execution of a Composable function, the current RecomposeScope will be subscribed to changes of that value. When the value property is written to and changed, a recomposition of any subscribed RecomposeScopes will be scheduled. If value is written to with the same value, no recompositions will be scheduled.
Namig Tahmazli
09/07/2020, 7:35 AMahulyk
09/07/2020, 8:44 AMYann Badoual
09/07/2020, 9:49 AMZhelyazko Atanasov
09/07/2020, 12:12 PM1.0.0-alpha02
/ Android Tools 4.2.0-alpha09
. AS goes into "Interactive mode", but when I start interacting, nothing happens (I have the simple demo with a button that shows the number of times it has been clicked. It was working in AS Canary 8 / Compose Alpha 1Ali Zargar Shabestari
09/07/2020, 2:05 PMclickable
modifier inside LazyColumnFor
makes the scrolling jaggy. My first thought was that ripple effect has something to do with the lag, but, as I changed the indicator to null
the problem is still there. here is link to my code in a thread related to this issue: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1599482698133100?thread_ts=1597241706.045300&cid=CJLTWPH7Sjaqxues
09/07/2020, 2:10 PMRandom.nextInt(0, 3)
for testing purposes)
As you can see in the screenshots below (1 -> 2), when having the content in the "extendedContent" changed, the card doesnt expand more to fit the contents. Now, when the Card is collapsed and expanded again (3), it resizes and looks how it should. However, if now the message disappears, it is again not resizing, meaning we have a lot of empty space (4)JulianK
09/07/2020, 3:16 PMJan Skrasek
09/07/2020, 3:56 PMMehdi Haghgoo
09/07/2020, 5:48 PMWhen a composable function is invoked, the invocation might occur on a different thread from the caller. That means code that modifies variables in a composable lambda should be avoided–both because such code is not thread-safe, and because it is an impermissible side-effect of the composable lambda. -link
Parallel execution in Compose is very new to me. Could someone tell me please how I can modify variables if I am not allowed to do it in a Composable lamda? Also, what does thread-safety mean in the above paragraph?
Victor Yakovlev
09/07/2020, 6:47 PMfillMaxHeight
inside component where height is wrapContentHeight
?Ali Zargar Shabestari
09/07/2020, 7:39 PMLazyColumnFor
. The problem is kind of hard to explain, so I included a video. depensing on the scroll position of Column recomposing with a subset list of items leads to empty list.Ali Zargar Shabestari
09/07/2020, 8:08 PMscaffold
is drawn behind the bottomBar
. is this the expected behaviour?
The content:
Text(modifier = Modifier.verticalScroll(rememberScrollState()),text = <a Long content>)
manueldidonna
09/07/2020, 9:35 PMBottomNavivation
composable (green accent) has a different ripple than BottomNavigationView
(red accent) from Material Components for Android (which is the same effect showed in the material guidelines)Mehdi Haghgoo
09/08/2020, 3:38 AMvideo▾
Vincent tiensi
09/08/2020, 4:32 AMSumit Sharma
09/08/2020, 5:49 AMNamig Tahmazli
09/08/2020, 6:41 AMefemoney
09/08/2020, 7:42 AMMehdi Haghgoo
09/08/2020, 7:54 AMBrett Best
09/08/2020, 8:23 AMMehdi Haghgoo
09/08/2020, 9:44 AMclass MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
DraftNotebookTheme {
Surface(color = MaterialTheme.colors.background) {
MyButton("Android")
}
}
}
}
}
@Composable
fun MyButton(label: String) {
Button(onClick = {}) {
Text(label)
}
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
DraftNotebookTheme {
MyButton("سلام دنیا")
}
}
When doing preview, the text shown on the button does not follow the font family I have set in the theme. Is this a bug?casablancais
09/08/2020, 11:10 AMNote : By convention, the modifier is specified as the first optional parameter of a function. This enables you to specify a modifier on a composable without having to name all parameters.Is there a reason why the AppTopBar Modifier was not put as the first parameter in the compose material TopAppBar implementation ?
@Composable
fun TopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
navigationIcon: @Composable (() -> Unit)? = null,
actions: @Composable RowScope.() -> Unit = {},
backgroundColor: Color = MaterialTheme.colors.primarySurface,
contentColor: Color = contentColorFor(backgroundColor),
elevation: Dp = TopAppBarElevation
) {...}
Yann Badoual
09/08/2020, 12:07 PMval (currentSize, setCurrentSize) = remember { mutableStateOf(Size.Zero) }
val matrix = remember(currentSize) {
Matrix().apply {
setRectToRect(
box,
RectF(0f, 0f, currentSize.width, currentSize.height),
Matrix.ScaleToFit.CENTER
)
}
}
remember(matrix) { // heavy work }
Canvas(modifier = Modifier.fillMaxSize()) {
setCurrentSize(size)
// Do some drawing ...
}
I didn't find any alternative to retrieve the size and be able to remember
some result with it as a key 🤔Yann Badoual
09/08/2020, 12:07 PMval (currentSize, setCurrentSize) = remember { mutableStateOf(Size.Zero) }
val matrix = remember(currentSize) {
Matrix().apply {
setRectToRect(
box,
RectF(0f, 0f, currentSize.width, currentSize.height),
Matrix.ScaleToFit.CENTER
)
}
}
remember(matrix) { // heavy work }
Canvas(modifier = Modifier.fillMaxSize()) {
setCurrentSize(size)
// Do some drawing ...
}
I didn't find any alternative to retrieve the size and be able to remember
some result with it as a key 🤔satyan
09/08/2020, 12:46 PMNader Jawad
09/08/2020, 4:42 PMYann Badoual
09/08/2020, 4:54 PMNader Jawad
09/08/2020, 4:55 PMYann Badoual
09/08/2020, 5:15 PM