ntoskrnl/SpeedometerView


Simple speedometer-like gauge with needle for Android

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.ntoskrnl:SpeedometerView:'
	}
	dependencies {
		implementation("com.github.ntoskrnl:SpeedometerView:")
	}
	<dependency>
	    <groupId>com.github.ntoskrnl</groupId>
	    <artifactId>SpeedometerView</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.ntoskrnl" % "SpeedometerView" % ""
        
        

                            
    :dependencies [[com.github.ntoskrnl/SpeedometerView ""]]
        
        

Readme


SpeedometerView -- DEPRECATED!!!

This project is deprecated and no longer maintained. The contents were moved to another library, which is available here: https://github.com/ntoskrnl/AndroidWidgets

Simple speedometer-like gauge with needle for Android.

speedometerview-v1

Download: SpeedometerView-v1.0.1

Usage

In your layout xml-file add SpeedometerView as shown:

<com.cardiomood.android.speedometer.SpeedometerView
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:padding="8dp"
    android:id="@+id/speedometer" />

Configure SpeedometerView:

  private SpeedometerView speedometer;

  // Customize SpeedometerView
  speedometer = (SpeedometerView) v.findViewById(R.id.speedometer);
  
  // Add label converter
  speedometer.setLabelConverter(new SpeedometerView.LabelConverter() {
      @Override
      public String getLabelFor(double progress, double maxProgress) {
          return String.valueOf((int) Math.round(progress));
      }
  });
  
  // configure value range and ticks
  speedometer.setMaxSpeed(300);
  speedometer.setMajorTickStep(30);
  speedometer.setMinorTicks(2);
  
  // Configure value range colors
  speedometer.addColoredRange(30, 140, Color.GREEN);
  speedometer.addColoredRange(140, 180, Color.YELLOW);
  speedometer.addColoredRange(180, 400, Color.RED);

Version History

SpeedometerView 1.0.1

  • added attribute labelTextSize
  • text is drawn in dp (looks the same on all screens now)
  • fixed needle artifact

Download: SpeedometerView-v1.0.1

SpeedometerView 1.0

Minimal Android SDK version: 9 (Android 2.3)

Supported features:

  • Major and minor tick marks
  • Custom labels
  • Colored value ranges
  • Animation of arrow (requires Android API level 11+)

Download: SpeedometerView-v1.0