Kyant
10/31/2020, 11:42 PMSurface
(foreground) or Image
(itself)?Socheat KHAUV
11/01/2020, 1:04 AMrememberCoroutineScope { <http://Dispatchers.IO|Dispatchers.IO> }
i get the following error when build gradle
org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node:
Samsruti Dash
11/01/2020, 6:24 AMHitanshu Dhawan
11/01/2020, 7:55 AMIntPropKey()
and set the x,y coordinates using Layout
composable? or is there any better way of achieving this?jaqxues
11/01/2020, 9:13 AMgsala
11/01/2020, 9:40 AMKamilH
11/01/2020, 11:16 AMcompose
project after a while, tried to compile a project and it is not compiling, I’m getting:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:prepareDebugKotlinCompileTask'.
> org/jetbrains/kotlin/gradle/tasks/KotlinCompile
Seems like it’s something unexpected, because:
Unable to load class 'org.jetbrains.kotlin.gradle.tasks.KotlinCompile'.
This is an unexpected error. Please file a bug containing the idea.log file.
but maybe someone else seen this already?loloof64
11/01/2020, 12:33 PM60.dp.toPx()
Inside a composable ?jaqxues
11/01/2020, 2:45 PMviewModel<ViewModelClass>()
function to get a ViewModel in Compose with Hilt/Dagger?
Something that i can use like this
@Composable
inline fun <reified T: ViewModel> viewModel() =
(ContextAmbient.current as MainActivity).viewModels<T>()
@Composable
fun Example() {
val viewModel by viewModel<SomeViewModel>()
viewModel.doStuff()
}
The above works, but it certainly is not elegant or safe or anythingRobert Menke
11/01/2020, 8:14 PMScaffold
with bottom navigation uses a NavHostController to define each screen in the bottom navigation. When I declare my 2nd nav host I get the error
java.lang.IllegalStateException: ViewModelStore should be set before setGraph call
Vinay Gaba
11/01/2020, 9:36 PM@Composable
internal fun BackButtonHandler(onBackPressed: () -> Unit) {
Providers(
AmbientBackPressedDispatcher provides LifecycleOwnerAmbient.current as AppCompatActivity
) {
handler {
onBackPressed()
}
}
}
Chethan
11/02/2020, 4:44 AMMahdi
11/02/2020, 6:34 AMOutlinedTextField
Can not trigger clickable lambda? Even if I wrap it with Box it will same. ThanksAnita
11/02/2020, 6:51 AMKshitij Patil
11/02/2020, 7:54 AMcanvas.drawLine
and canvas.drawPath
?
when to use one over the other?Slackbot
11/02/2020, 8:28 AMNeil
11/02/2020, 9:44 AMizyaboi
11/02/2020, 10:49 AMNavHost(navController, startDestination = NavigationScreen.Home.route) {
composable(NavigationScreen.Home.route) { Home(navController) }
composable(NavigationScreen.Playlist.route) { Playlist() }
composable(Screen.Detail.route) { DetailScreen()}
}
navigation works but not like i implement it as second activity with start activity.Grigorii Yurkov
11/02/2020, 2:34 PMmap
analog for MutableState
?Yuri
11/02/2020, 2:55 PMnewIR
with 1.4.20-RC
on my project.
Getting this compilation error with no details attached.
e: java.lang.IncompatibleClassChangeError: Found class org.jetbrains.kotlin.ir.declarations.IrClass, but interface was expected
at androidx.compose.compiler.plugins.kotlin.VersionChecker.check(VersionChecker.kt:62)
at androidx.compose.compiler.plugins.kotlin.ComposeIrGenerationExtension.generate(ComposeIrGenerationExtension.kt:40)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade$doGenerateFiles$1.invoke(JvmBackendFacade.kt:91)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade$doGenerateFiles$1.invoke(JvmBackendFacade.kt:40)
at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:95)
How can I understand, what exact code causes this error?Bryan Herbst
11/02/2020, 3:07 PMView
classes (e.g. ProgressBar
or SeekBar
when SemanticsProperties.AccessibilityRangeInfo
is present).
However, this is missing for some prominent components such as Button
, with no public API to influence that behavior. This behavior is also a bit clunky given that it relies on labeling Compose widgets as specific View
classes.
Is there a plan to surface something to support this? Is the TalkBack team exploring ways of decoupling TalkBack from the View APIs to better support Compose in the future?Archie
11/02/2020, 4:13 PMBottomNavigation
in the bottomBar of the Scaffold
when I am in a certain screen (which for this sample code is ScreenC). But everytime I get to ScreenC, it goes ScreenC and immediately jumps back to startDestination, ScreenA. Am I doing something wrong here?
@Composable
fun Main() {
SampleAppTheme {
val navController = rememberNavController()
val currentBackStackEntry by navController.currentBackStackEntryAsState()
Scaffold(
topBar = {
...
},
bottomBar = {
val currentRoute = currentBackStackEntry?.arguments?.get(KEY_ROUTE)
if (currentRoute != ScreenC.route) {
BottomNavigation {
BottomNavigationItem(
icon = { Icon(Icons.Default.Home) },
selected = true,
onClick = {}
)
BottomNavigationItem(
icon = { Icon(Icons.Default.PieChart) },
selected = false,
onClick = {}
)
BottomNavigationItem(
icon = { Icon(Icons.Default.Person) },
selected = false,
onClick = {}
)
}
}
}
) {
val modifier = Modifier.padding(it)
NavHost(
navController = navController,
startDestination = ScreenA.route,
) {
composable(ScreenA.route) {
MyScreen(modifier, "A", "", "to B") {
navController.navigate(ScreenB.route)
}
}
composable(ScreenB.route) {
MyScreen(modifier, "B", "", "to C") {
navController.navigate(ScreenC.route)
}
}
composable(ScreenC.route) {
MyScreen(modifier, "C", "","to A") {
navController.navigate(ScreenA.route)
}
}
}
}
}
}
Ciprian Grigor
11/02/2020, 6:03 PMKshitij Patil
11/02/2020, 6:53 PMComposable
Box(Modifier.fillMaxSize()) {
Canvas(Modifier.clickable { Log.i(TAG, "Clicked") }) {
drawCircle(Color.Red, 25f, Offset(150f,150f))
}
}
I want only the portion of Circle clickable, I tried clipping the Canvas, didn't help. Canvas click events only work within Surface
, that too, on the entire Canvas area.David Albers
11/02/2020, 9:03 PMsashjakk
11/02/2020, 10:00 PMe: java.lang.IllegalStateException: Backend Internal error: Exception during IR lowering
alexandrepiveteau
11/03/2020, 12:26 AM@Composable fun
that is effectively inlined (and without a group) ?
I have a UI with a flat hierarchy and would like to factorise some of the logic in different functions, knowing that exactly one of these will be called no matter what the input parameters are. The pattern I’d like to achieve is similar to this Gist : https://gist.github.com/alexandrepiveteau/47a18b29a6bd9cc2fcd2d347bc8f4a44.
While looking into this, I’ve stumbled on @ComposableContract(readonly = true)
, which “does not generate a group around the body of the function it annotates”, and I feel like is kind of what I’d need. However, the documentation clearly states that it is “not safe unless […] composer only executes read operations”. What’s exactly a “write” operation for a composer ? And is there a better way to achieve what I’m trying to do than using @ComposableContract(readonly = true)
?Daniele B
11/03/2020, 1:53 AMnavigation
. Congratulations, it’s great! It’s much neater than the one in SwiftUI. I also like the fact that it uses URIs, which makes it very adaptable to the Web too.
But maybe there is still some room for improvement. For example, I find rather verbose the way to collect string arguments. Having to repeat the parameter name twice doesn’t feel optimum.
NavHost(navController, startDestination = "master") {
.....
composable("detail/{item}") { backStackEntry ->
val detailName = backStackEntry.arguments?.getString("item")!!
DetailView(appState = appState, detailName = detailName)
}
}
Zach Klippenstein (he/him) [MOD]
11/03/2020, 2:15 AMGuy Bieber
11/03/2020, 3:20 AMGuy Bieber
11/03/2020, 3:20 AMAlexjlockwood
11/03/2020, 3:52 AMDaniele B
11/03/2020, 4:26 AMSergey Y.
11/03/2020, 8:21 AMSharing Intent
is an API of the Android SDK.nickbutcher
11/03/2020, 8:52 AM