Skip to content

naseemakhtar994/RandomNumberAnimation

 
 

Repository files navigation

RandomNumberAnimation

Easily create random number change animation to a TextView and other subclasses of TextView

Direct subclasses: Button, CheckedTextView, Chronometer, DigitalClock, EditText, TextClock

Indirect subclasses: AutoCompleteTextView, CheckBox, CompoundButton, ExtractEditText, MultiAutoCompleteTextView, RadioButton, Switch, ToggleButton

Release Android Arsenal Build Status

Preview

How to use?

Step 1. Add the JitPack repository to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2. Add the dependency

dependencies {
  compile 'com.github.IONsoft-Indonesia:RandomNumberAnimation:1.2'
}

Step 3. Initialize

Java

RandomNumberAnimation randomNumberAnimation = new RandomNumberAnimation(yourTextView);

Kotlin

val randomNumberAnimation = RandomNumberAnimation(yourTextView)

Step 4. Start

Java

randomNumberAnimation.start();

Kotlin

randomNumberAnimation.start()

Step 5. Stop

Java

randomNumberAnimation.stop();
// or
randomNumberAnimation.stop(true); // to keep the random number change inside the text

Kotlin

randomNumberAnimation.stop()
// or
randomNumberAnimation.stop(true) // to keep the random number change inside the text

Optional

You can also specify the delay between frames or frame per second

Java

randomNumberAnimation.setDelay(16);
// or
randomNumberAnimation.setFPS(60);

Kotlin

randomNumberAnimation.delay = 16
// or
randomNumberAnimation.setFPS(60)

You must call stop() when you call start(), or it will cause memory leak. To make sure it will be stopped, you can call that also in your Activity's onStop() method. See example project for more reference

License

MIT License

Copyright (c) 2018 PT. IONsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Easily create random number change animation to a TextView

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Kotlin 89.5%
  • Java 10.5%