[change]修改显示
This commit is contained in:
@@ -54,8 +54,7 @@ dependencies {
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
// api "com.zhidao.support.adas:high:1.2.1.2_bate21"
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.53-beta'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.53'
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class DataDistribution {
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS ", Locale.getDefault());
|
||||
private Future future;
|
||||
private final List<OnAdasClientListener> listeners = new ArrayList<>();
|
||||
private volatile boolean isCutDown = true;//是否缩短日志显示
|
||||
|
||||
private DataDistribution() {
|
||||
queue = new LinkedBlockingQueue<>();
|
||||
@@ -83,8 +84,11 @@ public class DataDistribution {
|
||||
future = null;
|
||||
}
|
||||
|
||||
public void setCutDown(boolean cutDown) {
|
||||
this.isCutDown = cutDown;
|
||||
}
|
||||
|
||||
private static final int LIST_SIZE = 5;//默认list最大数据量5个
|
||||
private static final int LIST_SIZE = 50;//默认list最大数据量5个
|
||||
public final List<String> listTrajectory = new ArrayList<>();
|
||||
public final List<String> listTrackedObjects = new ArrayList<>();
|
||||
public final List<String> listGnssInfo = new ArrayList<>();
|
||||
@@ -104,7 +108,7 @@ public class DataDistribution {
|
||||
String str = data.toString();
|
||||
if (data instanceof Trajectory) {
|
||||
String temp = time + str;
|
||||
if (temp.length() > 588) {
|
||||
if (isCutDown && temp.length() > 588) {
|
||||
temp = temp.substring(0, 588) + "\n(已缩短。如需查看完整数据,请勾选日志存储复选框)";
|
||||
}
|
||||
listTrajectory.add(temp);
|
||||
@@ -118,7 +122,7 @@ public class DataDistribution {
|
||||
}
|
||||
} else if (data instanceof TrackedObjects) {
|
||||
String temp = time + str;
|
||||
if (temp.length() > 588) {
|
||||
if (isCutDown && temp.length() > 588) {
|
||||
temp = temp.substring(0, 588) + "\n(已缩短。如需查看完整数据,请勾选日志存储复选框)";
|
||||
}
|
||||
listTrackedObjects.add(temp);
|
||||
@@ -238,7 +242,7 @@ public class DataDistribution {
|
||||
}
|
||||
} else if (data instanceof ErrorData) {
|
||||
listErrorData.add(time + str);
|
||||
if (listErrorData.size() > 50) {
|
||||
if (listErrorData.size() > 100) {
|
||||
listErrorData.remove(0);
|
||||
}
|
||||
if (!listeners.isEmpty()) {
|
||||
|
||||
@@ -150,198 +150,10 @@ public class InfoFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onWarnEvent(Warn info) {
|
||||
//
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_WARN)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onRectEvent(TrackedObjects info) {
|
||||
//
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_TRACKED_OBJECTS)) {
|
||||
// if (data.size() > 4) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onErrorEvent(ErrorData info) {
|
||||
//
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_ERROR)) {
|
||||
// if (data.size() > 19) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void onTurnLightState(int turnLight, boolean brake_light) {
|
||||
// StringBuilder builder = new StringBuilder(MainActivity.TITLE.RECEIVE_VEHICLE_STATE + "\t");
|
||||
// if (turnLight == 0) {
|
||||
// builder.append("左转:关");
|
||||
// builder.append("右转:关");
|
||||
// } else if (turnLight == 1) {
|
||||
// builder.append("左转:开");
|
||||
// builder.append("右转:关");
|
||||
// } else if (turnLight == 2) {
|
||||
// builder.append("左转:关");
|
||||
// builder.append("右转:开");
|
||||
// }
|
||||
//
|
||||
// builder.append(brake_light ? " 刹车:开" : " 刹车:关");
|
||||
// tvTitle.setText(builder.toString());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 解析转向灯
|
||||
// */
|
||||
// private int turnLightTimes = 0;
|
||||
// private boolean isOnTurnLight = false;
|
||||
// private int turnLight = 0;
|
||||
//
|
||||
// public int setTurnLightState(int turn_light) {
|
||||
// if (turn_light == 0) {
|
||||
// if (isOnTurnLight) {
|
||||
// if (turnLightTimes >= 10) {
|
||||
// isOnTurnLight = false;
|
||||
// turnLight = 0;
|
||||
// }
|
||||
// turnLightTimes++;
|
||||
// }
|
||||
// } else if (turn_light == 1) {
|
||||
// turnLightTimes = 0;
|
||||
// isOnTurnLight = true;
|
||||
// turnLight = 1;
|
||||
// } else if (turn_light == 2) {
|
||||
// turnLightTimes = 0;
|
||||
// isOnTurnLight = true;
|
||||
// turnLight = 2;
|
||||
// }
|
||||
// return turnLight;
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onVehicleStateEvent(VehicleState info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_VEHICLE_STATE)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// int light = info.bean.getLight().getNumber();//转向灯状态 0是正常 1是左转 2是右转
|
||||
// onTurnLightState(setTurnLightState(light), info.bean.getBrakeLightStatus());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onGnssInfoEvent(GnssInfo info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_GNSS_INFO)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onAutopilotStateEvent(AutopilotState info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_AUTOPILOT_STATE)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onTrajectoryEvent(Trajectory info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_TRAJECTORY)) {
|
||||
// if (data.size() > 4) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onArrivalNotificationEvent(ArrivalNotification info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_ARRIVAL_NOTIFICATION)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onGlobalPathEvent(GlobalPathResp info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_GLOBAL_PATH_RESP)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onRecordPanelEvent(RecordPanel info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_RECORD_RESULT)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onMogoReportMessageEvent(MogoReportMessage info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_REPORT_MESSAGE)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
// public void onPerceptionTrafficLightEvent(PerceptionTrafficLight info) {
|
||||
// if (title.equals(MainActivity.TITLE.RECEIVE_PERCEPTION_TRAFFIC_LIGHT)) {
|
||||
// if (data.size() > 9) {
|
||||
// data.remove(0);
|
||||
// }
|
||||
// data.add(info.toString());
|
||||
// adapter.notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onRefreshView() {
|
||||
if (adapter != null) {
|
||||
// adapter.notifyDataSetChanged();
|
||||
adapter.refreshView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
private CheckBox cb_print;
|
||||
private CheckBox cb_save;
|
||||
private CheckBox cb_timeout;
|
||||
private CheckBox cb_cut_down;
|
||||
private RecyclerView infoBtn;
|
||||
private RecyclerView infoFragment;
|
||||
private TextView tvConnectState;
|
||||
@@ -219,6 +220,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
cb_print = findViewById(R.id.cb_print);
|
||||
cb_save = findViewById(R.id.cb_save);
|
||||
cb_timeout = findViewById(R.id.cb_timeout);
|
||||
cb_cut_down = findViewById(R.id.cb_cut_down);
|
||||
title = findViewById(R.id.title);
|
||||
infoBtn = findViewById(R.id.info_btn);
|
||||
infoFragment = findViewById(R.id.info_fragment);
|
||||
@@ -315,6 +317,19 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
return true;
|
||||
}
|
||||
});
|
||||
cb_cut_down.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
DataDistribution.getInstance().setCutDown(isChecked);
|
||||
}
|
||||
});
|
||||
cb_cut_down.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
showToastCenter("显示数据量过大,会引起刷新卡顿", Toast.LENGTH_LONG);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
connectionType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
|
||||
@@ -26,38 +26,44 @@
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/selector_role" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_ip"
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/title"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="本机IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/local_ip"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="IPC IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="IPC IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="本机IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_toEndOf="@id/local_ip"
|
||||
android:layout_toEndOf="@id/layout_ip"
|
||||
android:layoutDirection="rtl">
|
||||
|
||||
|
||||
@@ -66,11 +72,75 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_cb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_print"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="打印"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="存储"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_log_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/log_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="日志:"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_cut_down"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="缩短"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/layout_log_hint"
|
||||
android:background="#fff124" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -103,55 +173,6 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/tv_connect_state"
|
||||
android:background="#fff124" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_cb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layoutDirection="ltr"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_print"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="打印"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cb_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="存储"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/log_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="日志:"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/log_hint"
|
||||
android:background="#fff124" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
|
||||
Reference in New Issue
Block a user