anastr / SpeedView

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Apache License 2.0
1.28k stars 321 forks source link

Indicator Does Not Move If withTremble Is Set to False #217

Closed tillchen closed 2 years ago

tillchen commented 2 years ago

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):

Additional context None.

anastr commented 2 years ago

Hi @tillchen , Do you think this issue related to #213. I didn't face this issue, I need more details in order to find a solution. Thanks!

tillchen commented 2 years ago

Hi @anastr ,

Thanks for the reply! I looked into #213 and I think they could be related. But the difference is that mine does not move at all, while #213 moves fast.

tillchen commented 2 years ago

My XML is below:

        <com.github.anastr.speedviewlib.SpeedView
            android:id="@+id/gauge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:sv_withTremble="false"
            app:sv_speedTextColor="?android:attr/textColorPrimary"
            app:sv_speedTextFormat="INTEGER"
            app:sv_textColor="?android:attr/textColorPrimary"
            app:sv_unit=""
            app:sv_indicator="KiteIndicator"
            app:sv_tickNumber="5"
            app:sv_withIndicatorLight="true"
            app:sv_centerCircleRadius="0dp"
            app:sv_sectionStyle="ROUND"/>

And I'm simply calling binding.gauge.speedTo(50f) in onCreateView().

anastr commented 2 years ago

Is your fragment part of a viewpager or it's just been added directly to a host fragment? And what is the parent view group of your fragment?

tillchen commented 2 years ago

I'm using the navigation component, so it's not part of a viewpager. The parent view group is the navhost container.

anastr commented 2 years ago

Version 1.5.52 has been released, this issue should have been fixed.

tillchen commented 2 years ago

Version 1.5.52 has been released, this issue should have been fixed.

Great! I will confirm this later and then close the issue. Thank you!