Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
Added all missing code for data elements on the 4 data views
Browse files Browse the repository at this point in the history
  • Loading branch information
jilleb committed Feb 14, 2018
1 parent bf5d69f commit 9324f7d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 5 deletions.
65 changes: 62 additions & 3 deletions app/src/main/java/com/mqbcoding/stats/DashboardFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -1012,12 +1012,12 @@ private void updateClock(String query, Speedometer dial, RaySpeedometer visray)
dial.speedTo(clockValue == null ? 0.0f : clockValue);
}
break;
case "EcoHMI_Score_AvgShort":
case "EcoHMI_Score.AvgShort":
if (clockValue != null) {
dial.speedTo(clockValue == null ? 0f : clockValue);
}
break;
case "EcoHMI_Score_AvgTrip":
case "EcoHMI_Score.AvgTrip":
if (clockValue != null) {
dial.speedTo(clockValue == null ? 0f : clockValue);
}
Expand Down Expand Up @@ -1170,7 +1170,7 @@ private void updateElement(String queryElement, TextView value, TextView label)
}
break;
case "gearboxOilTemperature":
String tempUnit3 = (String) mLastMeasurements.get("gearboxTemperature.unit");
String tempUnit3 = (String) mLastMeasurements.get("gearboxOilTemperature.unit");
Float mGearboxOilTemp = (Float) mLastMeasurements.get(queryElement);
if (mGearboxOilTemp != null && tempUnit3 != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mGearboxOilTemp + tempUnit3));
Expand Down Expand Up @@ -1266,6 +1266,65 @@ private void updateElement(String queryElement, TextView value, TextView label)

}
break;
case "lateralAcceleration":
Float mLateralAcceleration = (Float) mLastMeasurements.get(queryElement);
if (mLateralAcceleration != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mLateralAcceleration + "G"));
}
break;
case "longitudinalAcceleration":
Float mlongitudinalAcceleration = (Float) mLastMeasurements.get(queryElement);
if (mlongitudinalAcceleration != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mlongitudinalAcceleration + "G"));
}
break;
case "yawRate":
Float mYawRate = (Float) mLastMeasurements.get(queryElement);
if (mYawRate != null) {
Float mYawRatePct = mYawRate * 100;
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mYawRatePct + "%"));
}
break;
case "acceleratorPosition":
Float mAcceleratorPosition = (Float) mLastMeasurements.get(queryElement);
if (mAcceleratorPosition != null) {
Float mYawRatePct = mAcceleratorPosition * 100;
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mYawRatePct + "%"));
}
break;
case "brakePressure":
Float mBrakePressure = (Float) mLastMeasurements.get(queryElement);
if (mBrakePressure != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mBrakePressure + "%"));
}
break;
case "wheelAngle":
Float mWheelAngle = (Float) mLastMeasurements.get(queryElement);
if (mWheelAngle != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.decimals).toString(), mWheelAngle + "°"));
}
break;
case "powermeter":
Float mPowermeter = (Float) mLastMeasurements.get(queryElement);
if (mPowermeter != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.no_decimals).toString(), mPowermeter));
}
break;
case "EcoHMI_Score.AvgShort":
Float mEcoScoreShort = (Float) mLastMeasurements.get(queryElement);
if (mEcoScoreShort != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.no_decimals).toString(), mEcoScoreShort));
}
break;
case "EcoHMI_Score.AvgTrip":
Float mEcoScoreTrip = (Float) mLastMeasurements.get(queryElement);
if (mEcoScoreTrip != null) {
value.setText(String.format(Locale.US, getContext().getText(R.string.no_decimals).toString(), mEcoScoreTrip));
}
break;



}


Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
<item>acceleratorPosition</item>
<item>brakePressure</item>
<item>powermeter</item>
<item>EcoHMI_Score_AvgShort</item>
<item>EcoHMI_Score_AvgTrip</item>
<item>EcoHMI_Score.AvgShort</item>
<item>EcoHMI_Score.AvgTrip</item>
<item>test</item>
</string-array>

Expand Down

0 comments on commit 9324f7d

Please sign in to comment.