Manuel Wrage
01/14/2020, 9:34 PMrootAmbient(MyAmbient
) or maybe all instances of the ambient above the tree?Ian Warwick
01/15/2020, 9:15 AMTextInput
or Text
when I double click on the text it turns the Text
into a TextInput
in the compose tree
@Composable
private fun Text(
element: TextElement,
inEdit: Boolean = false
) {
val textStyle = TextStyle(
background = Color.Transparent,
fontWeight = element.fontWeight,
fontSize = TextUnit.Em(element.fontSize),
color = element.color
)
val spacing =
Spacing(element.spacingLeft.dp, element.spacingTop.dp, element.spacingRight.dp, element.spacingBottom.dp)
if (inEdit) {
TextField(modifier = spacing, value = element.text, textStyle = textStyle, onValueChange = {
element.text = it
})
} else {
Text(modifier = spacing, text = element.text, style = textStyle)
}
}
It seems that even though Text
is being displayed Compose is still receiving text input via the missing TextInput
(see video) possibly.. I would expect that if a recompose occurs then it would not exist in this part of the compose graph anymore 🤔 any ideas?gpaligot
01/15/2020, 2:04 PMTextField
in my screen but the component have a weird behavior. When I type any text in the text field, there isn’t any visual in the component on the screen. Someone has already encountered this issue?
You can find my code here:
@Composable
fun Password(data: LoginForm) {
MyTextField(
hint = "Password",
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done,
onValueChange = { data.email = it }
)
}
@Composable
fun MyTextField(
hint: String,
onValueChange: (text: String) -> Unit,
keyboardType: KeyboardType = KeyboardType.Text,
imeAction: ImeAction = ImeAction.Unspecified
) {
val typography = +MaterialTheme.typography()
val model = +state { "" }
Padding(left = 8.dp, right = 8.dp, top = 8.dp) {
Column {
Text(
text = hint,
style = typography.subtitle1
)
HeightSpacer(height = 8.dp)
TextField(
value = model.value,
onValueChange = onValueChange,
keyboardType = keyboardType,
imeAction = imeAction,
textStyle = typography.body1,
modifier = ExpandedWidth
)
}
}
}
seb
01/15/2020, 2:14 PMcodeslubber
01/15/2020, 10:55 PMTextField
working (yay), but it looks awful and I wasted way too much time trying to figure out what I am supposed to ask for to get the border off the input…codeslubber
01/16/2020, 12:33 AMIan Warwick
01/16/2020, 11:37 AM@Model
annotated data classes in a different gradle module to where they are used in a compose tree? Just tried to move my model and when I run my app there are not recompositions when my model changes? 😞Ian Warwick
01/16/2020, 2:46 PM<group>
tag into my vector drawable xml to rotate it 90 degrees and it shows up in preview but not in app with DrawVector
shows up blank 🤔Roar Gronmo
01/16/2020, 6:42 PMKlaas Kabini
01/17/2020, 7:56 AMKlaas Kabini
01/17/2020, 8:07 AMamar_1995
01/17/2020, 12:31 PM+onCommit
and it is working perfectly fine. But I am unable to understand when onDispose
is called.
var user : User? = null
// Active type use-case
+onCommit(1) {
user = UserAPI.getUserData()
onDispose {
UserAPI.letDiscompose() // It contains only println line
}
}
Klaas Kabini
01/18/2020, 3:29 PMitnoles
01/19/2020, 1:14 AMArrangement.End
it doesn't expand into the right side of the view. Am I missing something?Joseph Cheng
01/19/2020, 1:50 PMsetContent {
MaterialTheme {
ColoredRect(color = Color.Blue, width = 100.dp, height = 50.dp)
}
}
But once I put a Container
as the parent, it works as expected. May I know why?
setContent {
MaterialTheme {
Container {
ColoredRect(color = Color.Blue, width = 100.dp, height = 50.dp)
}
}
}
Ian Warwick
01/19/2020, 7:55 PMCaused by: java.lang.IllegalStateException: Not in a frame
at androidx.compose.frames.FramesKt.currentFrame(Frames.kt:180)
Is it related? happens when I use IO
scope and not sure if its just me doing something wrong or I hit a known issueshikasd
01/20/2020, 6:53 PMIan Warwick
01/21/2020, 8:28 PMamar_1995
01/22/2020, 11:24 AMkapt
and compose
and so that it throws backend IR
error.
But now in build gradle file i removed below line and it worked.
buildFeatures {
compose true
}
Now even removing this line I am able to call compose function and load ui.
So, what does this line means and its purpose.Manuel Wrage
01/22/2020, 2:21 PMjetzajac
01/25/2020, 4:51 PMKlaas Kabini
01/26/2020, 10:21 AMcarbaj0
01/26/2020, 4:33 PMcarbaj0
01/26/2020, 4:33 PMFloatingActionButton(
text = "aa",
elevation = 7.dp,
textStyle = (+typography()).body1.copy(color = Color.White),
onClick = { Snackbar(text = "dsaf") }
)
java.lang.IllegalStateException: Composition requires an active composition contextKlaas Kabini
01/27/2020, 5:46 AMamar_1995
01/27/2020, 11:21 AMIO
thread. But as, I use this in below code, It will throw eroor Not in a frame
fun<T> observer(data: LiveData<T>) = effectOf<T?> {
var result = +state<T?> { data.value }
val observer = +memo { Observer<T> { result.value = it }}
+onCommit(data) {
data.observeForever(observer)
onDispose { data.removeObserver(observer) }
}
// commit()
result.value
}
Nikita Prokopov
01/27/2020, 1:24 PMcarbaj0
01/27/2020, 2:58 PM+imageResource(R.drawable.ic_arrow_core_lines_white)
do Compose support vectors?marstran
01/27/2020, 9:55 PMDrawImage
. But I cannot seem to import the DrawImage
function. Do anyone know what I might be doing wrong?amar_1995
01/28/2020, 2:10 PM@Composable
private fun ShowArticle(
articleList: List<NewsArticle>
) {
val scrollerPosition: ScrollerPosition = +memo {ScrollerPosition(0f)}
if(scrollerPosition.isAtEndOfList) {
newArticleModel.loadMoreNationData(2)
}
VerticalScroller(scrollerPosition = scrollerPosition) {
Column(Expanded) {
articleList.forEach {
ArticleTicket(
backgroundColor = (+MaterialTheme.colors()).background,
article = it
)
}
}
}
}
val ScrollerPosition.isAtEndOfList: Boolean get() = value >= maxPosition
amar_1995
01/28/2020, 2:10 PM@Composable
private fun ShowArticle(
articleList: List<NewsArticle>
) {
val scrollerPosition: ScrollerPosition = +memo {ScrollerPosition(0f)}
if(scrollerPosition.isAtEndOfList) {
newArticleModel.loadMoreNationData(2)
}
VerticalScroller(scrollerPosition = scrollerPosition) {
Column(Expanded) {
articleList.forEach {
ArticleTicket(
backgroundColor = (+MaterialTheme.colors()).background,
article = it
)
}
}
}
}
val ScrollerPosition.isAtEndOfList: Boolean get() = value >= maxPosition
Manuel Wrage
01/28/2020, 2:12 PMamar_1995
01/28/2020, 2:23 PMval observe = Observer<Boolean> {
if (it) {
newArticleModel.loadMoreNationData(2)
}
}
observe.onChanged(scrollerPosition.isAtEndOfList)
Like this ?Manuel Wrage
01/28/2020, 2:23 PMandroidx.compose.Observe {
if(scrollerPosition.isAtEndOfList) {
newArticleModel.loadMoreNationData(2)
}
}
Like thisamar_1995
01/28/2020, 2:27 PMManuel Wrage
01/28/2020, 2:27 PMChuck Jazdzewski [G]
01/28/2020, 11:11 PMObserve
is a confusing name. Any recommendations for renaming it?Val Salamakha
01/29/2020, 5:01 AMManuel Wrage
01/29/2020, 10:16 AMKlaas Kabini
02/12/2020, 4:18 AM