allan.conda
10/20/2020, 12:48 AMJeremy
10/20/2020, 3:18 AMMohamed Elfiky
10/20/2020, 4:02 AMLayer is redrawn for LayoutNode in state NeedsRelayout
?Hyun
10/20/2020, 4:18 AMfunction
vs `class`(as swiftUI also based on function but also able to use struct)
So, I just tried to use class
for Composable if it’s meaningful.
Kindly review if it’s reasonable or not.
the below is the sample code with class
Screen(Composable class)
class ApiSingleScreen(private val model: ApiSingleViewModel = ApiSingleViewModel()) : Screen(model) {
override val title: String = R.string.single_call.resourceToString()
//for Composer to recognize the class
@Composable
override fun compose() {
super.compose()
}
@Composable
override fun view() {
Column {
Text("current value : ${+model.result}")
SampleTextField("Input value", model.input)
Button("update") {
model.onClick()
}
}
}
}
ViewModel
class ApiSingleViewModel(private val api: PreferenceApi = serviceLocator.preferenceApi) : BaseViewModel() {
//DataFlow will be migrated to MutableSharedFlow. as coroutine-native-mt 1.4.0 is not yet released. I customized Flow.
val result by lazy { DataFlow<String>() }
//if result is changed, input also changed.
val input by add { DataFlow<String>().withSource(result) }
override fun onInit() {
//initStatus is connected with loading, error ui. so, when call api, loading, error ui is shown by the state
result.load(initStatus) {
api.getString(KEY) ?: ""
}
}
fun onClick() {
result.load(status) {
val text = input.value?: error("please input")
api.setString(KEY, text)
text//set changed text after api call is success
}
}
}
If There is something wrong on my opinion. kindly advise me to learn.🙏P.J.
10/20/2020, 11:11 AMDmytro Bazunov
10/20/2020, 11:30 AMExecution failed for task ':app:prepareDevDebugKotlinCompileTask'.
> org/jetbrains/kotlin/gradle/tasks/KotlinCompile
Exception says:
Caused by: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/gradle/tasks/KotlinCompile
at com.android.build.gradle.tasks.PrepareKotlinCompileTask.doTaskAction(PrepareKotlinCompileTask.kt:71)
Maybe someone got similar issue or knows how to fix it?Karthick
10/20/2020, 1:46 PMMouaad
10/20/2020, 3:56 PMcreateBottomBarrier
started to crash since 1.0.0-alpha05
with this:
java.lang.NullPointerException: Attempt to invoke interface method 'androidx.constraintlayout.core.widgets.ConstraintWidget androidx.constraintlayout.core.state.Reference.getConstraintWidget()' on a null object reference
.
I assume something changed?Se7eN
10/20/2020, 4:04 PMtransitionDefinition<StoryState>{
state(StoryState.START) {
this[progress] = 0f
}
state(StoryState.END) {
this[progress] = 1f
}
transition(StoryState.START to StoryState.END) {
progress using tween(5000, delayMillis = 500, easing = LinearEasing)
}
}
I'd like to pause and resume the transition on a certain event. I guess we can't do that so what can I do?jaqxues
10/20/2020, 4:15 PMandroidx.navigation:navigation-compose:1.0.0-SNAPSHOT
I do want to avoid Fragments, but I do not want to rewrite it every day because its a snapshotZach Klippenstein (he/him) [MOD]
10/20/2020, 6:48 PMNew experimental api RestorableStateHolder. It allows to save the state defined with [savedInstanceState] and [rememberSavedInstanceState] for the subtree before disposing it to make it possible to compose it back next time with the restored state.
Zach Klippenstein (he/him) [MOD]
10/20/2020, 7:14 PMnickbutcher
10/20/2020, 8:01 PMGabriel
10/20/2020, 8:40 PMMihai Hrincescu
10/20/2020, 8:45 PM.clickable()
modifier when i scale up a @composable
using .drawLayer()
the hit box not only it does not scale up but it actually scales down and moves down and to the right proportionate to where the the @composable
is placed inside of the available space. Should i just change the size instead or is this just a bug and scaling a @composable
should also scale the hit box?Sebastian Neagrau
10/20/2020, 9:47 PMchris-horner
10/20/2020, 10:28 PMSubhi Pandey
10/21/2020, 6:02 AMSpikey Sanju
10/21/2020, 9:12 AMalorma
10/21/2020, 9:38 AM@Composable
val Colors.success: Color
get() = if (isSystemInDarkTheme()) {
green200
} else {
green800
}
@Composable
val Shapes.fab: Shape
get() = RoundedCornerShape(percent = 50)
MaterialThemes.Colors.success
MaterialThemes.Shapes.fab
Chethan
10/21/2020, 11:52 AMMohamed Elfiky
10/21/2020, 12:11 PMDavid Edwards
10/21/2020, 1:35 PMfillMaxHeight
set. The sibling does not grow to fill the new height of its parent. I have made a gif to illustrate what I mean, the sibling is highlighted blue. If I set the Row to a fixed height, the issue does not happen.Bryan Herbst
10/21/2020, 2:44 PMMaterialTheme.Typography
), but I’d like to lean on Material for a number of components such as Button
.
Specifically looking at Button
, I’d like to use my own FancyTheme.typography.button
instead of MaterialTheme.typography.button
.
My first thought was to do something like
@Composable
fun FancyButton(content: @Composable RowScope.() -> Unit) {
Button {
ProvideTextStyle(
value = FancyTheme.typography.button,
children = content
)
}
}
But that doesn’t quite work since ProvideTextStyle
’s content doesn’t accept a RowScope
receiver.
Is there a better way to do this?bruno.aybar
10/21/2020, 4:58 PMpourpre
10/21/2020, 9:07 PMnavigation-compose
?
Specifically, adding a NavOptions?
parameter to the NavController.navigate
extension function.fabio.carballo
10/21/2020, 9:26 PMVerticalButtonContainer(
top = {
TertiaryButton(
text = "Tertiary",
onClick = { },
)
},
bottom = {
PrimaryButton(
text = "Primary",
onClick = {},
)
}
)
@Composable
fun VerticalButtonContainer(
top: @Composable () -> Unit,
bottom: @Composable () -> Unit
) {
Column(
Modifier
.fillMaxWidth()
.padding(16.dp)
) {
top()
Spacer(Modifier.height(16.dp))
bottom()
}
}
In this case both top
and bottom
would ideally expand to the max width of the container. However (naturally) the buttons are still wrapping the content. Any way I can tweak the internals of this VerticalButtonContainer
to force the children to expand the width?Artem Sharypov
10/21/2020, 9:29 PMUnable to load class 'org.jetbrains.kotlin.gradle.tasks.KotlinCompile'.
For reference it’s on kotlin 1.14.10
, 1.0.0-alpha05
for the compose version, android gradle 4.1.0
, and on android studio 4.2 canary 14,Guy Bieber
10/21/2020, 11:41 PMGuy Bieber
10/21/2020, 11:47 PMvar pages : MutableList<PagerDataModel.Page> = mutableStateListOf()
// is the added item also mutableStageOf
// note there is no such thing as a MutableStateList.
pages.add(...)
Guy Bieber
10/21/2020, 11:47 PMvar pages : MutableList<PagerDataModel.Page> = mutableStateListOf()
// is the added item also mutableStageOf
// note there is no such thing as a MutableStateList.
pages.add(...)
jim
10/21/2020, 11:50 PM