Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android Transition

1,193 views

Published on

Presentation on 7/25@Android Taipei
The introduction of Android Transition

Published in: Software
  • Login to see the comments

Android Transition

  1. 1. Android Transition Charlie@Android Taipei
  2. 2. Charlie Tsai@Android Study Group cha122977@gmail.com Individual App Developer & System Software Engineer@NVIDIA Today’s source code https://github.com/chatea/TransitionDemo
  3. 3. Agenda • Overview of Animations in Android • Transitions Framework • Demo and Live Coding
  4. 4. Animations in Android • Animation (API 1+) • Animator (API 11+) • LayoutTransition (API 11+) • FragmentManager.beginTransaction() (support.v4 or API 11+) .setCustomAnimations(…) .add(…) / replace(…) .commit() • ViewPropertyAnimator (API 12+) View.animate().setXXX(…).setYYY(…) • Transitions Framework (API 19+) Scene, Transition, and TransitionManager • Transition between Activities (API 21+) ActivityOptions.makeSceneTransitionAnimation(…)
  5. 5. API 19 are supported by ~80% devices
  6. 6. Transitions framework
  7. 7. Overview • Limitation • Scene • Transition • TransitionManager • Transition between Activities
  8. 8. Limitation • Cannot be applied to the SurfaceView • Cannot be applied to the AdapterView e.g. ListView (Use LayoutTransition instead) • Resizing the TextView has some problems
  9. 9. Scene • Layout description between 2 scenes • Can be created from layout file (res/layout/*.xml) • Can be created from code • Supports Callback: Scene.setExitAction(Runnable) Scene.setEnterAction(Runnable)
  10. 10. Transitions • Used to indicated the animation • Built-in transitions: fading, resizing, etc. • Can be created from xml (res/transition/*.xml) • Can be created from code • Transition.TransitionListener • Transition.addTarget() & Transition.removeTarget() • Multiple Transitions: TransitionSet
  11. 11. Customized Transition • public void captureStartValues(TransitionValues) • public void captureEndValues(TransitionValues) • public Animator createAnimator( ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues)
  12. 12. Customized Transition • A data structure used to store customized animation properties. • class TransitionValues { public Map<String, Object> values; public View view; } 12
  13. 13. TransitionManager • TransitionManager.go(Scene) TransitionManager.go(Scene, Transition) • Transition.setTransition(…) TransitionManager.transitionTo(Scene) • Animation without Scene and Transition TransitionManager.beginDelayedTransition() • Can be created by XML
  14. 14. Transition between Activities • Enter & Exit Fade, Explode, Slide getWindow().setEnterTransition(…) getWindow().setExitTransition(…) • Shared elements changeBounds, changeClipBounds, changeTransform, changeImageTransform • ActivityOptionsCompat.makeSceneTransitionAnimation() ViewCompat.setTransitionName(…) Window.getSharedElementEnterTransition()
  15. 15. Live coding
  16. 16. Official Samples
  17. 17. cmd + shift + a
  18. 18. 固定聚會:每週三@菓子咖啡(近捷運南京復興站) 技術分享:每月底週六14:30 - 17:30
  19. 19. Question?
  20. 20. Thanks!

×