ArcPointer

Additional

Language
Java
Version
N/A
Created
Jun 6, 2018
Updated
Jun 27, 2018
Owner
DVegasa
Contributor
DVegasa
1
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

ArcPointer

Simple customized progress bar in the form of an arch

Demo

Quick start

Step 1

Gradle:

compile 'io.github.dvegasa:arcpointer:1.0.2'

Maven:

<dependency>
  <groupId>io.github.dvegasa</groupId>
  <artifactId>arcpointer</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Step 2

XML:

<io.github.dvegasa.arcpointer.ArcPointer
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:radius="150dp"
        android:padding="8dp"
        android:id="@+id/arcpointer"/>

Java:

        ArcPointer arcPointer = findViewById(R.id.arcpointer);
        arcPointer.setValue(0.5f);
        arcPointer.setNotches(9);
        [...]

android:layout_width and android:layout_height should be set "wrap_content". To specify the size of View, use the radius.

Documentation

Definitions

XML attributes and Java methods

radius (dp) int getRadius() void setRadius(int radius)

The radius of arc

value (float) float getValue()void setValue(float value)

The pointer positon. Value is a float between 0 and 1 (see image above for more understanding)


0f = left border 0.5f = mid of arc 1f = right border

workAngle (int) [degrees]int getWorkAngle()void setWorkAngle(int workAngle)

The value of the angle of the arch in degrees

notches(Only Java)float[] getNotches()void setNotches(int n)void setNotches (float[] notches)

The position of notches on the arch.