Shivam Sethi
02/27/2021, 5:51 AMShivam Sethi
02/27/2021, 8:13 AMSmorg
02/27/2021, 8:24 AMHigh number of internal exceptions has been detected. This indicates a serious problem with the IDE. Please consider clean reinstall of Android Studio. If the problem persists, please report a bug by following the link below.
Anyone else experiencing this?Archie
02/27/2021, 9:55 AMViewModel
to a NavGraph
.
@Composable
inline fun <reified VM : ViewModel> navGraphViewModel(
route: String,
navController: NavController,
): VM {
// Now get the NavBackStackEntry associated with the parent
val backStackEntry = navController.getBackStackEntry(route)
val context = LocalContext.current
return ViewModelLazy(
viewModelClass = VM::class,
storeProducer = { backStackEntry.viewModelStore },
factoryProducer = { HiltViewModelFactory(context, backStackEntry) }
).value
}
Was wondering how others are doing theres? (I am using Hilt for my project, the ViewModelFactory could be passed in if you are not using Hilt)A. Sachdeva
02/27/2021, 10:35 AMsetContent{
and LazyColumn{
what are the new alternatives for these?Spikey Sanju
02/27/2021, 10:48 AMif
and else
block?Spikey Sanju
02/27/2021, 11:08 AMMale
& Female
. I'm repeating this code block for two times here. Below code works but I guess it can be optimised. Any Suggestion?
I have also attached image of the both chip viewsloloof64
02/27/2021, 1:05 PMAn exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> java.lang.NoSuchMethodException: java.lang.invoke.MethodHandles.privateLookupIn(java.lang.Class, java.lang.invoke.MethodHandles$Lookup)
I'm compiling with Java 8 from AdoptOpenJDKA. Sachdeva
02/27/2021, 1:56 PMSlackbot
02/27/2021, 2:56 PMVipulyaara
02/27/2021, 3:13 PM\n
with no help. The first line of text is justified if I set maxLines = 2
and let the text flow in second line.
I am not so familiar with how justification works on android but is there a way to achieve this - a single line of text which can stretch to occupy full width of the screen?Gabriel
02/27/2021, 3:49 PMSpikey Sanju
02/27/2021, 4:27 PMMalte Heitmüller
02/27/2021, 5:05 PMSergey Y.
02/27/2021, 6:09 PMnatario1
02/27/2021, 7:23 PMheight="wrap_content"
.robnik
02/27/2021, 8:06 PMrememberSavable
and savedInstanceState
. Both are mentioned in https://developer.android.com/jetpack/compose/state. They look like they do the same thing.A. Sachdeva
02/27/2021, 8:29 PMSnapshotStateList
directly for learning purposes instead of using mutableStatelistof.
But:
1. the on click log and delete action seems to work, but when done too quickly, started giving index out of bounds. is it because of my implementation?
2. my main goal was to show a toast on item click, but could not access LocalContext.current
, so had to test with logs. how to get context?
3. onEdit was not working immediately, but would show effect after scrolling. if it was recycler view, i would say a classic problem of adapter not reflecting latest changes due to lack of notifydatasetchanged call. so again, what did i missed?Gabriel
02/27/2021, 9:50 PMTash
02/27/2021, 10:13 PMDaniel
02/27/2021, 10:56 PM@Composable
private fun Page(page: PageRenderer /* @Immutable data class, never changes */, turn: Dp = 0.dp /* changes frequently in animations */) {
Surface(
Modifier
.fillMaxSize()
.background(page.background)
.offset {
IntOffset(
-turn
.toPx()
.roundToInt(), 0
)
}
.drawWithCache {
onDrawWithContent {
drawContent()
drawIntoCanvas {
Timber.i("Drawing into canvas")
page.paint(it)
}
}
},
elevation = 15.dp
) {}
}
Based on my logs, I noticed that drawIntoCanvas
was called every time turn
changed, which I was very surprised by. (I thought the whole point of offset taking a lambda would prevent that)
I fixed the issue by adding another component, but I'm confused by why this was necessary
@Composable
private fun Page(page: PageRenderer, turn: Dp = 0.dp) {
Surface(
Modifier
.fillMaxSize()
.background(page.background)
.offset {
IntOffset(
-turn
.toPx()
.roundToInt(), 0
)
},
elevation = 15.dp
) {
Canvas(Modifier.fillMaxSize()) {
drawIntoCanvas {
Timber.i("Drawing into canvas")
page.paint(it)
}
}
}
Rahul Sainani
02/27/2021, 11:17 PMDaniel
02/27/2021, 11:26 PMremember
Yofou
02/28/2021, 5:09 AMCh8n
02/28/2021, 9:11 AMgif
image from raw files in composing? I'm using GlideImage library..Shakil Karim
02/28/2021, 11:33 AMMehdi Haghgoo
02/28/2021, 12:38 PMAndré Thiele
02/28/2021, 1:24 PMandroidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: You are using an outdated version of Compose Runtime that is not compatible with the version of the Compose Compiler plugin you have installed. The compose compiler plugin you are using (version 1.0.0-alpha13) expects a minimum runtime version of 1.0.0-alpha13.
Spikey Sanju
02/28/2021, 2:09 PMDaniel
02/28/2021, 2:22 PMDaniel
02/28/2021, 2:22 PMjim
02/28/2021, 5:31 PMDaniel
02/28/2021, 5:33 PMPageRenderer
that is responsible for knowing what text is on the current page where. All I'm doing is copying from what CoreText
uses, stripping out anything I don't need (like cross-composable selection)