Easily create random number change animation to a TextView and other subclasses of TextView
Button, CheckedTextView, Chronometer, DigitalClock, EditText, TextClock
AutoCompleteTextView, CheckBox, CompoundButton, ExtractEditText, MultiAutoCompleteTextView, RadioButton, Switch, ToggleButton
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.IONsoft-Indonesia:RandomNumberAnimation:1.3.3'
}
RandomNumberAnimation randomNumberAnimation = new RandomNumberAnimation(yourTextView);
val randomNumberAnimation = RandomNumberAnimation(yourTextView)
randomNumberAnimation.start();
randomNumberAnimation.start()
randomNumberAnimation.stop();
// or
randomNumberAnimation.stop(true); // to keep the random number change inside the text
randomNumberAnimation.stop()
// or
randomNumberAnimation.stop(true) // to keep the random number change inside the text
You can also specify the delay between frames or frame per second
randomNumberAnimation.setDelay(16);
// or
randomNumberAnimation.setFPS(60);
randomNumberAnimation.delay = 16
// or
randomNumberAnimation.setFPS(60)
This library will stop the animation directly if your Activity being destroyed using LifecycleObserver, so it will avoid Activity leak. However, if your Activity is not implementing LifecycleOwner, you should stop the animation manually when your Activity is finishing. LifecycleOwner is implemented by default by AppCompatActivity. It is also best practice if you stop the animation if it not visible to user and re-start it if it visible to user to gain the best performance
Contributions are very welcome. If you find a bug in the library or want a feature and think you can fix it yourself, fork + pull request and we will greatly appreciate it!
We love getting pull requests for new features as well as bugs. However, when it comes to new features please also explain the use case and way you think the library should include it. If you don't want to start coding a feature without knowing if the feature will have chance of being included, open an issue and we can discuss the feature!
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.