Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Jeremy, is this still an issue? I think the problem was that you had two transitions targeting the same View for the same action (e.g. two Slide() transitions).
ap...@google.com <ap...@google.com> #3
I have a similar issue with plain AnimatorSet:
set.start()
set.pause()
set.setCurrentPlayTime(100)
set.setCurrentPlayTime(0)
set.setCurrentPlayTime(100)
set.resume()
doesn't play animation in resume().
il...@google.com <il...@google.com> #4
Should clarify that if I filter out setCurrentPlayTime(0)
(or replace it with setCurrentPlayTime(1)
) it works well.
Also even with setCurrentPlayTime(0)
, onAnimationEnd
is notified with correct delay (as if the animation has played).
Description
Build: AI-201.8743.12.41.6953283, 202011050241,
AI-201.8743.12.41.6953283, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Linux(amd64) v5.4.0-53-generic, screens 3440x1440
AS: 4.1.1; Kotlin plugin: 1.4.10-release-Studio4.1-1; Android Gradle Plugin: 4.1.1; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: 21.3.6528147; LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: 3.16.3
Affected version:
androidx.fragment:fragment-ktx:1.2.5
Note: It looks like all versions starting from 1.2+ are affected
Description
When you have view pager with nested fragment that shows menu it will crash if you try to access menu items from
onPrepareOptionsMenu
.Steps to reproduce
ViewPager
Fragment1
Fragment2
Fragment2
add nestedFragment21
and enablesetHasOptionsMenu(true)
, also add new menu specific to this fragmentFragment21
fromonPrepareOptionsMenu
Expected behavior
onPrepareOptionsMenu
should never be called if menu is not inflatedActual behavior
onPrepareOptionsMenu
Additional information
Looking through the changes I was able to pinpoint it to this behavior change:https://android.googlesource.com/platform/frameworks/support/+/4809e01d4153a5ba68cb68f36544baa1b90738c0
We are now also checking for parent menu visibility but only in
dispatchCreateOptionsMenu
, which means we would calldispatchPrepareOptionsMenu
with no menu inflated since we skipped it.Possible fix
dispatch*Menu
methods, ordispatchCreateOptionsMenu
Demo repository:
You can find repository with repro steps here:https://github.com/vovkab/fragment-menu-crash