Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:

Overview

SpeedView

Dynamic Speedometer, Gauge for Android. amazing, powerful, and multi shape , you can change (colors, bar width, shape, text, font ...everything !!), this Library has also made to build games with accelerate and decelerate, see project on GitHub.

minSdkVersion=11

Library Size just ~ 48 KB.

Android Arsenal Gitter API Twitter

Download demo on Google Play:
SpeedView Demo on Google Play

This library has rewritten with Kotlin in version 1.4.0 manually, which means it may have some issues. If you have any problem please open an issue, or you can use old version 1.3.1 written in java.

Speedometers...

Gauges...

Download

Starting from version 1.5.4 this library uploaded to mavenCentral, the old versions was on jcenter. To work with this library you need Kotlin version 1.4.31 or above.

First add kotlin to your project, in build.gradle project level:

buildscript {
    ext.kotlin_version = '1.4.31'
    dependencies {
        ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
...
allprojects {
    repositories {
        ...
        mavenCentral()
    }
}

Then add this line to build.gradle app module level:

apply plugin: 'kotlin-android'
...
dependencies {
	implementation 'com.github.anastr:speedviewlib:1.5.5'
}

For maven

<dependency>
  <groupId>com.github.anastr</groupId>
  <artifactId>speedviewlib</artifactId>
  <version>1.5.5</version>
  <type>pom</type>
</dependency>

Get Starting with SpeedView Library.

Simple Usage

Choose one of Speedometers, gauges and add it to your Layout.xml, here we use SpeedView.

<com.github.anastr.speedviewlib.SpeedView
        android:id="@+id/speedView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

For all speedometers and gauges, this simple method to smoothly change the speed:

SpeedView speedometer = findViewById(R.id.speedView)

// move to 50 Km/s
speedometer.speedTo(50)

By default, speed change duration between last speed and new one is 2000 ms.
You can pass your duration by this method :

// move to 50 Km/s with Duration = 4 sec
speedometer.speedTo(50, 4000)

Automatically, indicator moves around current speed to add some reality to speedometer because of Tremble, you can stop it by app:sv_withTremble="false"attribute or call this in your code:

speedometer.withTremble = false

For more control, see the most important methods at Get Started - Wiki for All Speedometers & Gauges.
And also you can see Advanced Usage in Usage - Wiki.

More advanced features:

All Speedometers, Gauges :

                                   
Name Screenshot XML Layout
1. SpeedView - Wiki
< com.github.anastr.speedviewlib.SpeedView
        android:id="@+id/speedView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
	
2. DeluxeSpeedView - Wiki
< com.github.anastr.speedviewlib.DeluxeSpeedView
        android:id="@+id/deluxeSpeedView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
      
3. AwesomeSpeedometer - Wiki
< com.github.anastr.speedviewlib.AwesomeSpeedometer
        android:id="@+id/awesomeSpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
      
4. RaySpeedometer - Wiki
< com.github.anastr.speedviewlib.RaySpeedometer
        android:id="@+id/raySpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
      
5. PointerSpeedometer - Wiki
< com.github.anastr.speedviewlib.PointerSpeedometer
        android:id="@+id/pointerSpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
      
6. TubeSpeedometer - Wiki
< com.github.anastr.speedviewlib.TubeSpeedometer
        android:id="@+id/tubeSpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
      
7. ImageSpeedometer - Wiki
< com.github.anastr.speedviewlib.ImageSpeedometer
        android:id="@+id/imageSpeedometer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:sv_image="@drawable/your_image" />
      
8. ProgressiveGauge - Wiki
< com.github.anastr.speedviewlib.ProgressiveGauge
        android:id="@+id/gauge"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
      
9. ImageLinearGauge - Wiki
< com.github.anastr.speedviewlib.ImageLinearGauge
        android:id="@+id/gauge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:sv_image="@drawable/fire" />
      

TODO

  • Build start animation.
  • Add fuel gauge component.
  • Build new custom speedometer.

Your pull request is always welcome, please review the rules of contribution to make a useful change.

LICENSE


Copyright 2016 Anas Altair

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Comments
  • Crash on android 4.0.4 (android.view.InflateException)

    Crash on android 4.0.4 (android.view.InflateException)

    I have runtime exception on android 4.0.4 (Sony ericsson xperia neo v (MT11I)). Reproduced in sample project with one simple activity.

    Layout:

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.example.tridetch.speedviewexample.MainActivity">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"/>
    
        <com.github.anastr.speedviewlib.SpeedView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    
    </android.support.constraint.ConstraintLayout>
    

    Stack trace

    08-24 13:10:18.527 11630-11630/com.example.tridetch.speedviewexample E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tridetch.speedviewexample/com.example.tridetch.speedviewexample.MainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class com.github.anastr.speedviewlib.SpeedView
                                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
                                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
                                                                                               at android.app.ActivityThread.access$600(ActivityThread.java:127)
                                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                               at android.os.Looper.loop(Looper.java:137)
                                                                                               at android.app.ActivityThread.main(ActivityThread.java:4441)
                                                                                               at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                               at java.lang.reflect.Method.invoke(Method.java:511)
                                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                                                                                               at dalvik.system.NativeStart.main(Native Method)
                                                                                            Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class com.github.anastr.speedviewlib.SpeedView
                                                                                               at android.view.LayoutInflater.createView(LayoutInflater.java:606)
                                                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
                                                                                               at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                                                                                               at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
                                                                                               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                               at com.example.tridetch.speedviewexample.MainActivity.onCreate(MainActivity.java:11)
                                                                                               at android.app.Activity.performCreate(Activity.java:4465)
                                                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
                                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
                                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) 
                                                                                               at android.app.ActivityThread.access$600(ActivityThread.java:127) 
                                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) 
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                                               at android.os.Looper.loop(Looper.java:137) 
                                                                                               at android.app.ActivityThread.main(ActivityThread.java:4441) 
                                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                               at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
                                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
                                                                                               at dalvik.system.NativeStart.main(Native Method) 
                                                                                            Caused by: java.lang.reflect.InvocationTargetException
                                                                                               at java.lang.reflect.Constructor.constructNative(Native Method)
                                                                                               at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                                                                                               at android.view.LayoutInflater.createView(LayoutInflater.java:586)
                                                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680) 
                                                                                               at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                                               at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
                                                                                               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                                                               at com.example.tridetch.speedviewexample.MainActivity.onCreate(MainActivity.java:11) 
                                                                                               at android.app.Activity.performCreate(Activity.java:4465) 
                                                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
                                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931) 
                                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) 
                                                                                               at android.app.ActivityThread.access$600(ActivityThread.java:127) 
                                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) 
                                                                                               at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                                               at android.os.Looper.loop(Looper.java:137) 
                                                                                               at android.app.ActivityThread.main(ActivityThread.java:4441) 
                                                                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                               at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
                                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
                                                                                               at dalvik.system.NativeStart.main(Native Method) 
                                                                                            Caused by: java.lang.StackOverflowError
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1225)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.updatePadding(Gauge.java:295)
                                                                                               at com.github.anastr.speedviewlib.base.Gauge.setPaddingRelative(Gauge.java:1226)
                                                                                               at android.view.View.setPadding(View.java:11973)
                                                                                           	at com.github.anastr.speedviewlib.base.Gauge.updatePa
    
    invalid Bug report 
    opened by tridetch 19
  • Using negative values

    Using negative values

    Hello I have a question

    Can I have a gaue with max value of -44 and min value of -140? I have a problem that tell me that min value must be smallaer than max value

    question 
    opened by victors0991 15
  • change Low/Medium/High color in Recycler view at runtime

    change Low/Medium/High color in Recycler view at runtime

    I have a recycle view whose view gets updated in every 30 seconds. I am able to change the color on Indicator but speed view color is changed to another color. I guess the issue is with the recycled views. first time image : (this is what it looks when the view is created for the first time.) img1

    But after the refresh or down in the list view I see this ; img2

    I have checked the code
    this.mediumSpeedColor = mediumSpeedColor; if (!isAttachedToWindow()) return; updateBackgroundBitmap(); invalidate();

    I guess the recycled view is already attached to the window.

    Please suggest what to do?

    Bug 
    opened by niteshgoel 11
  • Render error with DeluxeSpeedView

    Render error with DeluxeSpeedView

    Hello, i add DeluxeSpeedView to layout but it shows render errors:

    java.lang.NoSuchFieldError: Speedometer_sv_speedometerMode at com.github.anastr.speedviewlib.base.Speedometer.initAttributeSet(Speedometer.java:87) at com.github.anastr.speedviewlib.base.Speedometer.(Speedometer.java:58) at com.github.anastr.speedviewlib.DeluxeSpeedView.(DeluxeSpeedView.java:45) at com.github.anastr.speedviewlib.DeluxeSpeedView.(DeluxeSpeedView.java:41) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:262) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:220) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:197) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:902) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:854) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

    image

    However, when i run app it can shows DeluxeSpeedView: image

    Please help me render without error. Thanks!

    Bug 
    opened by Rainbow87 11
  • Question: How to change size of the circle of indicator

    Question: How to change size of the circle of indicator

    How can we change the size of the circle of the indicator? I don't want to use a custom indicator? I like the current one, but only want to change the width of that circle in the middle.

    enhancement 
    opened by Drjacky 9
  • speedometer division control of values

    speedometer division control of values

    Hi, great work with the speedometers!

    I have a question/request!

    Example: Given the following: minSpeed=0, maxSpeed=20000, lowSpeedPercent=50, mediumSpeedPercent=35, can we have the low zone between the values 0 and 1000, the medium zone between 1000 and 2000 and the high zone between 2000 and 20000?

    Also, is it possible to assign labels to the ticks? For example, instead of showing 1000m, I would like to show 1km!

    Thanks in advance!

    question 
    opened by EPapadopoulou 9
  • move duration not work when onSpeedChangeListener or onSpeedTextListener is setted

    move duration not work when onSpeedChangeListener or onSpeedTextListener is setted

    Describe the bug When I set onSpeedChangeListener or onSpeedTextListener , and after that I use speedTo function with moveDuration parameter, this parameter not apply and speed meter moves fast.

    Smartphone : Mi A2

    • OS: Android 10
    • Version 1.5.51
    Bug 
    opened by amir14a 8
  • Set Indicator Size

    Set Indicator Size

    Hello,

    I don't find any function to specify the ImageIndicator size (width and height). As per the doc, it should be in the ImageIndicator constructor but it's not there.

    to create object you cans use: ImageIndicator(context: Context, resource: Int) eysly, but we Recommend to use ImageIndicator(context: Context, resource: Int, width: Int, height: Int) to add custom width and height for indicator.

    invalid question 
    opened by Mas7erMind 8
  • Bug - view doesn't seem to redraw correctly when restored from saved state

    Bug - view doesn't seem to redraw correctly when restored from saved state

    There seems to be an issue with redrawing correctly (at least the speed value) if restored from saved state. I'm using TubeSpeedometer but since values are restored in base class (Gauge) maybe the problem is common to all types. The symptoms are - if I minimize the app, kill it and restore, the value of TubeSpeedometer stays at 100 (why 100? default value of maxSpeed?) - inspite of correct value 38100 being assigned. After debugging I noticed that the correct value is ignored while setting (and thus animation etc.) since the old value is already correct (because it is restored by component itself). A quick workaround was to set the value twice with view.speedTo(value++) and view.speedTo(value--) - with it the TubeSpeedometer redraws correctly since value is changed. So there must be something wrong in the redraw logic when the view is restored from saved state

    Bug 
    opened by chpasha 8
  • How to remove the white thing from the speedometer

    How to remove the white thing from the speedometer

    Hi, sorry for the foolish question but I'm looking for how to remove these white things: image Also, what's the name? Can't seem to find it anywhere. Thank you very much.

    question 
    opened by ulaai 8
  • Indicator Does Not Move If withTremble Is Set to False

    Indicator Does Not Move If withTremble Is Set to False

    Describe the bug Neither the indicator nor the number text can change (by speedTo() or speedPercentTo()) if withTremble is set to False either in the XML or programmatically. The indicator and the number text can work properly if withTremble is True.

    To Reproduce Steps to reproduce the behavior: I have tried with SpeedView and AwesomeSpeedView.

    1. Add the view in XML.
    2. speedTo() works.
    3. Now add app:sv_withTremble="true" or speedometer.withTremble = true.
    4. speedTo() does not work anymore as neither the indicator nor the number text can update. Note: I'm using the default 0 - 100 range, and the values I'm setting are within the range.

    Update: Tried with 1.5.5, it's working correctly in that version. Seems to be a regression :) XML & code N/A

    Screenshots N/A

    Smartphone (Optional):

    • OS: Tried both on Android 12 and 11.
    • Version 1.5.51

    Additional context None.

    Bug 
    opened by tillchen 7
  • Allowing positioning of speed text anywhere inside the gauge (in addition to predefined positions)

    Allowing positioning of speed text anywhere inside the gauge (in addition to predefined positions)

    Changed Position enum to be sealed class and added CUSTOM subtype. This change should be source-code backwards compatible, but, probably, won't be binary compatible.

    opened by techyourchance 0
  • Negative values

    Negative values

    Thanks for sharing this awsome project. Is there a way to have negative values? say from -100 to -10? (app:sv_maxSpeed="-10" and app:sv_minSpeed="-100")

    It seems that it only accept positive values.

    Thanks!

    Bug 
    opened by kamanlid 3
  • Positioning of tick-labels without rotation

    Positioning of tick-labels without rotation

    Hello,

    first of all I am a huge fan of this library and I realy enjoy using it.

    Recently I came across a small problem, when it comes to properly positioning tick-labels on the outside of a circle-speedview when the rotation of the tick-labels is disabled (app:sv_tickRotation).

    When the tick-padding is applied (app:sv_tickPadding), then by default - due to the handling in drawTicks() - you will get an unsymmetrical/uneven positioning around the speedview. That happens since all tick-labels - except position 0 - experience a different rotation depending on their placement around the circle.

    So I made some minor modifications to the Speedometer-class (still using speedview-lib v1.3.1) that allows an individual configuration of the tick-paddings per tick-label in order to still achieve a symmetrical/even positioning.

    Here is my git-patch - maybe someone will find it useful!

    speedometer-tick-handling-adaption.txt

    Note: In order to apply it, just rename the *.txt-file to a *.patch-file! (I am sorry in advance for this unconventional way of proposing that change - still have to get used a bit more on how to properly add/show code-changes here.)

    enhancement need details 
    opened by RayBreslin 3
  • Reduce CPU usage when view isn't visible

    Reduce CPU usage when view isn't visible

    Describe the issue On Android 6.0 (API 23) and lower, the animator object keeps running in the background even when the view goes invisible to the user (like open second activity). This isn't the case with Android 7.0 (API 24) or higher, because we cancel animation when the view becomes invisible inside onVisibilityAggregated method.

    Additional context This isn't a big problem since Android OS wont draw view frames if that view isn't visible to the user. But it's not nice to keep an unnecessary thread running and consuming the system resources.

    enhancement wontfix 
    opened by anastr 0
  • Tick label being chopped off

    Tick label being chopped off

    When I set tick labels they are being chopped half from bottom and that marker indicator is fine . This is the problem in normal Speedview. Only last and first label have this problem when min degree is 180 and max is 360.

    will Try 
    opened by mohitmehta317 6
Releases(1.6.0)
  • 1.6.0(Nov 26, 2021)

    Fulcrum point for indicator

    New feature to change the indicator position and the rotation point #45.

    speedometer.setFulcrum(xOffset = .5f, yOffset = .7f)
    
    Source code(tar.gz)
    Source code(zip)
  • 1.5.53(Nov 11, 2021)

  • 1.5.52(Oct 9, 2021)

  • 1.5.51(Jul 21, 2021)

    • Improve performance by stopping animations on some system events.
    • Sections list is now immutable.
    • Update kotlin to 1.5.20.
    • Update documentations.
    Source code(tar.gz)
    Source code(zip)
  • 1.5.5(Apr 17, 2021)

  • v1.5.3(Jul 27, 2020)

    new in this version:

    • dynamic marks #59 :
      • sv_marksNumber: set custom number of marks.
      • sv_marksPadding: padding from speedometer edge.
      • sv_markHeight and sv_markWidth: size of marks.
      • sv_markStyle: ROUND or BUTT.
      • markColor: color of marks.
    • enum Style class now moved out of Section class.
    • Style.SQUARE is Deprecated, use Style.BUTT.
    • for RaySpeedometer: sv_rayMarkWidth now points to the ray marks instead of sv_markWidth.
    • change custom ticks from list of speed values to list of speed offset scale [0 -1]: speedometer.ticks = arrayListOf(0f, .25f, .5f, .75f, 1f), old way ~speedometer.ticks = arrayListOf(0f, 25f, 50f, 75f, 100f)~

    fixes:

    • fix null custom tick label.
    • fix preview with custom font.
    • fix #177 .
    • fix #178 .
    • fix #185 .
    Source code(tar.gz)
    Source code(zip)
  • v1.5.2(Feb 23, 2020)

    Sections

    • add start and end value: Section(0f, .6f, 0xFF00FF00.toInt())
    • add width and padding to every section. every section may have custom width and padding.
      section.width = ..
      section.padding = ..
      
    • support transparent color.
    • support NoSection.
    • new style, also available in XML sv_sectionStyle:
      • Section.Style.SQUARE
      • Section.Style.ROUND
    • add doOnSections extension.

    fixes and enhancement

    • ImageIndicator accept drawable #171.
    • change Interfaces to Function types.
    • change OnPrintTickLabel interface to OnPrintTickLabelListener 'typealias'.
    • replace SpeedTextFormat with SpeedTextListener 'typealias' #173.
    • access to minSpeed & maxSpeed directly.
    • fix #169 #172 #174 .
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Dec 28, 2019)

    • new multi-sections:
    speedView.addSections(Section(.25f, Color.LTGRAY) // section from 0% to 25%
            , Section(.50f, Color.YELLOW) // section from 25% to 50%
            , Section(.75f, Color.BLUE)// section from 50% to 75%
            , Section(1f, Color.RED)// section from 75% to 100%
    
    // or simply if you need to add 5 sections equal to each others:
    speedView.makeSections(5)
    )
    
    • new support of (no section)
    • OnSectionChangeListener now used Section class:
    speedView.onSectionChangeListener = object :OnSectionChangeListener {
        override fun onSectionChangeListener(previousSection: Section?, newSection: Section?) {
            if (newSection == null)
                // there is no section here!
                return
            if (newSection.speedOffset == 1f)
                // last section
                speedView.addNote(TextNote(context, "slow down"))
        }
    }
    
    • remove 3D Effects from TubeSpeedometer (~~isWithEffects3D~~) .
    • change indicator width and color:
    speedView.indicator.width = ...
    speedView.indicator.color = ...
    
    • Sections and indicator are now Observable by its speedometer.
    • add sv_centerCircleRadius.
    • custom default ticks.
    • all speedometers are open.
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Sep 28, 2019)

  • v1.4.0(Jul 15, 2019)

    rewrite the library in kotlin

    • easy to understand.
    • less NullPointerException.
    • smaller size.

    this version may be unstable.. if you had any issue with kotlin Go back to version 1.3.1

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Sep 21, 2018)

    • fix getter and setter methods of SpeedometerBackColor for TubeSpeedometer.
    • fix color doesn't change at runtime for TubeSpeedometer.
    • fix color changed in RecyclerView at runtime #100 .
    • fix center circle color for PointerSpeedometer #106 .
    • New custom number of decimal for speedText and Ticks #108 . you can use:
    // add 4 decimal places for speedText.
    speedometer.setSpeedTextFormat(4);
    
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Apr 1, 2018)

    if you have been using old version of this library please read this to end. this update coming with:

    • fix text size attribute in AwesomeSpeedometer #70 .
    • change the color of just one tick #71 . now you can use SpannableString for Ticks just use custom tick label and return SpannableString like this:
    speedometer.setOnPrintTickLabel(new OnPrintTickLabel() {
        @Override
        public CharSequence getTickLabel(int tickPosition, float tick) {
            if (tick == 0) {
                SpannableString s = new SpannableString(String.format(Locale.getDefault(), "%d", (int)tick));
                s.setSpan(new ForegroundColorSpan(0xffff1117), 0, 1, 0); // change first char color to Red.
                return s;
            }
            // null means draw default tick.
            return null;
        }
    });
    
    • min and max speed in float #64 .
    • new indicator light effect #78 (beta). new effect behind the indicator, it still unstable if you like to use this effect just use sv_withIndicatorLight="true" and you can customize its color sv_indicatorLightColor="#BB0000FF"
    • new notes positions. if you were using CenterIndicator for Note position, change to QuarterSpeedometer if you were using TopIndicator, change to TopSpeedometer.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.7(Jan 4, 2018)

    fix width and height, and add to ScrollView

    53284d9 issue #56 ,Now you can use wrap_content for both layout_width & layout_height for speedometer family:

    <com.github.anastr.speedviewlib.SpeedView
            android:id="@+id/speedView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    

    fix font cut

    ea2e6cb issue #50, speed text and unit text will no longer be incomplete for all fonts.

    fix Indicator rotation

    78965d7 issue #61, No more random rotation after using sv_minSpeed and sv_maxSpeed attributes.

    Source code(tar.gz)
    Source code(zip)
  • 1.1.6(Sep 11, 2017)

    • New : KiteIndicator, NeedleIndicator.
    • Add : custom tick label dd4343f use OnPrintTickLabel interface #35 .
    • Add : custom ticks position 25a0cd9 use setTicks(0, 10, 60, ...) method #39.
    • delete deprecated methods (getCorrectSpeed,getCorrectIntSpeed) use (getCurrentSpeed,getCurrentIntSpeed).
    • Add : ability to remove the pointer from PointerSpeedometer issue #42 use sv_withPointer attribute 5cc9e41.
    • Fix : speed value change to 0 when device rotation changed 324889e.
    • Fix : padding issue 2bb20f2 #43.
    • Fix : speedometerMode.
    • Fix : sv_indicatorColor and sv_indicatorWidth attributes ed09701.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.5(Jul 19, 2017)

  • 1.1.4(Mar 3, 2017)

    by now, Gauge class is the base class for all Speedometers and Gauges, and Speedometer class is extended Gauge to build custom Circle Speedometers.

    • add "sv_" to all attributes to fix conflicts issue, #20 fixed.
    • create new Gauge class, the base class for all speedometers and gauges.
    • add base LinearGauge for custom gauge.
    • new ProgressiveGauge.
    • new ImageLinearGauge.
    • add Notes For Unlimited Time.
    • add sv_speedTextPadding attribute.
    • add sv_cutPadding attribute to fix indicator cutting #12 when change speedometerMod.
    • add sv_unitTextColor attribute, now speed text and unit text are different thing.
    • safe handle speed in OnSpeedChangeListener with getCorrectIntSpeed().
    • set default decelerate value to 0.1f.
    • update documentation.
    • save CPU usage.
    • fix realSpeedTo method.
    • fix attributes issue with TubeSpeedometer.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.3(Jan 10, 2017)

    • Support API 8.
    • new image indicator.
    • new OnSectionChangeListener.
    • new speedometerMode: change size, style, indicator's position.
    • speed text:
      • new speedTextPosition: change speed text's position.
      • ability to change speed text's format (INTEGER, FLOAT).
      • new unitUnderSpeedText (boolean) change relationship between unitText and speedText, (Under each, side by side).
      • new unitSpeedInterval space between unitText and speedText.
    • change typeface for speed text, new attributes speedTextTypeface ,textTypeface.
    • add speedPercentTo(percent, moveDuration) method.
    • add setIndicator(Indicator indicator) method.
    • add resource image contractor to ImageNote.
    • add setIndicatorAt(int speed) method (move the indicator without Animation).
    • default indicatorColor is material blue.
    • update Documentation.
    • remove Tremble Data range.
    • fix:
      • PointerSpeedometer (startDegree and endDegree issues).
      • methods: speedPercentTo(int), setStartDegree(int), setEndDegree(int).
      • some setter methods (setSpeedometerWidth, setPadding).
      • change startDegree and endDegree together using new setStartEndDegree (int startDegree, int endDegree) method.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.2(Dec 23, 2016)

  • 1.1.1(Dec 9, 2016)

  • 1.1.0(Nov 25, 2016)

    • add unitTextSize to all speedometers.
    • add trembleDegree and trembleDuration Attributes.
    • Control at the beginning and end of the Speedometer, using startDegree and endDegree Attributes, or setStartDegree(int) setEndDegree(int) methods.
    • Control division of the speedometer, now you can change the long of lowSpeed and mediumSpeed segments, using lowSpeedPercent and mediumSpeedPercent Attributes, or setLowSpeedPercent(int) setMediumSpeedPercent(int) methods, issue #8 .
    • support Right to Left Text, speedometerTextRightToLeft Attribute or setspeedometerTextRightToLeft(boolean) method.
    • save 20% CPU usage.
    • Relying on memory, which means few processes on UI thread.
    • one speedometer may take [1 to 2] MB on memory.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.9(Nov 1, 2016)

    • new PointerSpeedometer.
    • fix some methods.
    • save CPU and Memory.
    • update realSpeedTo() method.
    • more control.
    • delete backgroundCircleColor , use Transparent color to remove Circle background.
    • update description.
    • add trembleDegree and trembleDuration, use method setTrembleData().
    • add OnSpeedChangeListener.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.8(Sep 7, 2016)

  • v1.0.6(Aug 30, 2016)

  • v1.0.3(Aug 30, 2016)

  • v1.0.0(Aug 30, 2016)

Owner
Anas Altair
Dentist, Android Developer.
Anas Altair
Utility functions to perform dynamic operations on Android.

Dynamic Utils A collection of static methods and packages to perform dynamic operations on Android 2.3 (API 9) and above. Since v0.4.0, it uses 26.x.x

Pranav Pandey 95 Dec 25, 2022
:star2:A cool dynamic view library

ENViews ENViews, A cool dynamic view library.All designed by Nick Buturishvili ENViews, 一个华丽丽的动效控件库,所有控件原型取自Nick Buturishvili的设计作品 Preview Original de

Est 1.8k Jan 3, 2023
Multi Roots TreeView implementation for Android Platform with a lot of options and customization

Multi roots TreeView :palm_tree: implementation for Android Platform with a lot of options and customization

Amr Hesham 112 Jan 3, 2023
⚡️A highly customizable, powerful and easy-to-use alerting library for Android.

Flashbar A highly customizable, powerful and easy-to-use alerting library for Android. Specs This library allows you to show messages or alerts in you

Aritra Roy 1.7k Dec 7, 2022
Simple and powerful library to emulate iOS's "3D Touch" preview functionality on Android.

Android 3D Touch - PeekView iOS uses 3D Touch as a way to "peek" into full content, such as emails, pictures, web searches, etc. While they have dedic

Luke Klinker 502 Dec 29, 2022
Android SegmentedControl + multi row support

Android SegmentedControl + multi row support + multi selection minSdk API 14+ Demo App, Play store link Or try demo App online ! Segmented control for

Robert 152 Dec 29, 2022
A powerful library for creating notifications in android platform.

Download Download the latest AAR or grab via Maven: <dependency> <groupId>com.github.halysongoncalves</groupId> <artifactId>pugnotification</artif

Halyson Lima Gonçalves 867 Nov 19, 2022
WizardTower - What will eventually be a Roguelike about being a powerful wizard, with a tower.

Wizard Tower Roguelike by sgibber2018 Description: This is a Roguelike I've been wanting to make for a long time. The premise is really simple: you ar

Sam Gibson 0 Jan 5, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Dec 29, 2022
A nicer-looking, more intuitive and highly customizable alternative for radio buttons and dropdowns for Android.

SwipeSelector Undergoing for some API changes for a 2.0 major version, see example usage in the sample module! What and why? Bored of dull looking rad

Iiro Krankka 1.1k Dec 30, 2022
Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.

CircleDisplay Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations. Features Core featur

Philipp Jahoda 287 Nov 18, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Dec 6, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022