Giter VIP home page Giter VIP logo

meterview's Introduction

MeterView

This provided code allows a developer to use a circular meter to show progress in their application as opposed to the default progress indicator provided by android.

The view allows for some customization in the xml. One can customize:

  1. spacing which is the distance between the meter and the edges of the view. Much like padding.
  2. lineWidth which is the thikcness of the meter
  3. lineColor which is the color of the meter
  4. pathColor which is the color of the path the meter follows

For example:

<com.amurani.meterview.MeterView android:id="@+id/meter" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5" meterview:spacing="10" meterview:lineWidth="5" meterview:lineColor="#0af" meterview:pathColor="#ccc" />

In the JAVA section, it is used as any other view: MeterView meter = (MeterView) this.findViewById(R.id.meter);

Its object allows access to the following methods:

  1. prepare(int stop, int interval). This defines the ending value and the refresh interval
  2. start(). This starts the meter.
  3. pause(). This pauses the meter.
  4. stop(). This stops and resets the meter.
  5. runAsync(boolean runasync). This makes the meter run asychronously.
  6. setValue(int value, int total). This allows you to define your own value for the meter or update from a Thread or loop or what have you.
  7. getValue(). This gives a percentage value of the meter's progress.
  8. setOnFinishListener(OnFinishListener f). This method allows one to define a custom action to be performed once the meter completes a cycle.

Simple implementation of how to use the View are:

  1. in a timer,

  1. when monitoring downloads,

  1. display the battery level,

More needs to be added and the code is not perfect. Improvements are greatly encouraged. Use the code as you please for I can't guaranten future or maintaian it myself.

(Sorry for the image size BTW)

meterview's People

Contributors

amurani avatar

Watchers

James Cloos 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.