Stefan Oltmann
03/14/2022, 12:37 PM.pointerInput(Unit) {}
can only take one argument?
I have one call to detectTransformGestures
, but if I add another thing like
detectTapGestures(
onPress = {
println("ON PRESS")
}
)
or detectDragGestures
before that it's never called.
Only the first of these are called and all others are ignored.
I don't know how I'm supposed to combine a drag handler with a pinch-zoom detection...
The "pan" does not help me, because I don't know when the drag is ended (the finger lifted).Daniele Segato
03/14/2022, 2:56 PMBenjamin Deroche
03/14/2022, 4:07 PMobject ButtonActionBar {
@Composable
fun RowScope.CancelButton(onClick: () -> Unit) {
Button(
modifier = Modifier.weight(2f),
onClick = onClick
) {
Text(
text = "Cancel"
)
}
}
}
@Composable
fun RowScope.PublishButton(onClick: () -> Unit) {
Button(
modifier = Modifier.weight(2f),
onClick = onClick
) {
Text(
text = "Publish"
)
}
}
Row(
modifier = Modifier.height(48.dp)
) {
SessionActionBar.CancelButton() {}
PublishButton {}
}
In this example the PublishButton
work fine but not the CancelButton
, if I remove the RowScope
it kinda work (but then I don't have access to weight
modifier) or need to move it outside of ButtonActionBar
object as the PublishButton
Jan Skrasek
03/14/2022, 4:25 PMfun OurTextField(modifier: Modifier) {
Column(modifier) {
Label()
TextField()
ErrorMessage()
}
}
So when our devs use it in UI tests, they pass testTag that is in the Column's modifier.
However, that breaks the bahavior, especially for setting a value to text field. (There is no SetText on Column).
What is the best solution for those high-level components:
• merge tree on column (something which will work nicely for SetText, worse for other texts; alternatively reexpose them - Text for input, new semantics for Label and Error)
• exposing tag names which ui tests may reused to specify "child" of the OurTextField
• do nothing and let ui tests to use onChildAt(1) to get access to TextField
• some other approach?danieeh
03/14/2022, 4:57 PMverticalScroll
behaviour to a Column.. compose needs be idle in order to proceed.. but when verticalScroll is in place, test is stuck doing something:
2022-03-14 17:52:52.078 16637-16651/com.compose.playground I/pose.playgroun: Background concurrent copying GC freed 633159(22MB) AllocSpace objects, 1(20KB) LOS objects, 49% free, 4055KB/8110KB, paused 371us total 798.298ms
https://github.com/danimontoya/compose-playground/commit/74bf12fc5c9df9118602ab3a1989cef618f6b005
I would like to keep the veticalScroll behaviour and the tests on that screen not stuck and green, as it works for phones (only happens on tablets == master/detail fragments).. any pointer whats going on??
thanks in advance 🙂Thomas Dougherty
03/14/2022, 10:27 PMBradleycorn
03/14/2022, 11:23 PMAndroidViewBinding
to load a FragmentContainerView
with “legacy” fragments (until we can get them converted to compose):
composable(route="my-screen") { AndroidViewBinding(MyFragmentBinding::inflate) }
What I’m struggling with is … when some action is taken in the Fragment (like say a button is clicked), I need to navigate to a new destination (route). How can I do that?james
03/15/2022, 12:45 AMWebView
in an AndroidView
for use in a compose app, I have need of methods on the webview instance outside of the wrapped component for example a refresh button that calls webView.loadUrl(…)
. How do I expose this to composable functions using the WebView
component? Unsure how to expose this from the wrapped componentYoshio Schermer
03/15/2022, 8:35 AMK Merle
03/15/2022, 9:46 AMOutlinedTextField
. Initial ExposedDropdownMenu
contains nested TextField
. I am unable to open keyboard when nested TextField
is focused.
How do I enable keyboard on nested TextField
?Alejandro Moya
03/15/2022, 1:30 PMfun dimensionResource(@DimenRes id: Int): Dp
returns DP dimensions, but there’s no SP version of it, is there a way to return the SP xml dimensions?Tobias Gronbach
03/15/2022, 1:35 PMEric Martori
03/15/2022, 1:45 PMNikos Kermanidis
03/15/2022, 2:48 PMLazyColumn
witch displays the stocks and each stock is real-time updated through web-socket events.
I am testing the LazyColumn performance (using a release build) and it’s dropping frames. The performance is not as good as it was with the RecyclerView (with DiffUtil). I also used the Recomposition highlighter from the Google play team and verified that my LazyColumn is constantly recomposing. I will include the code in the thread. Any ideas on how to improve the performance?Niklas Bolwede
03/15/2022, 9:11 PMjava.lang.IllegalStateException: Restoring the Navigation back stack failed: destination -1666506032 cannot be found from the current destination Destination(0xcf551cdb) route=SettingsNavGraph
Suser
03/16/2022, 5:01 AMJan Skrasek
03/16/2022, 8:26 AMisError
and another without is
- readOnly
?sindrenm
03/16/2022, 11:22 AMViewModelStoreOwner
, which might be a nav back stack entry or a fragment or whatnot, but not an “actual” composable, if that makes sense. However, if I have a list of similar items and I want each of them to have their own instance of a same-type View Model, then I'm at a loss on how to achieve this. Any suggestions?Prasad Mhapankar
03/16/2022, 11:42 AMTobias Gronbach
03/16/2022, 12:47 PMdimsuz
03/16/2022, 1:45 PMState
?
class State(
val value by mutableStateOf(false)
)
fun Component(state: State, reportValueChange: (Boolean) -> Unit)) {
val v = state.value
// how to call reportValueChange(v) here
// **only** when "v" changes?
}
I have tried snapshotFlow { state.value }.collect(::reportValueChange)
but it emits nothing on value changesYoshio Schermer
03/16/2022, 1:56 PMval ColorScheme.link: Color
get() = if(isLight) colorX else colorY
But, this doesn’t work with M3?dimsuz
03/16/2022, 2:33 PMif (prevState = 1 && state = 0) onEvent(...)
.
Sometimes this leads me to discovery that I think about the state wrong and I refactor, but sometimes I can't and I ask myself what's the best pattern to detect some thresholds in state changes?
Examples:
• ListColumn has just scrolled past 100 visible item, how to report this to analytics?
• Composable with swipeable
modifier has just finished settling after swipe. How to observe this change from swipeableState.isAnimationRunning
from true
to false
and report it to some other component?mertceyhan
03/16/2022, 4:04 PM<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
xmlns:app="<http://schemas.android.com/apk/res-auto>"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>
chansek
03/16/2022, 6:30 PMbottomSheet
from accompanist:
java.lang.IllegalArgumentException: The target value must have an associated anchor.
at androidx.compose.material.SwipeableState$snapTo$$inlined$collect$1.emit(Collect.kt:136)
at kotlinx.coroutines.flow.FlowKt__LimitKt.emitAbort$FlowKt__LimitKt(Limit.kt:73)
at kotlinx.coroutines.flow.FlowKt__LimitKt.access$emitAbort$FlowKt__LimitKt(Limit.kt:1)
at kotlinx.coroutines.flow.FlowKt__LimitKt$take$2$1.emit(Limit.kt:63)
at androidx.compose.material.SwipeableState$special$$inlined$filter$1$2.emit(Collect.kt:137)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invokeSuspend(SnapshotFlow.kt:134)
at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invoke(Unknown Source:8)
at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$snapshotFlow$1.invoke(Unknown Source:4)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:227)
at androidx.compose.material.SwipeableState$special$$inlined$filter$1.collect(SafeCollector.common.kt:114)
at kotlinx.coroutines.flow.FlowKt__LimitKt$take$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:115)
at androidx.compose.material.SwipeableState.snapTo(Swipeable.kt:943)
at com.google.accompanist.navigation.material.SheetContentHostKt.internalHide(SheetContentHost.kt:188)
at com.google.accompanist.navigation.material.SheetContentHostKt.access$internalHide(SheetContentHost.kt:1)
at com.google.accompanist.navigation.material.SheetContentHostKt$SheetContentHost$2$2$1.invokeSuspend(SheetContentHost.kt:145)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
How should I fix this up?
As per this SO question, the fix should be by mentioning the minHeight as 1 dp:
https://stackoverflow.com/questions/68623965/jetpack-compose-modalbottomsheetlayout-throws-java-lang-illegalargumentexception
But this solution doesn't work for me.hfhbd
03/16/2022, 7:38 PM@Composable
fun InfoButton(infoTest: String, button: @Composable (Modifier) -> Unit) {
Row(modifier = Modifier.fillMaxWidth()) {
Info(infoTest)
button(Modifier.fillMaxWidth())
}
}
This code renders the icon at the left side, I want to show them on the right sideAleon Q
03/16/2022, 7:42 PMText
composable in TextBasicBenchmark that uses ComposeBenchmarkRule. It uses a few methods that benchmarks the first composition, measure, draw, layout. The problem I am running into is what how would I be able to use that ComposeBenchmarkRule? I couldnt find any dependencies/library that exposes this class. Is this currently available for use in any jetpack compose testing libraries? How should I go about it?
Thanks for creating this space and allowing the questions to be asked. Much appreciated 🙌tavoeh
03/16/2022, 11:39 PMallan.conda
03/17/2022, 6:05 AMonNext
to Focus.DOWN
for example, or will it be handled by Compose?
• Software Keyboard Next, Enter
• Hardware Keyboard Tab, Shift+Tab, EnterNurseyit Tursunkulov
03/17/2022, 7:02 AMNurseyit Tursunkulov
03/17/2022, 7:02 AMbrabo-hi
03/17/2022, 9:14 AM