agrosner
09/30/2022, 3:41 PMShafayat 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 AMOleksandr Balan
10/01/2022, 12:31 PM.drawWithContent()
modifier. At the begining with the provided size you have to construct a list with all 6 hexagon points and then draw a path with lines starting from 1st point, to 2nd, then 3d and end in 4th. For animation purposes I would create a progress
state with infinity repeated animation from 0f to 1f, which will represent a "shift" of the start and end of the path along their lines. Thus when a progress
is set for example to 0.3f the starting point should be calculated on the line between 1st and 2nd point, end end point on the line between 4th and 5th point accordingly. When progress reaches 1f you should increment the starting index in the points array so that you will start with path: 2nd -> 3rd -> 4th -> 5th. Then you may style the path with rounded caps.adjpd
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
10/01/2022, 6:47 PMLazyListState
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 PMTower Guidev2
10/03/2022, 4:02 PMgithub
branch the app builds and installs ok however the compose navigation does not work
if i build an apk and distribute it to my team this works fine
we have compared gradle.properties
and local.properties
for all team members and these are identical to mine.
we are all using the same Android Studio version of
Android Studio Flamingo | 2022.2.1 Canary 2
Build #AI-222.4167.29.2221.9093980, built on September 22, 2022
Runtime version: 11.0.15+0-b2043.56-8887301 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.images.show.chessboard=true
Non-Bundled Plugins:
com.android.aas (3.5.1)
what could be causing this issue?
what config are we missing?
the part of the app that does not work for my colleagues is that the compose navigation does not work, the app employs a backdrop with menu items that allow the user to navigate to other sections of the application. clicking on these menu items only works for meMark T Gray
10/04/2022, 10:44 AMTower Guidev2
10/04/2022, 3:38 PM.idea
folder
we tried lots of other approaches before finding this 😄