Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.widget.Button;

import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.Timer;
import java.util.TimerTask;

Expand Down Expand Up @@ -380,8 +381,6 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
kmphView.setText((Math.round((carSpeed / 40.0) * 10.0) / 10.0) + " km/h");
mpsView.setText((Math.round((carSpeed / 144.0) * 10.0) / 10.0) + " m/s");
speedBar.setProgress(Math.max(0, Math.abs(carSpeed) - 60));
}
});
Expand Down Expand Up @@ -542,8 +541,13 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
speedLeftBar.setProgress(Math.max(0, Math.abs(speed_left) - 20));
speedRightBar.setProgress(Math.max(0, Math.abs(speed_right) - 20));
speedLeftBar.setProgress((Math.max(speed_left, 0) * 100) / 127);
speedLeftBar.setSecondaryProgress((Math.max(-speed_left, 0) * 100) / 127);
speedRightBar.setProgress((Math.max(speed_right, 0) * 100) / 127);
speedRightBar.setSecondaryProgress((Math.max(-speed_right, 0) * 100) / 127);
DecimalFormat decimalFormat = new DecimalFormat("#.##");
kmphView.setText(decimalFormat.format(((speed_left + speed_right) / 2.0) * 0.036) + " km/h");
mpsView.setText(decimalFormat.format(((speed_left + speed_right) / 2.0) * 0.01) + " m/s");
}
});
} else if (characteristic.getUuid().compareTo(bleHandler.CHAR_UUID_ERROR) == 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#00000000" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="4dp" />
<gradient
android:startColor="#d07c40ff"
android:endColor="#d0ff40bf"
android:angle="0" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="4dp" />
<gradient
android:startColor="#e04046ff"
android:endColor="#e0fff540"
android:angle="0" />
</shape>
</clip>
</item>
</layer-list>
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,24 @@
android:id="@+id/speedLeftBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="8dp"
android:layout_weight="1"
android:layout_marginBottom="-4dp"
android:layout_marginTop="-4dp"
android:max="64"
android:progress="0" />
android:max="100"
android:progress="0"
android:secondaryProgress="0"
android:progressDrawable="@drawable/wheel_speed_progress_bar" />

<ProgressBar
android:id="@+id/speedRightBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="8dp"
android:layout_weight="1"
android:layout_marginBottom="-4dp"
android:layout_marginTop="-4dp"
android:max="64"
android:max="100"
android:progress="0"
android:rotation="180" />
android:secondaryProgress="0"
android:rotation="180"
android:progressDrawable="@drawable/wheel_speed_progress_bar" />

</LinearLayout>

Expand Down