Git Product home page Git Product logo

whatsapp-readby-animation's Introduction

WhatsApp Readby Animation

Implemeting WhatsApp readby animation using ConstraintLayout. anim_none

Why ?

Animations in android can be difficult and can lead to writing many lines of code( Different code for exit/enter anim). With the help of Android's new ConstraintLayout one can create complex animations by writing few lines of code.

How ???

  • Creating duplicate xml files which contains the start and end postion of the animtions respectively.
readby_collapsed.xml start anim_none
readby_expanded.xml  end    anim_none
  • Creating constraint Set for both the layout
val constraintSet1 = ConstraintSet()
val constraintSet2 = ConstraintSet()
constraintSet1.clone(constraintLayout)
constraintSet2.clone(this,R.layout.readby_expanded)
  • Adding a TransitionManager to view the animation
var changed = false
//Touch Listener
findViewById<View>(R.id.touch).setOnClickListener({
   TransitionManager.beginDelayedTransition(constraintLayout)
   val constraint = if (changed) constraintSet1 else constraintSet2
   constraint.applyTo(constraintLayout)
   changed = !changed
  })
  • Voilà here's your beautiful animation.

whatsapp-readby-animation's People

Contributors

gulzar1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

xing1p

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.