Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
https://android-review.googlesource.com/1360099
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 4ba9e1f4bc18a1b7af28ffb88c145e4933689798
Author: Ian Lake <ilake@google.com>
Date: Fri Jun 21 09:59:11 2019
Make SavedStateVMFactory the default factory
For both ComponentActivity and Fragment,
use SavedStateVMFactory as the default factory
for constructing ViewModels.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
Fixes: 135716331
Change-Id: Iadbee198c471cb245bd16727b7f817a27898ffcb
M activity/activity/build.gradle
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentActivity.java
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/ViewModelTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
https://android-review.googlesource.com/987585
https://goto.google.com/android-sha1/4ba9e1f4bc18a1b7af28ffb88c145e4933689798
Branch: androidx-master-dev
commit 4ba9e1f4bc18a1b7af28ffb88c145e4933689798
Author: Ian Lake <ilake@google.com>
Date: Fri Jun 21 09:59:11 2019
Make SavedStateVMFactory the default factory
For both ComponentActivity and Fragment,
use SavedStateVMFactory as the default factory
for constructing ViewModels.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
Fixes: 135716331
Change-Id: Iadbee198c471cb245bd16727b7f817a27898ffcb
M activity/activity/build.gradle
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentActivity.java
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/ViewModelTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
il...@google.com <il...@google.com> #4
Reopening as the changes were reverted with the switch back to Java 7.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b4eddfd7b427a4a334dceb6e0fb600de38ccdd4f
Author: Ian Lake <ilake@google.com>
Date: Fri Jun 21 09:59:11 2019
Make SavedStateViewModelFactory the default factory
For both ComponentActivity and Fragment,
use SavedStateViewModelFactory as the default factory
for constructing ViewModels.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
BUG: 135716331
Change-Id: I86ef27e21c6d90f169217956baf9813224df4616
M activity/activity/build.gradle
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentActivity.java
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/ViewModelTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
https://android-review.googlesource.com/1093193
https://goto.google.com/android-sha1/b4eddfd7b427a4a334dceb6e0fb600de38ccdd4f
Branch: androidx-master-dev
commit b4eddfd7b427a4a334dceb6e0fb600de38ccdd4f
Author: Ian Lake <ilake@google.com>
Date: Fri Jun 21 09:59:11 2019
Make SavedStateViewModelFactory the default factory
For both ComponentActivity and Fragment,
use SavedStateViewModelFactory as the default factory
for constructing ViewModels.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
BUG: 135716331
Change-Id: I86ef27e21c6d90f169217956baf9813224df4616
M activity/activity/build.gradle
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivityViewModelTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentActivity.java
M fragment/fragment/build.gradle
M fragment/fragment/src/androidTest/java/androidx/fragment/app/ViewModelTest.kt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/test/ViewModelActivity.kt
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-master-dev
commit a5581d7561fccdb2b2ca9a0af2fdb2318086d254
Author: Ian Lake <ilake@google.com>
Date: Mon Jul 29 12:34:35 2019
Remove fragment dependency from viewmodel-savedstate, v2
Remove SavedStateVMFactory constructors that depend
on androidx.fragment to make this a more foundational
library.
Test: tests still pass
BUG: 135716331
Change-Id: Ieaa7a5012c3c5d832b0dbeec74b499e09688c43f
M lifecycle/lifecycle-viewmodel-savedstate/api/1.0.0-alpha03.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/current.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/restricted_1.0.0-alpha03.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/restricted_current.txt
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
M lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
M lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTests.java
M lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateViewModelFactory.java
https://android-review.googlesource.com/1093191
https://goto.google.com/android-sha1/a5581d7561fccdb2b2ca9a0af2fdb2318086d254
Branch: androidx-master-dev
commit a5581d7561fccdb2b2ca9a0af2fdb2318086d254
Author: Ian Lake <ilake@google.com>
Date: Mon Jul 29 12:34:35 2019
Remove fragment dependency from viewmodel-savedstate, v2
Remove SavedStateVMFactory constructors that depend
on androidx.fragment to make this a more foundational
library.
Test: tests still pass
BUG: 135716331
Change-Id: Ieaa7a5012c3c5d832b0dbeec74b499e09688c43f
M lifecycle/lifecycle-viewmodel-savedstate/api/1.0.0-alpha03.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/current.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/restricted_1.0.0-alpha03.txt
M lifecycle/lifecycle-viewmodel-savedstate/api/restricted_current.txt
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
M lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/SavedStateFactoryTest.kt
M lifecycle/lifecycle-viewmodel-savedstate/src/androidTest/java/androidx/lifecycle/viewmodel/savedstate/ViewModelsWithStateTests.java
M lifecycle/lifecycle-viewmodel-savedstate/src/main/java/androidx/lifecycle/SavedStateViewModelFactory.java
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 5371f5bebc24934cf16e63643184d37e9847777a
Author: Ian Lake <ilake@google.com>
Date: Mon Jul 29 16:00:58 2019
Make SavedStateViewModelFactory default for Navigation
For NavController's getViewModelStoreOwner(),
make the default Factory a SavedStateViewModelFactory.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
BUG: 135716331
Change-Id: I43faa405dc43c3a43e01d20c42e7758e4627c08f
M navigation/navigation-runtime/build.gradle
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntry.java
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntryState.java
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
https://android-review.googlesource.com/1092240
https://goto.google.com/android-sha1/5371f5bebc24934cf16e63643184d37e9847777a
Branch: androidx-master-dev
commit 5371f5bebc24934cf16e63643184d37e9847777a
Author: Ian Lake <ilake@google.com>
Date: Mon Jul 29 16:00:58 2019
Make SavedStateViewModelFactory default for Navigation
For NavController's getViewModelStoreOwner(),
make the default Factory a SavedStateViewModelFactory.
As this is a strict superset of ViewModel constructors
now supported, any existing code assuming a ViewModel
or AndroidViewModel will continue to function.
Test: updated tests
BUG: 135716331
Change-Id: I43faa405dc43c3a43e01d20c42e7758e4627c08f
M navigation/navigation-runtime/build.gradle
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntry.java
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntryState.java
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 0e5ee7959df8875c07b081d2e74aeacc3d1b1dfe
Author: Ian Lake <ilake@google.com>
Date: Tue Jul 30 12:38:15 2019
Use default factory for navGraphViewModels()
Ensure that navGraphViewModels() works as
expected with SavedState ViewModels so that it
uses the correct default factory associated
with the navigation graph.
Test: new test passes
BUG: 135716331
Change-Id: Ia2f3790a045103b6a889069e00794222ea8eac52
M navigation/navigation-fragment-ktx/build.gradle
M navigation/navigation-fragment-ktx/src/androidTest/AndroidManifest.xml
M navigation/navigation-fragment-ktx/src/androidTest/java/androidx/navigation/fragment/NavGraphViewModelLazyTest.kt
A navigation/navigation-fragment-ktx/src/androidTest/res/layout/activity_nav_graph.xml
A navigation/navigation-fragment-ktx/src/androidTest/res/navigation/vm_graph.xml
M navigation/navigation-fragment-ktx/src/main/java/androidx/navigation/NavGraphViewModelLazy.kt
https://android-review.googlesource.com/1092471
https://goto.google.com/android-sha1/0e5ee7959df8875c07b081d2e74aeacc3d1b1dfe
Branch: androidx-master-dev
commit 0e5ee7959df8875c07b081d2e74aeacc3d1b1dfe
Author: Ian Lake <ilake@google.com>
Date: Tue Jul 30 12:38:15 2019
Use default factory for navGraphViewModels()
Ensure that navGraphViewModels() works as
expected with SavedState ViewModels so that it
uses the correct default factory associated
with the navigation graph.
Test: new test passes
BUG: 135716331
Change-Id: Ia2f3790a045103b6a889069e00794222ea8eac52
M navigation/navigation-fragment-ktx/build.gradle
M navigation/navigation-fragment-ktx/src/androidTest/AndroidManifest.xml
M navigation/navigation-fragment-ktx/src/androidTest/java/androidx/navigation/fragment/NavGraphViewModelLazyTest.kt
A navigation/navigation-fragment-ktx/src/androidTest/res/layout/activity_nav_graph.xml
A navigation/navigation-fragment-ktx/src/androidTest/res/navigation/vm_graph.xml
M navigation/navigation-fragment-ktx/src/main/java/androidx/navigation/NavGraphViewModelLazy.kt
il...@google.com <il...@google.com> #9
As part of this change:
- the SavedStateViewModelFactory(Fragment) and SavedStateViewModelFactory(FragmentActivity) constructors have been removed (as viewmodel-savedstate no longer depends on Fragments)
- When you use the ViewModelProvider(ViewModelStoreOwner) constructor or ViewModelProviders.of() with an Activity / Fragment / Navigation Graph ViewModelStoreOwner, you'll be using the correct SavedStateViewModelFactory - no custom factory is needed
- When you use the Kotlin property delegates such as 'by viewModels()', 'by activityViewModels()' or 'by navGraphViewModels()', you'll be using the correct SavedStateViewModelFactory - again, no custom factory needed
This will be part of:
- androidx.lifecycle viewmodel 2.2.0-alpha03
- androidx.lifecycle viewmodel-savedstate 1.0.0-alpha03
- androidx.activity 1.1.0-alpha02
- androidx.fragment 1.2.0-alpha02
- androidx.navigation 2.2.0-alpha01
- the SavedStateViewModelFactory(Fragment) and SavedStateViewModelFactory(FragmentActivity) constructors have been removed (as viewmodel-savedstate no longer depends on Fragments)
- When you use the ViewModelProvider(ViewModelStoreOwner) constructor or ViewModelProviders.of() with an Activity / Fragment / Navigation Graph ViewModelStoreOwner, you'll be using the correct SavedStateViewModelFactory - no custom factory is needed
- When you use the Kotlin property delegates such as 'by viewModels()', 'by activityViewModels()' or 'by navGraphViewModels()', you'll be using the correct SavedStateViewModelFactory - again, no custom factory needed
This will be part of:
- androidx.lifecycle viewmodel 2.2.0-alpha03
- androidx.lifecycle viewmodel-savedstate 1.0.0-alpha03
- androidx.activity 1.1.0-alpha02
- androidx.fragment 1.2.0-alpha02
- androidx.navigation 2.2.0-alpha01
da...@gmail.com <da...@gmail.com> #10
It seems like this change causes an exception such as:
Fatal Exception: java.lang.IllegalArgumentException
SavedStateProvider with the given key is already registered
Using the latest fragment/architecture component dependencies.
I am using "by activityViewModels" to get my viewModel, and "requireActivity().viewModelStore.clear()" to destroy it. Then, when getting the viewmodel is called again, it crashes because of the mentioned exception.
Fatal Exception: java.lang.IllegalArgumentException
SavedStateProvider with the given key is already registered
Using the latest fragment/architecture component dependencies.
I am using "by activityViewModels" to get my viewModel, and "requireActivity().viewModelStore.clear()" to destroy it. Then, when getting the viewmodel is called again, it crashes because of the mentioned exception.
il...@google.com <il...@google.com> #11
Re #10 - please file a new bug with a sample project that reproduces your issue.
Description
Version used: 2.2.0-alpha01
Most components, such as ComponentActivity and Fragment, seem to use AndroidViewModelFactory as the default factory. It would be great if the default could be updated to be a SavedStateVMFactory as it offers strictly more functionality.