Coder Social home page Coder Social logo

ionsoft-indonesia / randomnumberanimation Goto Github PK

View Code? Open in Web Editor NEW
30.0 2.0 5.0 3.2 MB

Easily create random number change animation to a TextView

License: MIT License

Kotlin 100.00%
android-library random-number-generator random-animation android-animation kotlin-library kotlin-android kotlin-android-utils

randomnumberanimation's Introduction

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 {
  implementation 'com.github.IONsoft-Indonesia:RandomNumberAnimation:1.3.3'
}

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)

Note

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

Proudly Used By

Contributing

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!

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.

randomnumberanimation's People

Contributors

hendrawd avatar

Stargazers

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

Watchers

 avatar  avatar

randomnumberanimation's Issues

java.lang.NoClassDefFoundError: kotlinx.coroutines.experimental.android.HandlerContext

java.lang.NoClassDefFoundError: kotlinx.coroutines.experimental.android.HandlerContext
at kotlinx.coroutines.experimental.android.HandlerContextKt.(HandlerContext.kt:29)
at kotlinx.coroutines.experimental.android.HandlerContextKt.getUI(HandlerContext.kt:29)
at id.co.ionsoft.randomnumberanimationlibrary.RandomNumberAnimation$InfinityTask.start$library_release(RandomNumberAnimation.kt:65)
at id.co.ionsoft.randomnumberanimationlibrary.RandomNumberAnimation.start(RandomNumberAnimation.kt:113)
at com.plink.mbb.fragment.main.token.PlayTokenFragment$onActivityCreated$1.onClick(PlayTokenFragment.kt:53)
at android.view.View.performClick(View.java:4781)
at android.view.View$PerformClick.run(View.java:19874)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5297)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

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.