Status Update
Comments
ti...@google.com <ti...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
qu...@gmail.com <qu...@gmail.com> #3
ti...@google.com <ti...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
ma...@google.com <ma...@google.com> #5
Hm, interesting, form the quick looks it seems like nothing changed in scaffold in alpha08. The only thing we've done around alpha07 is migrated scaffold to subcompose and it directly affects the padding parameter.
Louis, do you have any ideas is that might've caused the problem?
lp...@google.com <lp...@google.com> #6
Hm, I can't immediately reproduce with an example locally so not sure what's going on, might be related to how / when subcomposition invalidates
qu...@gmail.com <qu...@gmail.com> #7
Hi just another update, I updated to 1.0.0-alpha10 but still experiencing the same result.
ma...@gmail.com <ma...@gmail.com> #8
Same issue on beta01.
an...@google.com <an...@google.com> #9
The issue is inside NavHost.
val modifier = Modifier.padding(padding)
NavHost(navController, startDestination = FIRST_SCREEN) {
composable(FIRST_SCREEN) {
MyScreen(modifier, Color.Blue) {
navController.navigate(SECOND_SCREEN)
}
}
composable(SECOND_SCREEN) {
MyScreen(modifier, Color.Red) {
navController.navigate(FIRST_SCREEN)
}
}
}
When the size has been changed the first line is recomposed and the new modifier object is constructed. Then NavHost is reinvoked with a new builder which contains new lambdas which captures a new modifier. But currently NavHost is not supporting nav graph updates so the new lambdas are ignored. As a result we end up using the initial value of the captured modifier object forever which had size 0. The current workaround would be something like
val modifier = rememberUpdatedState(Modifier.padding(padding))
NavHost(navController, startDestination = FIRST_SCREEN) {
composable(FIRST_SCREEN) {
MyScreen(modifier.value, Color.Blue) {
navController.navigate(SECOND_SCREEN)
}
}
composable(SECOND_SCREEN) {
MyScreen(modifier.value, Color.Red) {
navController.navigate(FIRST_SCREEN)
}
}
}
In this case we wrap the value inside the state object so we can update the state and the old lambda would still use the correct modifier.
Jeremy, assigning it to you as the only correct solution is to support graph updates
an...@google.com <an...@google.com> #11
qu...@gmail.com <qu...@gmail.com> #12
an...@google.com <an...@google.com> #13
qu...@gmail.com <qu...@gmail.com> #14
Alright. I guess this would hit two issues at the same time then. Thank you!
il...@google.com <il...@google.com> #15
Note that if you want to pad in all screens, you should passing the padding directly to NavHost
rather than manually to each screen:
) { padding ->
NavHost(navController, startDestination = FIRST_SCREEN, Modifier.padding(padding)) {
composable(FIRST_SCREEN) {
MyScreen(Color.Blue) {
navController.navigate(SECOND_SCREEN)
}
}
composable(SECOND_SCREEN) {
MyScreen(Color.Red) {
navController.navigate(FIRST_SCREEN)
}
}
}
}
}
This was made possible in
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit 294e5e2a1f2933cb927f9ad2bdd7763923295f49
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Jun 21 14:15:54 2021
Override equals in NavGraph and NavDestinations
Instead of relying on the default equals() behavior that requires
NavGraphs and NavDestinations to be the exact instance to be
considered equal, we should specifically define equals to be objects
with the same values, even if they instances are not exactly the same.
RelNote: "`NavGraph` and `NavDestination`s now override the equals method so
two objects with the same values will be considered equal."
Test: NavGraphTest and NavDestinationAndroidTest
Bug: 175392262
Change-Id: I166eb54122cabc12cc569daea8eefcf8e0ec95a7
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavDestinationAndroidTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDeepLink.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraph.kt
M navigation/navigation-common/src/test/java/androidx/navigation/NavGraphTest.kt
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigator.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicActivityNavigator.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicIncludeGraphNavigator.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 5e187e759d673ea9c45d7fafe8e98260fe090bd4
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Jun 23 13:30:16 2021
Allow the NavGraph to be changed in NavHost
Since NavGraph now implements its own equals based on the data in the
graph rather than the instance, we can stop always remembering the
NavGraph and allow it to be changed on recompose.
RelNote: "You can now make changes to the graph of a NavHost. Graphs
with the same startDestination and destinations in the graph will be
considered equal and will not clear the navController back stack."
Test: setSameGraph
Bug: 175392262
Change-Id: I0b8dbcea4186232c3280c4a43be11e4fafcc6ce3
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
jb...@google.com <jb...@google.com> #18
This has been fixed internally and will be part of the Navigation 2.4.0-alpha05
release.
Description
Jetpack Compose release version: 1.0.0-alpha08 Android Studio Build: Android Studio Arctic Fox | 2020.3.1 Canary 2
BottomBar no longer updates Scaffold's contentPadding whenever bottomBar changes "visibility".
Here is the sample code to reproduce: