fix bug of global route next does not show and acc refresh
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -11,20 +13,16 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotVehicleStateListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager;
|
||||
import com.mogo.eagle.core.function.hmi.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import chassis.Chassis;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author Jing
|
||||
@@ -42,6 +40,22 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
|
||||
private static final int MSG_SEND_UPDATE = 1;
|
||||
private volatile double acceleration;
|
||||
|
||||
@SuppressLint("HandlerLeak")
|
||||
private final Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(@NonNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_SEND_UPDATE) {
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00");
|
||||
String accStr = mFormat.format(acceleration);
|
||||
accTextView.setText("a: " + accStr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public TrafficDataView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -64,12 +78,10 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
super.onAttachedToWindow();
|
||||
CallerAutopilotVehicleStateListenerManager.INSTANCE.addListener(TAG, mIMoGoAutopilotVehicleStateListener);
|
||||
CallerAutopilotCarStatusListenerManager.INSTANCE.addListener(TAG, gnssInfo -> {
|
||||
CallerLogger.INSTANCE.d(TAG, "司机屏加速度:" + gnssInfo.getAcceleration());
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
java.text.DecimalFormat mFormat = new java.text.DecimalFormat("0.00");
|
||||
String accStr = mFormat.format(gnssInfo.getAcceleration());
|
||||
accTextView.setText("a: " + accStr);
|
||||
});
|
||||
if (gnssInfo != null) {
|
||||
acceleration = gnssInfo.getAcceleration();
|
||||
}
|
||||
handler.sendEmptyMessageDelayed(MSG_SEND_UPDATE, 1000L);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,7 +108,7 @@ public class TrafficDataView extends ConstraintLayout {
|
||||
*/
|
||||
@Override
|
||||
public void onAutopilotLightSwitchData(@org.jetbrains.annotations.Nullable Chassis.LightSwitch lightSwitch) {
|
||||
if(lightSwitch != null){
|
||||
if (lightSwitch != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "车辆转向灯:" + lightSwitch.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class AMapCustomView
|
||||
Log.d(TAG, "onAutopilotRotting");
|
||||
List list = globalPathResp.getWayPointsList();
|
||||
int minCount = 2;
|
||||
if (list.size() >= minCount && sList.size() == 0 && eList.size() == 0 && mWayPointList.size() == 0) {
|
||||
if (list.size() >= minCount) {
|
||||
calculate = true;
|
||||
MessagePad.Location sLocation = (MessagePad.Location) list.get(0);
|
||||
MessagePad.Location eLocation = (MessagePad.Location) list.get(list.size() - 1);
|
||||
|
||||
Reference in New Issue
Block a user