Giter Club home page Giter Club logo

eraser's Introduction

Eraser

Eraser is a library to help you erase your animations.

Android has a number of different animation APIs, each API provides a different way to manage the lifecycle and unregister animation libraries. Eraser helps to make this consistent and make your apps better.

eraser's People

Stargazers

Sasikanth Miriyampalli avatar Kalaiselvan avatar Jordan Terry avatar Aditya avatar

Watchers

James Cloos avatar

eraser's Issues

Add eraser support for the `Animator` API

The Animator API, is the parent class for this is the parent to alll animatable classes in android.animation package.

To support this, we must add a LifecycleObserver that will match the lifecycle of the animation to the lifecycle of where it is being displayed.

Animator "Lifecycle"

  • An Animator can be paused - we should call this when the parent lifecycle enters the PAUSED state
  • An Animator can be resumed - we should call this when the parent lifecycle enters the RESUMED state
  • An Animator can be cancelled - we should do this when the parent lifecycle enters the DESTROYED state

When we cancel the Animator we should also call removeAllListeners, this will ensure no memory leaks.

Add eraser support for the `AnimatedVectorDrawable` API

The AnimatedVectorDrawable is a type of drawable that allows us to animated vector images.

To support this, we must add a LifecycleObserver that will match the lifecycle of the AnimatedVectorDrawable to the lifecycle of where it is being displayed.

AnimatedVectorDrawable "Lifecycle"

  • An AnimatedVectorDrawable can be started - we should call this when the parent lifecycle enters the RESUMED state, neeed to identify if this is continues the animation from where it stopped
  • An AnimatedVectorDrawable can be stopped - we should call this when the parent lifecycle enters the PAUSED state
  • An AnimatedVectorDrawable can be reset - we do not need to use reset, we should handle pausing and starting but not dictate the state of the AnimatedVectorDrawable passed into here.

The AnimatedVectorDrawable can also have listeners attached to it, we should clear all set listeners that have been set up using the clearAnimationCallbacks function.

Define the public API for communicating with eraser

The purpose of the public API will be to provide a consistent API that allows users to erase any support animation API.

The API must provide the following pieces of information:

  • Access to the LifecycleObserver (via ComponentActivity, Fragment or View?) and
  • Access to an Animator for #1 or
  • Access to an AnimationDrawable for #2 or
  • Access to an AnimatedVectorDrawable for #3

The API will likely exist as an extension function on one of these types. Could something like a CoroutineScope be emulated?

Can ended animations be unobserved as soon as they are finished

Some animations provide information about if an animation can be repeated. If, the animation isn't set to be repeated, we should be able to safely unsubscribe our lifecycle observers and then "erase" the animations.

This is potentially risky, because a developer may manually repeat an animation (I don't think this should be done, an animation should be recreated).

Add eraser support for the `AnimationDrawable` API

An AnimationDrawable represents an animation composed of drawables, please see the documentation here.

Like most animations, these can be started and stopped. They may also have listeners attached to them. Eraser will attavch the AnimationDrawable lifecycle to the lifecycle of another Lifecycle.

AnimationDrawable "Lifecycle"

  • An AnimationDrawable can be started - we should call this when the parent lifecycle enters the RESUMED state
  • An AnimationDrawable can be stopped - we should call this when the parent lifecycle enters the PAUSED state

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.