Closed Bradmrhong closed 3 years ago
updates:
I try to work around it by making a copy of MaterialContainerTransformSharedElementCallback
and add
if (window.getDecorView().getBackground() == null) {
window.getDecorView().setBackground(window.getContext().getDrawable(R.color.transparent));
}
The crash is gone.
Also, I try to set transparentWindowBackgroundEnabled = false
but getting black background when performing the return transition.
@drchen Hi it seems window.getDecorView().getBackground() == null
sometimes on Android 5,6,7 devices. Will you update the library in the new version?
Thanks!
Yes the fix will be in the next library version, which we don't have a decided date yet but probably in 2 weeks or so.
Duplicate of #
@drchen I found another issue below by using the same demo https://github.com/skydoves/transformationlayout
The card will offset after back to HomeFragment. See below:
It‘s really strange. please let me know if any ideas?
Thanks!
@drchen Hi, just wonder know if you have checked this issue? :)
Description: Get crash report when using container anim between two activities. StartActivity: A recycler view that contains several cards. EndActivity: A recycler view in which each view holder is full screen.
It's very similar to https://github.com/skydoves/transformationlayout
Everything worked fine, but I got some crash reports as below:
Expected behavior: Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable.mutate()' on a null object reference at com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback.removeWindowBackground(MaterialContainerTransformSharedElementCallback.java:304) at com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback.access$000(MaterialContainerTransformSharedElementCallback.java:52) at com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback$1.onTransitionStart(MaterialContainerTransformSharedElementCallback.java:243) at android.transition.Transition.start(Transition.java:1897) at android.transition.Transition.runAnimators(Transition.java:868) at android.transition.TransitionSet.runAnimators(TransitionSet.java:433) at android.transition.TransitionSet.runAnimators(TransitionSet.java:433) at android.transition.TransitionSet.runAnimators(TransitionSet.java:433) at android.transition.Transition.playTransition(Transition.java:1778) at android.transition.TransitionManager$MultiListener.onPreDraw(TransitionManager.java:306) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2223) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1272) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6408) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:621) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6165) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Source code: Just refer to the sample code from this repo
Android API version: targetApi: 23
Material Library version: Material Android Library version: 1.3.0
Device: Device on which the bug was encountered here Galaxy J7(6.0.1) Moto G4 Play(7.1.1)