zt
06/18/2022, 12:53 AMzt
06/18/2022, 3:54 AMLokik Soni
06/18/2022, 5:28 PMdata class AddEditNoteState(
val color: Int = Note.noteColors.random().toArgb(),
)
In ViewModel:
private val _addEditNoteSate = MutableStateFlow(AddEditNoteState())
val addEditNoteState = _addEditNoteSate
.asStateFlow()
.stateIn(viewModelScope, WhileViewSubscribed, AddEditNoteState())
In Compose:
val addEditNoteState by rememberFlowWithLifecycle(viewModel.addEditNoteState).collectAsState(AddEditNoteState())
val noteBackgroundColor = remember {
Animatable(
Color(if (noteColor != -1) noteColor else addEditNoteState.color)
)
}
Now when I access addEditNoteState.color and noteBackgroundColor.value Both are different. Not able to find the error.
Note (noteColor != -1) is not true means we are using addEditNoteState.color in Animatable*Marcin Wisniowski
06/18/2022, 7:10 PMhttps://raw.githubusercontent.com/googlesamples/mlkit/master/android/material-showcase/screenshots/live_barcode.gif▾
Chris Fillmore
06/18/2022, 9:22 PMzt
06/18/2022, 11:30 PMdetectDragGesturesAfterLongPress
where I'm able to handle the gesture differently depending if its horizontal or vertical? there's handlers for those directions but neither of them are after a long presskotlinforandroid
06/19/2022, 11:27 AMInlineTextContent
. I am trying to add readings annotations to existing text. However, if I simply add the exact same text using a placeholder, the text gets added written vertically for some reason. I think the reason is that the placeholder width isn't exactly the same as the width the original text would have needed. But the way I did it I do not see the issue. (thread)Arjan van Wieringen
06/19/2022, 2:26 PMState
as input of your root composable and have all subcomposables take either directly some subelements of that state or some derivedState
? I can imagine that the runtime will trigger a recalc on the root component every time the top-level state is changed and this might be suboptimal.Ali
06/19/2022, 6:16 PMorangy
06/19/2022, 8:31 PMAnnotatedString
and InlineTextContent
and what blocks me is the static structure of Placeholder
’s width & height. What I’d like to have is placeholder’s size to be derived from the text measurements it replaces. For example, like this text in Slack
I’d like to put background (that I can with SpanStyle) and a border (which is missing from SpanStyle) with rounded rectangle (also not in SpanStyle). I could do this easily with InlineTextContent
if only I could measure it relative to text size, e.g. with some margins/paddings, etc. Any ideas? Thanks!Yacov Rosenberg
06/19/2022, 9:30 PMYacov Rosenberg
06/19/2022, 9:30 PMChris Fillmore
06/20/2022, 3:00 AMDropdownMenu
-like composable that is a row instead of column? I just want a floating tray of icons basicallyzt
06/20/2022, 3:23 AMJitendra
06/20/2022, 3:41 AMfengdai
06/20/2022, 7:42 AMAndroidView
recreate view when LocalContext.current
changed?Mahdi Safarmohammadloo
06/20/2022, 8:54 AMSatyam G
06/20/2022, 11:19 AMallan.conda
06/20/2022, 11:47 AMstartDestination
and the FTUE destination on startup? I’m not sure why the startDestination
is still rendered briefly even if the backstack already has the FTUE destination at the top of the queue before the first render (via onPreDrawListener).
We’re trying to keep following the navigation principles about above scenario but the flicker is really ugly. Anyone solved this yet?Tower Guidev2
06/20/2022, 11:54 AMandroidx.compose.material.BackdropScaffold
i am attempting to use compose Material3
theming.
however my backdrop doesnt react to switching between light and dark mode,
where other activities do.
is this because BackdropScaffold
is not a Material3
component?
How do i get backdrop theme to respect Light & Dark mode ?Cyril Kym
06/20/2022, 12:24 PMkotlinforandroid
06/20/2022, 12:27 PMText
respect the height constraint of InlineTextContent
? As of now, if I use inline content that is too tall, it starts to overlap with the text from the line above. Ideally, Text
would somehow increase the line height during rendering to not introduce such overlays.Jan Skrasek
06/20/2022, 12:50 PMincludeFontPadding = false
and LineHeightStyle.Align.Center
+ LineHeightStyle.Trim.None
.
I observe an issue in TextField - if it is empty, the cursor gets smaller/decreased.
This seems to be issue only with my proprietary font - the default font is ok. Anyway how to debug what's wrong?
Some font-metric could be off? But why it is present only with empty value?
Issue is similar to this fixed one.
cc @Siyamedziv kesten
06/20/2022, 1:13 PMfun Modifier.advancedShadow(
color: Color = Color.Black,
alpha: Float = 0f,
cornersRadius: Dp = 0.dp,
shadowBlurRadius: Dp = 0.dp,
offsetY: Dp = 0.dp,
offsetX: Dp = 0.dp
) = drawBehind {
val shadowColor = color.copy(alpha = alpha).toArgb()
val transparentColor = color.copy(alpha = 0f).toArgb()
drawIntoCanvas {
val paint = Paint()
val frameworkPaint = paint.asFrameworkPaint()
frameworkPaint.color = transparentColor
frameworkPaint.setShadowLayer(
shadowBlurRadius.toPx(),
offsetX.toPx(),
offsetY.toPx(),
shadowColor
)
it.drawRoundRect(
0f,
0f,
this.size.width,
this.size.height,
cornersRadius.toPx(),
cornersRadius.toPx(),
paint
)
}
}
But it's not perfect.Bradleycorn
06/20/2022, 3:40 PMonCreate
looks like this:
WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
MyAppTheme {
val systemUIController = rememberSystemUiController()
SideEffect {
systemUIController.setStatusBarColor(
color = Color.Transparent,
darkIcons = true
)
}
}
}
But the status bar is rendered as solid white, as shown in this screenshot (note how the text at the top is cut off as it scrolls under the status bar)Vaios Tsitsonis
06/20/2022, 4:36 PMLokik Soni
06/20/2022, 4:48 PMBilly Newman
06/20/2022, 6:51 PMzt
06/20/2022, 7:38 PMLuke
06/20/2022, 7:50 PMlineHeight
for Text
in Compose? I know the default value is TextUnit.Unspecified
, but I want to have a lineHeight
that is whatever default value, times a value given from our backend.Luke
06/20/2022, 7:50 PMlineHeight
for Text
in Compose? I know the default value is TextUnit.Unspecified
, but I want to have a lineHeight
that is whatever default value, times a value given from our backend.