GithubHelp home page GithubHelp logo

waruna-lak / flip-digit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aldrek/flip_digit

0.0 0.0 0.0 1.34 MB

Flip digit Library that makes a cool and flexible animation flip when changing from one numbers to another

Java 89.98% Kotlin 10.02%

flip-digit's Introduction

Flip digit library

Flip digit Library that makes a cool and flexible animation flip when changing from one numbers to another

platform API

๐Ÿ”จ Setup

In your build.gradle:

dependencies {
   implementation 'com.github.aldrek:Flip_Digit:1.0.1'
}

Usage

Single digit

Use this in xml

 <com.aldrek.digitflip.FlipDigit
   android:id="@+id/digit"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   app:isFastFlip="true"
   app:tintColor="#FF0000"
   app:layout_constraintBottom_toBottomOf="parent"
   app:layout_constraintEnd_toEndOf="parent"
   app:layout_constraintStart_toStartOf="parent"
   app:layout_constraintTop_toTopOf="parent"
   ></com.aldrek.digitflip.FlipDigit>

Kotlin

 var i = 0
 
 object : CountDownTimer(10000, 1000) {
     override fun onTick(millisUntilFinished: Long) {

        digit.setDigit(i , true)
          i++
        }

          override fun onFinish() {
          }
  }.start()

Java

 
 int i = 0;
 
 new CountDownTimer(10000, 1000) {

    public void onTick(long millisUntilFinished) {
         digit.setDigit(i*2 , true);
    }

     public void onFinish() {
    }

  }.start();

Widget digit

Use this in xml

    <com.aldrek.digitflip.FlipWidget
        android:id="@+id/flipWidget"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:numberOfDigits="6"
        app:digitColor="@color/colorAccent"
        app:isFastFlipMain="true">

Kotlin

 var i = 0
 
 object : CountDownTimer(30000, 1000) {
     override fun onTick(millisUntilFinished: Long) {

          flipWidget.setValue(i , true)
          i++
        }

          override fun onFinish() {
          }
  }.start()

Java

 
 flipWidget = this.findViewById(R.id.flipWidget);
 int i = 0;
 
 new CountDownTimer(10000, 1000) {

    public void onTick(long millisUntilFinished) {
         flipWidget.setValue(i*2 , true);
    }

     public void onFinish() {
    }

  }.start();
  

Attributes

Attribute Description
isFastFlipMain enable change flip number from one number to another without going thought all the numbers in between for one digit
tintColor change the background color of digit
numberOfDigits change the number of digits for the widget
digitColor change all the background of digits in widget

License

Copyright 2018 aldrek . All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

flip-digit's People

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.