mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-25 08:16:07 +00:00
Fix division by zero when calculating progress for large periods
This commit is contained in:
parent
c73c29d2ec
commit
93cc945a2c
3 changed files with 4 additions and 4 deletions
|
@ -65,8 +65,8 @@ public class TotpProgressBar extends ProgressBar {
|
|||
int currentProgress = (int) (maxProgress * ((float) millisTillRotation / (_period * 1000)));
|
||||
|
||||
// start progress animation, compensating for any changes to the animator duration scale settings
|
||||
int animPart = maxProgress / _period;
|
||||
int animEnd = (currentProgress / animPart) * animPart;
|
||||
float animPart = (float) maxProgress / _period;
|
||||
int animEnd = (int) ((currentProgress / animPart) * animPart);
|
||||
int animPartDuration = (int) (1000 / _animDurationScale);
|
||||
float animDurationFraction = (float) (currentProgress - animEnd) / animPart;
|
||||
int realAnimDuration = (int) (1000 * animDurationFraction);
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="3dp"
|
||||
android:id="@+id/progressBar"
|
||||
android:max="1000"
|
||||
android:max="5000"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="3dp"
|
||||
android:id="@+id/progressBar"
|
||||
android:max="1000"
|
||||
android:max="5000"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
Loading…
Add table
Reference in a new issue