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 Bintray 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, and you can use old version 1.3.1 written in java.

Speedometers...

Gauges...

Donations

if you like this project, you can support it and support the creator of it, and we are really thankful for your donations 😄 .

All donations accepted in Bountysource:

  • 5$: good job, here's a cup of tea (we know you don't like coffee 😉 ).
  • 10$: very nice library, you saved my day.
  • 15$: really appreciate your work, keep going!.
  • 100$, maybe more: you are a Dentist, and you have done all of this!!

go to project in bountysource for more options.

Download

this library required jcenter and kotlin version 1.3.72 or above, you still can use it in java projects.

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

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

add this line to build.gradle app module level:

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

for maven

<dependency>
  <groupId>com.github.anastr</groupId>
  <artifactId>speedviewlib</artifactId>
  <version>1.5.3</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 speed:

SpeedView speedometer = findViewById(R.id.speedView)

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

by default, the speed change Duration between last speed and new speed is 2000 ms.
you can use other Duration by method :

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

automatically indicator move 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 method in the 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 useful change.

Coming Soon ...

I will try to draw this Speedometer. if you have any idea, image, template please open new issue and give me the image , and i well try to add it to the Library.

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
An amazing and convenient Android image slider.

Android Image Slider ![Gitter](https://badges.gitter.im/Join Chat.svg) This is an amazing image slider for the Android platform. I decided to open sou

代码家 5.6k Jan 7, 2023
Android Country Picker is a Kotlin-first, flexible and powerful Android library that allows to integrate Country Picker with just a few lines.

1. Add dependency dependencies { implementation 'com.hbb20:android-country-picker:X.Y.Z' } For latest version, 2. Decide your use-case

Harsh B. Bhakta 65 Dec 6, 2022
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Keepsafe 405 Nov 11, 2022
Android Library To Create Button With Multi Reactions like Facebook or Linkedin

ReactButton Android Library written in Java to Create ReactButton with Multi Reactions like Facebook or Linkedin ?? Default Reactions ?? Custom Reacti

Amr Hesham 103 Dec 15, 2022
AndroidPhotoFilters aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image media.

PhotoFiltersSDK PhotoFiltersSDK aims to provide fast, powerful and flexible image processing instrument for creating awesome effects on any image medi

Zomato 2.5k Dec 23, 2022
DrawBox: a multi-purpose tool to draw anything on canvas, written completely on jetpack compose

DrawBox DrawBox is a multi-purpose tool to draw anything on canvas, written comp

Akshay Sharma 172 Dec 30, 2022
Render After Effects animations natively on Android and iOS, Web, and React Native

Lottie for Android, iOS, React Native, Web, and Windows Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations expo

Airbnb 33.5k Jan 4, 2023
A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures

Stfalcon ImageViewer A simple and customizable full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" g

Stfalcon LLC 1.9k Jan 5, 2023
A component for flip animation on Android, which is similar to the effect in Flipboard iPhone/Android

android-flip Aphid FlipView is a UI component to accomplish the flipping animation like Flipboard does. A pre-built demo APK file for Android OS 2.2+

Bo 2.8k Dec 21, 2022
:rocket: Ultimate Android Reference - Your Road to Become a Better Android Developer

The goal of this project is to provide a hand-picked collection of Android libraries, tools, open-source projects, books, blogs, tutorials - you name

Aritra Roy 7.6k Jan 4, 2023
Deprecated in favour of https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html

Deprecated: use https://developer.android.com/reference/android/support/v4/view/animation/PathInterpolatorCompat.html instead. android-cubic-bezier-in

Codesoup 161 Jan 1, 2023
[] Easily have blurred and transparent background effect on your Android views.

##[DEPRECATED] BlurBehind Easily have blurred and transparent background effect on your Android views. Before API level 14 there was a Window flag cal

Gokberk Ergun 516 Nov 25, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon

ChatKit for Android ChatKit is a library designed to simplify the development of UI for such a trivial task as chat. It has flexible possibilities for

Stfalcon LLC 3.6k Jan 5, 2023
Android library to animate Floating Action Button to Bottom Sheet Dialog and vice-versa

FabulousFilter Show some ❤️ and star the repo to support the project This library is the implementation of filter-concept posted on MaterialUp.com. It

Krupen Ghetiya 2.6k Jan 3, 2023
FPSAnimator is very easy animation library for Android TextureView and SurfaceView.

FPSAnimator A simple but powerful Tween / SpriteSheet / ParabolicMotion / animation library for Android TextureView and SurfaceView. Features The cont

Masayuki Suda 756 Dec 30, 2022
How to apply meaningful and delightful motion in a sample Android app

Applying meaningful motion on Android How to apply meaningful and delightful motion in a sample Android app Read the complete post at https://medium.c

André Mion 166 Nov 12, 2022
Continuous speech recognition library for Android with options to use GoogleVoiceIme dialog and offline mode.

Android Speech Recognition This library lets you perform continuous voice recognition in your android app with options to either use Google Voice Ime

Maxwell Obi 75 May 21, 2022
An Android library to build form and form validations easily.

FormBuilder An Android library to build form and form validations easily. Example COMING SOON Requirements Android 4.3+ Installation Add edit your bui

Dario Pellegrini 48 Jun 30, 2022