question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MaterialArcMotion] MaterialArcMotion not working properly

See original GitHub issue

[Description]

The MaterialArcMotion not working properly in 1.2.0-beta01. (After transitions to be based on androidx and add transitions platform subpackage)

[AS-IS]

When we transform View A into View B using MaterialArcMotion as a PathMotion and MaterialContainerTransform, it is delaying, transition incompletely, move weirdly.

[TO-BE]

It should be work properly. In the Alpha05/Alpha06 are working well. However, as we can see below in the beta01 the transitions working not properly.

Alpha-06

Beta-01

Screenshot Index Issue Description Device Information API
first delayed when returning the transformation. Pixel 2, Samsung Galaxy s10 23, 29
second Transformed incompletely. Pixel 2, Samsung Galaxy s7, Nexus 10, Samsung Galaxy s10 23, 27, 29, 29
third Returning weirdly when using with RecyclerView.Adapter Pixel 2, Samsung Galaxy s10 23, 29

[Source code repository]

Material-alpha06 branch Material-beta01 branch / migrated commit

[Android API version]

23, 29

[Gradle Build Tool Version]

3.6.3

[Material Library version]

1.2.0-beta01

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hunterstichcommented, Jul 15, 2020

Hey @skydoves,

Dan and I had a chance to look into a few of the issues you’re experiencing with 1.2.0-beta01.

There are two things happening


[1] When you perform a View->View container transform, as you’re doing when transforming a FAB into a toolbar or a FAB into a card, you have to set the container transform’s target view to the endView using addTarget(endView). This prevents the container transform from being run on both views that are changing and eliminates the visual glitches you’re seeing. Running your project, I was able to fix the problems by updating TransformationLayout with:

  private fun getTransform(mStartView: View, mEndView: View): MaterialContainerTransform {
    return MaterialContainerTransform().apply {
      startView = mStartView
      endView = mEndView
      addTarget(endView)
      ...

Not sure if this will work in all cases where you’re using the layout, but hopefully it points you in the right direction : ).


[2] The duplicate animation running when you return to the list of cards is being caused by commit/57a8ebdcdd4e6. We’re working on a fix for this and will keep you updated!

Let me know if the suggestions in [1] work for solving some of the issues you’re seeing.

Hunter

1reaction
dsn5ftcommented, Jul 17, 2020

@skydoves so I added back a slight additional background fade duration which seems to fix the extra return transition issue (https://github.com/material-components/material-components-android/commit/661c6a112712079e57a26a210b3bacc5967832b1). It’s available in 1.2.0-rc01 which was released yesterday in case you want to try it out here.

We’re tracking the potential container transform performance issues in https://github.com/material-components/material-components-android/issues/1415, and I’m wondering if that’s related to the fact that addTarget is now required, because without it there may be multiple container transforms running. Anyway I’m closing this issue because I believe all of the problems have been addressed, but feel free to reopen or file separate more specific issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to run multiple MaterialContainerTransform transitions ...
I'm trying to animate two sets of views simultaneously using the MaterialContainerTransform transition. However, with the code below, only the ...
Read more >
Material Components for Android: Motion | by Sergio Belda
Recently, I've been working on some samples that use Material Design ... Left: with MaterialArcMotion() — Right: without MaterialArcMotion() ...
Read more >
Motion - Material Design
MaterialContainerTransform internally configures the transition's properties based on whether or not it's entering or returning. If you need to customize either ...
Read more >
MaterialArcMotion | Android Developers
A Material PathMotion that results in a more dramatic curve than ArcMotion . Use MaterialArcMotion in conjunction with ...
Read more >
Android: Arc motion using Material transitions in 20 minutes
In this video, we will learn how to implement Material art transition and expanding a FAB to an activity using the latest Material ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found