agrosner
09/30/2022, 3:40 PMLazyVerticalGrid
. So we have set up using GridCells.Fixed(100)
to emulate percentage span size for items. To enable 50%, 33%, etc on the items on a grid. What we are finding is that compose seems to think that in a two column layout (50 span each), the first cell at (50 span) is always slightly larger than the other one and there is no way seemingly to fix it. Is this a known issue?Shafayat Bin Mamun
09/30/2022, 6:49 PMdewildte
09/30/2022, 6:57 PMwiktor
09/30/2022, 7:41 PMPaul Woitaschek
10/01/2022, 8:58 AM@Composable
private fun <T> suspendingGet(default: T, get: suspend () -> T): T {
var value by remember { mutableStateOf(default) }
LaunchedEffect(Unit) {
value = get()
}
return value
}
Ahmed Sellami
10/01/2022, 11:38 AMbodo
10/01/2022, 11:57 AMadjpd
10/01/2022, 12:35 PMSmorg
10/01/2022, 2:30 PMCaused by: java.lang.IllegalStateException: couldn't find inline method Landroidx/lifecycle/viewmodel/compose/ViewModelKt;
. Any suggestions on how to fix this?肖志康
10/01/2022, 2:31 PMTextField
in my app but got pomeblems.
1. Some annotations
were assigned to the TextFieldValue
, but in the onValueChange
callback all the annotations are gone.
2. I also applied some SpanStyle
to the text. But if using GBoard to type in this TextField
, it can only have 1 character to be applied in the textfield, and kept calling onValueChange
with same value.
I tried 1.2.1
and 1.3.0-beta03
but got the same behavior, any fix plans or workaround suggestions?Android75
10/01/2022, 2:45 PMdata class ImageTransitionData(
var imageList: List<Image> = emptyList()
)
data class Image(var src: Bitmap?, var alpha: Float = 0f)
// screen
var pageState = viewModel.uiState.collectAsState().value
pageState.imageList.forEach { image ->
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
BitmapImage2(
image.src, image.alpha
)
}
}
@Composable
fun BitmapImage2(image: Bitmap?, alpha:Float) {
val imageBitmap = remember {
mutableStateOf<ImageBitmap?>(null)
}
image?.apply {
imageBitmap.value = this.asImageBitmap()
}
imageBitmap.value?.let {
Image(
modifier = Modifier.fillMaxSize(),
bitmap = it,
contentDescription = "",
contentScale = ContentScale.Fit,
alpha = alpha
)
}
Log.d("touch", "TOUCH ${ alpha}")
}
Ok this works.. screen shows first image in alpha 1f
i want change first image alpha… so…
private fun setPercentage(percentage: Float) {
if(percentage >=0){
var image = uiState.value.imageList.toMutableList()
image.get(0).alpha = percentage /100
uiState.value = uiState.value.copy(
imageList= image.toList()
)
Log.d("touch", "TOUCH ${image.map { "Alpha:${it.alpha} - " }}")
}
}
it’s strange , i changed array but i dont’see recompositionrkeazor
10/01/2022, 3:24 PMorangy
LazyListState
how do I write a function to “bring item into view”? So that it would do minimal required scrolling to make an item entirely visible. I can’t find all the needed data, or just slow tonight 🙂Smorg
10/01/2022, 10:55 PMmgrazianodecastro
10/01/2022, 10:59 PMDisplayList
to produce information to the RenderTread on the sync process?mgrazianodecastro
10/01/2022, 11:13 PMRenderNodes
are like the DisplayList
, but for the purpose to fulfill the compose piplineShafayat Bin Mamun
10/02/2022, 4:54 AMAndroid75
10/02/2022, 8:15 AMShafayat Bin Mamun
10/02/2022, 4:34 PMDjaka Pradana Jaya Priambudi
10/02/2022, 8:40 PMmolecule
library and migrating my presenter code into composable
function. But some function that have primitives parameter recomposed multiple times when it doesn't need to be.
code in thread
I expect presentCountryListState
to be recomposed everytime either initialState
is changed or query
is changed. This is true, it will always recompose when query changed but when I look at the console everytime query changed this log shows:
Recomposition for presentCountryListState
Recomposition for present
Recomposition for presentCountryListState
Recomposition for present
Notice that it run the function twice somehow
Anyone know why this is happening?zt
10/02/2022, 10:07 PMSurface {
Taxi(
modifier = Modifier.fillMaxSize(),
navigator = navigator,
transitionSpec = { fadeIn() with fadeOut() }
) { destination ->
when (destination) {
is AppDestination.Root -> RootScreen(navigator)
is AppDestination.Search -> SearchScreen(navigator = navigator)
is AppDestination.Player -> PlayerScreen(
navigator = navigator,
videoId = destination.videoId
)
is AppDestination.Channel -> ChannelScreen(
navigator = navigator,
channelId = destination.channelId
)
is AppDestination.Settings -> SettingsScreen(onClickBack = navigator::pop)
}
}
}
Settings, Search, Player, Channel should all be scoped to the one screen.
I'm using koin for injecting my viewmodels like this
fun SearchScreen(
viewModel: SearchViewModel = getViewModel(),
navigator: BackstackNavigator<AppDestination>
) {
Tim Malseed
10/03/2022, 12:02 AMAli Khaleqi Yekta
10/03/2022, 5:06 AMBasicTextField
.
A solution I'm currently using is using the onTextLayout
callback and from there, accessing textLayoutResult.getCursorRect(textFieldValue.selection.end).top
. This works perfectly fine, but, It's only re-evaluated during a change in text layout and moving the cursor doesn't trigger that. So a solution I could think of is forcefully trigger onTextLayout
on each change of cursor; but I don't know how and plus, it's probably inefficient and definitely hacky. Can anyone provide another solution or maybe an idea for triggering onTextLayout
?Asad Mukhtar
10/03/2022, 6:08 AMprivate val _flightList = MutableLiveData<List<MultiCityFlightListingUiModel>>()
val flightsList: LiveData<List<MultiCityFlightListingUiModel>> = _flightList
For e.g I set the values on response of api, and observe that live data in the UI to show the appropriate results.Tower Guidev2
10/03/2022, 10:04 AMproduceState
and collectAsState
?
val stateFlow by produceState<Flow<Stateable>>(initialValue = flowOf(InitialState), true) {
value = viewModel.reduce(ActivitySearch)
}
val state by stateFlow.collectAsState(initial = InitialState)
in my composable?
is there an approach where i can combine the produceState
with the collectAsState
?Vaios Tsitsonis
10/03/2022, 12:16 PMImage(painter = painterResource(id = R.drawable.svg_name), contentDescription = "")
and I get the following error: java.lang.IllegalArgumentException: Unknown command for: R
Is there some sort of limitation? Is there any way to overcome this issue?qlitzler
10/03/2022, 12:27 PMandroidx.compose.ui.graphics.Path
, and by extension an android.graphics.Path
, be considered as @Stable
or @Immutable
?
I know the compose compiler doesn’t think so by default. I’m trying to assess if I could add the @Stable
or @Immutable
annotation myself.rocketraman
10/03/2022, 1:48 PMincludeFontPadding = false
and lineHeightStyle
(the former does help a bit, the latter makes no difference, probably because my text is a single line), however I still get a lot of padding above and below my text. Is there a way to make that space smaller?themishkun
10/03/2022, 2:36 PMTower Guidev2
10/03/2022, 4:02 PM