fixed bugs

This commit is contained in:
lixiaopeng
2022-02-24 16:43:50 +08:00
parent fea95ebf84
commit 60622ef131
5 changed files with 53 additions and 31 deletions

View File

@@ -64,12 +64,14 @@ class SpeedPanelView @JvmOverloads constructor(
private val timerTask = object : TimerTask() {
override fun run() {
if (mLatLng != null) {
mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing)
UiThreadHandler.post {
val speed = (mLatLng!!.speed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > mSpeedLimmit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
if (mMogoServiceApis.mapServiceApi != null && mMogoServiceApis.mapServiceApi.mapUIController != null) {
mSpeedLimmit = mMogoServiceApis.mapServiceApi.mapUIController.getSpeedLimmit(mLatLng!!.longitude, mLatLng!!.latitude, mLatLng!!.bearing)
UiThreadHandler.post {
val speed = (mLatLng!!.speed * 3.6f).toInt()
mSpeedChartView.setArcColor(Color.parseColor(if (speed > mSpeedLimmit) "#DB3137" else "#3E77F6"))
mSpeedChartView.setValues(speed)
setBackgroundResource(if (speed > mSpeedLimmit) R.drawable.yi_biao_pan_bg_speeding else R.drawable.yi_biao_pan_bg_nor)
}
}
}
}

View File

@@ -67,12 +67,16 @@ public class SmallMapFragment extends BaseFragment
@Override
public void showPanel() {
mSmallMapDirectionView.setVisibility(View.VISIBLE);
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.setVisibility(View.VISIBLE);
}
}
@Override
public void hidePanel() {
mSmallMapDirectionView.setVisibility(View.GONE);
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.setVisibility(View.GONE);
}
}
@Override
@@ -103,20 +107,26 @@ public class SmallMapFragment extends BaseFragment
@Override
public void onResume() {
super.onResume();
mSmallMapDirectionView.onResume();
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.onResume();
}
}
@Override
public void onPause() {
super.onPause();
mSmallMapDirectionView.onPause();
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.onPause();
}
}
@Override
public void onDestroy() {
super.onDestroy();
mSmallMapDirectionView.onDestroy();
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.onDestroy();
}
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
}

View File

@@ -32,15 +32,17 @@ public class SpeedLimitDataManager implements IMogoCarLocationChangedListener2 {
@Override
public void run() {
if (mLocation != null){
int speedLimmit = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getSpeedLimmit(mLocation.getLongitude(),mLocation.getLatitude(),mLocation.getBearing());
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (speedLimmit > 0){
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimmit);
if (MogoApisHandler.getInstance().getApis().getMapServiceApi() != null && MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() != null) {
int speedLimmit = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getSpeedLimmit(mLocation.getLongitude(), mLocation.getLatitude(), mLocation.getBearing());
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (speedLimmit > 0) {
CallerHmiManager.INSTANCE.showLimitingVelocity(speedLimmit);
}
}
}
});
});
}
}
}
};