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.

[MaterialContainerTransform] Huge delay running transition on 1.3.0-alpha01

See original GitHub issue

Description: 1.3.0-alpha01 causes MaterialContainerTransform to take way longer to run, and skip way more frames

Tried to update from 1.2.0-alpha06 but perf is a disaster.

Source code: Here’s how I’m launching the transition:

  private fun startContainerTransform(from: View, to: View): Flow<Boolean> {
    val channel = Channel<Boolean>()
    val transform = MaterialContainerTransform().apply {
      startView = from
      endView = to
      setPathMotion(MaterialArcMotion())
      scrimColor = Color.TRANSPARENT
      duration = 300L
      addListener(object : Transition.TransitionListener {
        override fun onTransitionEnd(transition: Transition) {
          channel.offer(true)
          channel.close()
        }

        override fun onTransitionResume(transition: Transition) {
        }

        override fun onTransitionPause(transition: Transition) {
        }

        override fun onTransitionCancel(transition: Transition) {
          Timber.e("Transition cancelled?")
          channel.offer(false)
          channel.close()
        }

        override fun onTransitionStart(transition: Transition) {
        }
      })
    }
    TransitionManager.beginDelayedTransition(screenContainer, transform)
    return channel.receiveAsFlow()
  }

This shows up in logcat:

Skipped 249 frames!  The application may be doing too much work on its main thread.

Android API version: 29

Material Library version: 1.3.0-alpha01

Device: Emulator Pixel 3a on API 29

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
edenmancommented, Jun 23, 2020

fwiw I was seeing a bunch of bugs on the previous version too, sometimes the new view wouldn’t fully show, leading to the old view still being partially visible. Not sure if that’s relevant. Anyway I’m punting on container transform entirely and going back to good-old slide left/right for now.

1reaction
AxelBlaz3commented, Jul 1, 2020

@dsn5ft I couldn’t reproduce the issue properly. I mean, there’s no jank in the sample app. Maybe because the data is static and not from server? My personal project app really lags for first few times and then everything will be fluid. What could be the possible reason behind that?

Personal app uses the MVVM architecture with Repository pattern. Also, dagger 2 is used for DI. Views are similar to the sample app. But still, the sample app is fluid. However, I face lag in personal app only for first few times of navigation from Home -> Detail screen and then everything will be fluid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MaterialContainerTransform transition is not Working on Return
Through logging, I can confirm the shared transitionName matches in each fragment. The transition from source -> destination works great, but ...
Read more >
transition-delay - CSS: Cascading Style Sheets | MDN
The transition-delay CSS property specifies the duration to wait before starting a property's transition effect when its value changes.
Read more >
MaterialContainerTransform - Android Developers
A shared element Transition that transforms one container to another. MaterialContainerTransform can be used to morph between two Activities ...
Read more >
transition-delay | CSS-Tricks
The transition-delay property, normally used as part of transition ... A valid time value defined in seconds or milliseconds e.g. 1.3s or ...
Read more >
Building Beautiful Transitions with Material Motion for Android
Learn about four transition patterns and how to add them to your Android app.
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