Status Update
Comments
il...@google.com <il...@google.com> #2
Use cases: Some phone(like OnePlus) will change the density when rotating the screen or enter PIP mode, I use slider to make a controller for a video player app, at this point the video is playing and the progress bar is changing, then App will be crashed
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
Not sure I understand the use case.
Slider cannot measure 0.dp it has to measure at least 2 thumbs so that the thumb can move from 0f to 1f. Do you mean to use Modifier.weight instead so that it takes the available space?
il...@google.com <il...@google.com> #4
yes, i am using Modifier.weight for Slider, i don't know why it crash on OnePlus phone
ru...@gmail.com <ru...@gmail.com> #5
Here is a example code of my slider controller
Row(Modifier.fillMaxWidth()) {
// Some icon buttons here
Slider(
modifier = Modifier.weight(1f)
//...
}
// Other icon buttons here
}
When exiting the horizontal screen state or entering the picture-in-picture mode, the above exception will be caused, and it only happens on OnePlus phone
[Deleted User] <[Deleted User]> #6
Thanks I'll add a fix for parents with width 0.dp maybe it something that only happens briefly and then it measures something reasonable. Can you share the exact model/OS?
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #7
OnePlus 7/OnePlus 8
I don't have any specific phone to test,it's the feedback from my users. After the simulator test, I guess it's the change of density?
At present, I use BoxWithConstraints to wrap the Slider. And check the maximum width of the constraint, and it will only be displayed when the maximum width is above 40dp, which temporarily fixes the exception.
il...@google.com <il...@google.com> #8
Branch: androidx-main
commit 76f24353f136570d95e80840a44d6faf67383971
Author: Mariano Martin <marianomartin@google.com>
Date: Tue May 10 16:01:23 2022
Allow slider parent to have 0 width
Fix: 231707291
Test: added slider_zero_width
Change-Id: Idb144788fd8e45dd651d211c8093fc53be39a0d1
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt
M compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/SliderTest.kt
[Deleted User] <[Deleted User]> #9
ap...@google.com <ap...@google.com> #10
Branch: androidx-master-dev
commit 3dd6d1fcdb3ffa7d4bd265a023f0ac7c94e14d19
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 18 09:36:37 2019
Deprecate FragmentNavigator.instantiateFragment
Instead of providing a custom subclass of
FragmentNavigator, instantiation of Fragments
should be controlled by setting a custom
FragmentFactory, which is the default behavior
of instantiateFragment() now.
By deprecating the class, we ensure that
developers who were overriding this method
are informed of the changes and can change
their code to use FragmentFactory.
Test: ./gradlew checkApi
BUG: 119054429
Change-Id: Iff46919face98baa6dc62835ca3fc105d987d141
M navigation/fragment/api/2.1.0-alpha01.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
Description
Version used: Fragment 1.1.0-alpha01, Nav 1.0.0-alpha07
Devices/Android versions reproduced on: All
When using FragmentFactory attached to a fragment manager, FragmentNavigator$Destination.createFragment() throws an "InstantiationException: <Fragment> has no zero argument constructor". It appears that upon creating the nav graph, NavHotsFragment instantiates fragments itself instead of delegating to the fragment manager.