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:
spacing
which is the distance between the meter and the edges of the view. Much like padding.lineWidth
which is the thikcness of the meterlineColor
which is the color of the meterpathColor
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:
prepare(int stop, int interval)
. This defines the ending value and the refresh intervalstart()
. This starts the meter.pause()
. This pauses the meter.stop()
. This stops and resets the meter.runAsync(boolean runasync)
. This makes the meter run asychronously.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.getValue()
. This gives a percentage value of the meter's progress.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:
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.