Giter VIP home page Giter VIP logo

liquidbutton's Introduction

LiquidButton

Android Arsenal

Customised UI from the idea of:https://dribbble.com/shots/2695600-Liquid-check alt tag

Example

demo1

In xml layout file

      <com.gospelware.liquidbutton.LiquidButton
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:clickable="true" />

Uses startPour() to start the animation.

      LiquidButton liquidButton = (LiquidButton) findViewById(R.id.button);
  
      liquidButton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
            LiquidButton btn = (LiquidButton) v;
            btn.startPour();
      }
      });

Set fillAfter using setFillAfter(), befault as not fill after

      liquidButton.setFillAfter(true);

Set autoPlay using setAutoPlay(), default as not palying automatically

      liquidButton.setAutoPlay(true);

Register PourFinishListener to the widget, it will send a callback onPourFinish() when the animation completed, and onProgressUpdate() when new progress is updated;

      liquidButton.setPourFinishListener(new LiquidButton.PourFinishListener() {
            @Override
            public void onPourFinish() {
                  Toast.makeText(MainActivity.this, "Finish", Toast.LENGTH_SHORT).show();
            }
            
            @Override
            public void onProgressUpdate(float progress) {
                  textView.setText(String.format("%.2f", progress * 100) + "%");
            }          
      });

How to update and finish the animation?

You'll able to uses changeProgress() to alternate the progress of the liquid level. (You need AutoPlay turn Off to be able to do that.) Progress are measure in float, where 1f = 100%;

      liquidButton.changeProgress(progress);

By default the widget starts a finish animation when the progress is 1f, but you can also uses finishPour to start the finish Animation.

      liquidButton.finishPour();

How to?

Gradle

      dependencies {    
            compile 'com.gospelware.liquidbutton:liquidButtonLib:1.1.4'
      }

To Do:

  Prgression update (finished)
  Alternating the Animation speed

liquidbutton's People

Contributors

yoruriko avatar

Watchers

 avatar  avatar

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.