Status Update
Comments
ch...@gmail.com <ch...@gmail.com> #2
Thanks for filling this, HiltViewModelFactory wraps around a SavedStateViewModelFactory which is also the default one for non Hilt injected Fragments and Activities, it seems there is some key conflicts, I'll investigate and comer back with more info soon, thanks for the sample app!
ae...@google.com <ae...@google.com>
ga...@mistplay.com <ga...@mistplay.com> #3
Branch: androidx-master-dev
commit d76172ec45a778efe5f46b6ad1a50ae24241d14d
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Tue Jun 16 14:50:23 2020
Avoid SavedStateHandle key conflict in HiltViewModelFactory.
When delegating to the SavedStateViewModelFactory to create
ViewModels that are not Hilt injected, the factory will attempt
to retrieve a SavedStateHandler using a controller with the same
key as the SavedStateHandle passed into the abstract create() method
of AbstractSavedStateViewModelFactory for which the
HiltViewModelFactory implements. Therefore causing a key conflict.
In this change we avoid the key conflict collision by prefixing the
before delegating to SavedStateViewModelFactory. Since ViewModels
will be either create by one or the other factory, it is safe to
mangle the key. Meanwhile, even though the key is also used to
add a tag to the ViewModel for cleanup, the tag is only added
if the key used is not present. When SavedStateViewModelFactory
tags the ViewModel and then a second time in once
AbstractSavedStateViewModelFactory#create() returns, the tag
is not overridden (lucky us).
This fixes a bug when mixing vanilla ViewModels and Hilt injected
ones.
Bug: 158737069
Test: ViewModelApp Integration Tests
Change-Id: I86ae254c2f26795c900317d42041319fd279e545
M buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
M hilt/hilt-lifecycle-viewmodel/src/main/java/androidx/hilt/lifecycle/HiltViewModelFactory.java
M hilt/integration-tests/viewmodelapp/build.gradle
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/ActivityInjectionTest.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseActivityInjectionTest.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/BaseFragmentInjectionTest.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/Bindings.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/FragmentInjectionTest.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/MyViewModels.kt
A hilt/integration-tests/viewmodelapp/src/androidTest/java/androidx/hilt/integration/viewmodelapp/TestRunner.kt
A hilt/integration-tests/viewmodelapp/src/debug/AndroidManifest.xml
ma...@google.com <ma...@google.com> #4
A fix for this will be available in alpha02
su...@gmail.com <su...@gmail.com> #5
[Deleted User] <[Deleted User]> #6
uo...@google.com <uo...@google.com>
ma...@google.com <ma...@google.com> #7
Tried with recent compose 1.5 beta and I'm not able to reproduce this.
From the video, it seems like a lot of scroll-like gestures are brief touches instead of continuous scroll gestures.
Closing as WAI, but keep in mind that every finger is different and if you see the need for it - you could adjust the amount of vertical and horizontal touch slop needed to start either horiozntal or vertical gesture. You could do it by changing LocalViewConfiguration separately for vertical and horizontal scroll hierarchies. This way, you might control the angle at which compose disambiguates between horizontal and vertical scroll.
Doing so will result in different experiences for users in different apps, so use with caution.
Description
Jetpack Compose version:
1.0.1
Jetpack Compose component used:
Rows and Columns
Android Studio Build:
Android Studio Bumblebee | 2021.1.1 Patch 2 Build #AI-211.7628.21.2111.8193401, built on February 17, 2022
Kotlin version:
1.5.32
Code Sample to Reproduce:
Steps to Reproduce
check attached video for reference : Scroll/fling vertically, up and down very fast multiple times