[add]测试程序完善
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".ui.mian.MainActivity"
|
||||
android:name=".ui.MainActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
@@ -49,7 +49,9 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.autopilot.AutopilotConfigActivity">
|
||||
<activity
|
||||
android:name=".ui.AutopilotConfigActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AutopilotConfigAdapter extends RecyclerView.Adapter<AutopilotConfigAdapter.MyViewHolder> {
|
||||
|
||||
private List<AutoPilotMode> datas;
|
||||
private Context mContext;
|
||||
private OnHaveDataListener onHaveDataListener;
|
||||
private boolean isShowDel = false;
|
||||
|
||||
public AutopilotConfigAdapter(List<AutoPilotMode> datas) {
|
||||
this.datas = datas;
|
||||
if (datas == null) {
|
||||
this.datas = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowDel(boolean showDel) {
|
||||
isShowDel = showDel;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public List<AutoPilotMode> getDatas() {
|
||||
return datas;
|
||||
}
|
||||
|
||||
public interface OnHaveDataListener {
|
||||
void onHaveData(boolean isHave);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnHaveDataListener l) {
|
||||
this.onHaveDataListener = l;
|
||||
}
|
||||
|
||||
public void add() {
|
||||
datas.add(new AutoPilotMode());
|
||||
notifyItemInserted(datas.size() - 1);
|
||||
if (onHaveDataListener != null && datas.size() == 1)
|
||||
onHaveDataListener.onHaveData(true);
|
||||
}
|
||||
|
||||
public void minus(int position) {
|
||||
AutoPilotMode bean = datas.get(position);
|
||||
bean.wayLatLons = null;
|
||||
bean = null;
|
||||
datas.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
notifyItemRangeChanged(position, getItemCount());
|
||||
if (onHaveDataListener != null && datas.size() == 0)
|
||||
onHaveDataListener.onHaveData(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
//创建ViewHolder
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//实例化得到Item布局文件的View对象
|
||||
mContext = parent.getContext();
|
||||
View v = LayoutInflater.from(mContext).inflate(R.layout.item_autopilot_config, parent, false);
|
||||
//返回MyViewHolder的对象
|
||||
return new MyViewHolder(v);
|
||||
}
|
||||
|
||||
//绑定数据
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
AutoPilotMode mode = datas.get(position);
|
||||
if (!TextUtils.isEmpty(mode.name))
|
||||
holder.path_name.setText(mode.name);
|
||||
if (mode.speedLimit != 0.0)
|
||||
holder.speed.setText(String.valueOf(mode.speedLimit));
|
||||
if (!TextUtils.isEmpty(mode.startName))
|
||||
holder.start_name.setText(mode.startName);
|
||||
if (!TextUtils.isEmpty(mode.endName))
|
||||
holder.end_name.setText(mode.endName);
|
||||
if (mode.startLatLon != null) {
|
||||
if (mode.startLatLon.longitude != 0.0)
|
||||
holder.start_lon.setText(String.valueOf(mode.startLatLon.longitude));
|
||||
if (mode.startLatLon.latitude != 0.0)
|
||||
holder.start_lat.setText(String.valueOf(mode.startLatLon.latitude));
|
||||
}
|
||||
if (mode.endLatLon != null) {
|
||||
if (mode.endLatLon.longitude != 0.0)
|
||||
holder.end_lon.setText(String.valueOf(mode.endLatLon.longitude));
|
||||
if (mode.endLatLon.latitude != 0.0)
|
||||
holder.end_lat.setText(String.valueOf(mode.endLatLon.latitude));
|
||||
}
|
||||
holder.setViaData();
|
||||
holder.del.setVisibility(isShowDel ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
//返回Item的数量
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas == null ? 0 : datas.size();
|
||||
}
|
||||
|
||||
//继承RecyclerView.ViewHolder抽象类的自定义ViewHolder
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
RecyclerView recyclerView;
|
||||
EditText path_name;
|
||||
EditText speed;
|
||||
EditText start_name;
|
||||
EditText end_name;
|
||||
EditText start_lon;
|
||||
EditText start_lat;
|
||||
EditText end_lon;
|
||||
EditText end_lat;
|
||||
TextView num;
|
||||
TextView del;
|
||||
ImageView add;
|
||||
ImageView minus;
|
||||
ViaPositionAdapter adapter;
|
||||
|
||||
MyViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
recyclerView = itemView.findViewById(R.id.RecyclerView);
|
||||
path_name = itemView.findViewById(R.id.path_name);
|
||||
speed = itemView.findViewById(R.id.speed);
|
||||
start_name = itemView.findViewById(R.id.start_name);
|
||||
end_name = itemView.findViewById(R.id.end_name);
|
||||
start_lon = itemView.findViewById(R.id.start_lon);
|
||||
start_lat = itemView.findViewById(R.id.start_lat);
|
||||
end_lon = itemView.findViewById(R.id.end_lon);
|
||||
end_lat = itemView.findViewById(R.id.end_lat);
|
||||
num = itemView.findViewById(R.id.num);
|
||||
del = itemView.findViewById(R.id.del);
|
||||
add = itemView.findViewById(R.id.add);
|
||||
minus = itemView.findViewById(R.id.minus);
|
||||
initRecyclerView();
|
||||
minus.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
minus();
|
||||
}
|
||||
});
|
||||
add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
add();
|
||||
}
|
||||
});
|
||||
del.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AutopilotConfigAdapter.this.minus(getBindingAdapterPosition());
|
||||
}
|
||||
});
|
||||
path_name.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
datas.get(getBindingAdapterPosition()).name = s.toString().trim();
|
||||
}
|
||||
});
|
||||
speed.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
datas.get(getBindingAdapterPosition()).speedLimit = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
speed.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
datas.get(getBindingAdapterPosition()).speedLimit = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
start_name.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
datas.get(getBindingAdapterPosition()).startName = s.toString().trim();
|
||||
}
|
||||
});
|
||||
end_name.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
datas.get(getBindingAdapterPosition()).endName = s.toString().trim();
|
||||
}
|
||||
});
|
||||
start_lon.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
if (datas.get(getBindingAdapterPosition()).startLatLon == null)
|
||||
datas.get(getBindingAdapterPosition()).startLatLon = new AutoPilotMode.Location();
|
||||
datas.get(getBindingAdapterPosition()).startLatLon.longitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
start_lon.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
if (datas.get(getBindingAdapterPosition()).startLatLon != null) {
|
||||
datas.get(getBindingAdapterPosition()).startLatLon.longitude = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
start_lat.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
if (datas.get(getBindingAdapterPosition()).startLatLon == null)
|
||||
datas.get(getBindingAdapterPosition()).startLatLon = new AutoPilotMode.Location();
|
||||
datas.get(getBindingAdapterPosition()).startLatLon.latitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
start_lat.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
if (datas.get(getBindingAdapterPosition()).startLatLon != null)
|
||||
datas.get(getBindingAdapterPosition()).startLatLon.latitude = 0.0;
|
||||
}
|
||||
}
|
||||
});
|
||||
end_lon.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
if (datas.get(getBindingAdapterPosition()).endLatLon == null)
|
||||
datas.get(getBindingAdapterPosition()).endLatLon = new AutoPilotMode.Location();
|
||||
datas.get(getBindingAdapterPosition()).endLatLon.longitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
end_lon.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
if (datas.get(getBindingAdapterPosition()).endLatLon != null)
|
||||
datas.get(getBindingAdapterPosition()).endLatLon.longitude = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
end_lat.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
if (datas.get(getBindingAdapterPosition()).endLatLon == null)
|
||||
datas.get(getBindingAdapterPosition()).endLatLon = new AutoPilotMode.Location();
|
||||
datas.get(getBindingAdapterPosition()).endLatLon.latitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
end_lat.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
if (datas.get(getBindingAdapterPosition()).endLatLon != null)
|
||||
datas.get(getBindingAdapterPosition()).endLatLon.latitude = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
adapter = new ViaPositionAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
private void minus() {
|
||||
if (adapter.getItemCount() > 0) {
|
||||
adapter.minus();
|
||||
num.setText(String.valueOf(adapter.getItemCount()));
|
||||
}
|
||||
}
|
||||
|
||||
public void add() {
|
||||
adapter.addHint();
|
||||
recyclerView.scrollToPosition(adapter.getItemCount() - 1);
|
||||
num.setText(String.valueOf(adapter.getItemCount()));
|
||||
}
|
||||
|
||||
public void setViaData() {
|
||||
if (adapter.getDatas() == null) {
|
||||
List<AutoPilotMode.Location> list = datas.get(getBindingAdapterPosition()).wayLatLons;
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
datas.get(getBindingAdapterPosition()).wayLatLons = list;
|
||||
}
|
||||
adapter.setDatas(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 线路
|
||||
* @date 2021/8/13
|
||||
*/
|
||||
public class LineAdapter extends BaseAdapter<AutoPilotMode, LineAdapter.ViewHolder> {
|
||||
|
||||
|
||||
public LineAdapter(List<AutoPilotMode> data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(List<AutoPilotMode> mDatas) {
|
||||
super.setData(mDatas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, AutoPilotMode data, int position) {
|
||||
viewHolder.title.setText(data.name + " " + data.startName + "->" + data.endName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_info, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
class ViewHolder extends BaseViewHolder<LineAdapter> {
|
||||
TextView title;
|
||||
|
||||
public ViewHolder(View itemView, LineAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams();
|
||||
if (layoutParams != null) {
|
||||
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
|
||||
}
|
||||
title = itemView.findViewById(R.id.tv_info_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.zhidao.adas.client.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ViaPositionAdapter extends RecyclerView.Adapter<ViaPositionAdapter.MyViewHolder> {
|
||||
|
||||
private List<AutoPilotMode.Location> datas;
|
||||
private Context mContext;
|
||||
|
||||
public void setDatas(List<AutoPilotMode.Location> datas) {
|
||||
this.datas = datas;
|
||||
if (!this.datas.isEmpty()) {
|
||||
for (int i = 0; i < this.datas.size(); i++) {
|
||||
this.datas.get(i).name = "点" + (i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<AutoPilotMode.Location> getDatas() {
|
||||
return datas;
|
||||
}
|
||||
|
||||
public void addHint() {
|
||||
datas.add(new AutoPilotMode.Location("点" + (datas.size() + 1)));
|
||||
notifyItemInserted(datas.size() - 1);
|
||||
}
|
||||
|
||||
public void minus() {
|
||||
datas.remove(datas.size() - 1);
|
||||
notifyItemRemoved(datas.size() - 1);
|
||||
notifyItemRangeChanged(datas.size() - 1, getItemCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
//创建ViewHolder
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//实例化得到Item布局文件的View对象
|
||||
mContext = parent.getContext();
|
||||
View v = LayoutInflater.from(mContext).inflate(R.layout.item_via, parent, false);
|
||||
//返回MyViewHolder的对象
|
||||
return new MyViewHolder(v);
|
||||
}
|
||||
|
||||
//绑定数据
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
AutoPilotMode.Location location = datas.get(position);
|
||||
holder.title.setText(location.name);
|
||||
if (location.longitude != 0.0)
|
||||
holder.lon.setText(String.valueOf(location.longitude));
|
||||
if (location.latitude != 0.0)
|
||||
holder.lat.setText(String.valueOf(location.latitude));
|
||||
// holder.input.setFocusable(true);
|
||||
// holder.input.setFocusableInTouchMode(true);
|
||||
// holder.input.requestFocus();
|
||||
|
||||
}
|
||||
|
||||
//返回Item的数量
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas == null ? 0 : datas.size();
|
||||
}
|
||||
|
||||
|
||||
//继承RecyclerView.ViewHolder抽象类的自定义ViewHolder
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView title;
|
||||
EditText lon;
|
||||
EditText lat;
|
||||
|
||||
MyViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
title = itemView.findViewById(R.id.title);
|
||||
lon = itemView.findViewById(R.id.lon);
|
||||
lat = itemView.findViewById(R.id.lat);
|
||||
lon.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
datas.get(getBindingAdapterPosition()).longitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
lon.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
datas.get(getBindingAdapterPosition()).longitude = 0.0;
|
||||
}
|
||||
}
|
||||
});
|
||||
lat.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!TextUtils.isEmpty(s)) {
|
||||
try {
|
||||
datas.get(getBindingAdapterPosition()).latitude = Double.parseDouble(s.toString().trim());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
lat.setText("");
|
||||
Toast.makeText(mContext, "输入不合法", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
datas.get(getBindingAdapterPosition()).latitude = 0.0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zhidao.adas.client.base;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
private BaseHandler mBaseHandler;
|
||||
/**
|
||||
* 初始化一个Handler,如果需要使用Handler,先调用此方法,
|
||||
* 然后可以使用postRunnable(Runnable runnable),
|
||||
* sendMessage在handleMessage(Message msg)中接收msg
|
||||
*/
|
||||
public void initHandler() {
|
||||
mBaseHandler = new BaseHandler(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回Handler,在此之前确定已经调用initHandler()
|
||||
*
|
||||
* @return Handler
|
||||
*/
|
||||
public Handler getHandler() {
|
||||
return mBaseHandler;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同Handler 的 handleMessage,
|
||||
* getHandler.sendMessage,发送的Message在此接收
|
||||
* 在此之前确定已经调用initHandler()
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
protected void handleMessage(Message msg) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 同Handler的postRunnable
|
||||
* 在此之前确定已经调用initHandler()
|
||||
*/
|
||||
protected void postRunnable(Runnable runnable) {
|
||||
postRunnableDelayed(runnable, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同Handler的postRunnableDelayed
|
||||
* 在此之前确定已经调用initHandler()
|
||||
*/
|
||||
protected void postRunnableDelayed(Runnable runnable, long delayMillis) {
|
||||
if (mBaseHandler == null) initHandler();
|
||||
mBaseHandler.postDelayed(runnable, delayMillis);
|
||||
}
|
||||
|
||||
|
||||
protected static class BaseHandler extends Handler {
|
||||
private final WeakReference<BaseActivity> mObjects;
|
||||
|
||||
public BaseHandler(BaseActivity mPresenter) {
|
||||
mObjects = new WeakReference<BaseActivity>(mPresenter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
BaseActivity mPresenter = mObjects.get();
|
||||
if (mPresenter != null)
|
||||
mPresenter.handleMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class AutoPilotMode {
|
||||
public String name;
|
||||
public String startName;
|
||||
public Location startLatLon;
|
||||
public String endName;
|
||||
public Location endLatLon;
|
||||
public double speedLimit;
|
||||
public List<Location> wayLatLons;
|
||||
|
||||
public List<MessagePad.Location> getWayLatLons() {
|
||||
if (wayLatLons == null || wayLatLons.isEmpty()) return null;
|
||||
List<MessagePad.Location> list = new ArrayList<>();
|
||||
for (int i = 0; i < wayLatLons.size(); i++) {
|
||||
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
|
||||
builder.setLatitude(wayLatLons.get(i).latitude).setLongitude(wayLatLons.get(i).longitude);
|
||||
list.add(builder.build());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static class Location {
|
||||
public String name;
|
||||
public double longitude;
|
||||
public double latitude;
|
||||
|
||||
public Location() {
|
||||
}
|
||||
|
||||
public Location(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isNull() {
|
||||
return longitude == 0.0 || latitude == 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNull() {
|
||||
if (wayLatLons != null && !wayLatLons.isEmpty()) {
|
||||
for (int i = 0; i < wayLatLons.size(); i++) {
|
||||
if (wayLatLons.get(i).isNull()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TextUtils.isEmpty(name) || TextUtils.isEmpty(startName) || TextUtils.isEmpty(endName) ||
|
||||
startLatLon == null || startLatLon.isNull() || endLatLon == null || endLatLon.isNull() ||
|
||||
speedLimit == 0.0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
public class UpdateDataEvent {
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.LineAdapter;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.bean.UpdateDataEvent;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
|
||||
public class AutoPilotModeDialog extends Dialog {
|
||||
private RecyclerView recyclerView;
|
||||
private LineAdapter adapter;
|
||||
private List<AutoPilotMode> list;
|
||||
|
||||
public AutoPilotModeDialog(@NonNull Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_autopilot_mode);
|
||||
//初始化界面控件
|
||||
initView();
|
||||
list = Constants.getPaths(getContext());
|
||||
initBtnRecyclerView();
|
||||
//初始化界面控件的事件
|
||||
initListener();
|
||||
setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
EventBus.getDefault().unregister(AutoPilotModeDialog.this);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
EventBus.getDefault().register(AutoPilotModeDialog.this);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUpdateDataEvent(UpdateDataEvent event) {
|
||||
list = Constants.getPaths(getContext());
|
||||
if (adapter != null) {
|
||||
adapter.setData(list);
|
||||
}
|
||||
}
|
||||
|
||||
private void initBtnRecyclerView() {
|
||||
//初始info-recycle
|
||||
LinearLayoutManager nodLinearLayoutManage = new LinearLayoutManager(getContext());
|
||||
nodLinearLayoutManage.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
recyclerView.setLayoutManager(nodLinearLayoutManage);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
recyclerView.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animatorInfo = (SimpleItemAnimator) recyclerView.getItemAnimator();
|
||||
if (animatorInfo != null)
|
||||
animatorInfo.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
adapter = new LineAdapter(list);
|
||||
recyclerView.setAdapter(adapter);
|
||||
adapter.setOnItemClickListener(new BaseAdapter.OnItemClickListener<AutoPilotMode>() {
|
||||
@Override
|
||||
public void onItemClick(int position, AutoPilotMode data) {
|
||||
MessagePad.Location startLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(data.startLatLon.latitude)
|
||||
.setLongitude(data.startLatLon.longitude)
|
||||
.build();
|
||||
MessagePad.Location endLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(data.endLatLon.latitude)
|
||||
.setLongitude(data.endLatLon.longitude)
|
||||
.build();
|
||||
MessagePad.RouteInfo.Builder builder = MessagePad.RouteInfo.newBuilder();
|
||||
builder.setStartLocation(startLocation);
|
||||
builder.setStartName(data.startName);
|
||||
builder.setEndLocation(endLocation);
|
||||
builder.setEndName(data.endName);
|
||||
List<MessagePad.Location> list = data.getWayLatLons();
|
||||
if (list != null)
|
||||
builder.addAllWayPoints(list);
|
||||
builder.setSpeedLimit(data.speedLimit);
|
||||
builder.setVehicleType(9);
|
||||
builder.setIsSpeakVoice(true);
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, builder.build());
|
||||
AutoPilotModeDialog.this.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面的确定和取消监听器
|
||||
*/
|
||||
private void initListener() {
|
||||
findViewById(R.id.settings).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getContext().startActivity(new Intent(getContext(), AutopilotConfigActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化界面控件
|
||||
*/
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.AutopilotConfigAdapter;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
import com.zhidao.adas.client.bean.UpdateDataEvent;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AutopilotConfigActivity extends BaseActivity {
|
||||
private static final String TAG = "CreateActivity";
|
||||
private TextView toolbar_title;
|
||||
private RecyclerView recyclerView;
|
||||
private AutopilotConfigAdapter autopilotConfigAdapter;
|
||||
private GridLayoutManager linearLayoutManager;
|
||||
|
||||
private static final int WHAT_START = 0;
|
||||
TextView no_date;
|
||||
private TextView lonText;
|
||||
private TextView latText;
|
||||
private double lon = -1;
|
||||
private double lat = -1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_autopilot_cloud_config);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
no_date = findViewById(R.id.no_date);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setTitle("");
|
||||
toolbar_title = findViewById(R.id.toolbar_title);
|
||||
toolbar_title.setText("创建线路");
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);//左侧添加一个默认的返回图标
|
||||
getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用
|
||||
initHandler();
|
||||
EventBus.getDefault().register(this);
|
||||
initRecyclerView();
|
||||
toolbar_title.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "恭喜解锁隐藏技能", Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (autopilotConfigAdapter.getItemCount() == 0) {
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
no_date.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
no_date.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initRecyclerView() {
|
||||
linearLayoutManager = new GridLayoutManager(this, 2);
|
||||
linearLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
//添加Android自带的分割线
|
||||
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
|
||||
recyclerView.addItemDecoration(new HorizontalDividerItemDecoration(this));
|
||||
autopilotConfigAdapter = new AutopilotConfigAdapter(Constants.getPaths(this));
|
||||
recyclerView.setAdapter(autopilotConfigAdapter);
|
||||
autopilotConfigAdapter.setOnItemClickListener(new AutopilotConfigAdapter.OnHaveDataListener() {
|
||||
@Override
|
||||
public void onHaveData(boolean isHave) {
|
||||
if (isHave) {
|
||||
no_date.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
no_date.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void onSave() {
|
||||
List<AutoPilotMode> list = autopilotConfigAdapter.getDatas();
|
||||
if (list == null || list.isEmpty()) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "未找到可用数据,无法保存", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
Toast.makeText(AutopilotConfigActivity.this, "正在保存...", Toast.LENGTH_SHORT).show();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean isNull = false;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).isNull()) {
|
||||
isNull = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isNull) {
|
||||
Constants.setPath(AutopilotConfigActivity.this, list);
|
||||
}
|
||||
Message msg = Message.obtain();
|
||||
msg.what = WHAT_START;
|
||||
msg.obj = !isNull;
|
||||
|
||||
getHandler().sendMessage(msg);
|
||||
}
|
||||
};
|
||||
ThreadPoolManager.getsInstance().execute(runnable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().post(new UpdateDataEvent());
|
||||
if (getHandler() != null)
|
||||
getHandler().removeCallbacksAndMessages(null);
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
switch (msg.what) {
|
||||
case WHAT_START:
|
||||
if ((Boolean) msg.obj) {
|
||||
builder.setTitle("保存成功")
|
||||
.setMessage("配置保存成功啦")
|
||||
.setNegativeButton("退出",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.setPositiveButton("确定",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
builder.setTitle("保存失败")
|
||||
.setMessage("请输入必填项\n所有输入框均必填\uD83E\uDD2A")
|
||||
.setPositiveButton("确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
AlertDialog dialog = builder.show();
|
||||
// dialog.setCancelable(false);
|
||||
// dialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_create, menu);
|
||||
MenuItem itemDel = menu.findItem(R.id.action_del_item);
|
||||
CheckBox del = itemDel.getActionView().findViewById(R.id.action_del);
|
||||
del.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (autopilotConfigAdapter != null) {
|
||||
autopilotConfigAdapter.setShowDel(isChecked);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem itemLocation = menu.findItem(R.id.action_location_item);
|
||||
Button btn_lon = itemLocation.getActionView().findViewById(R.id.btn_lon);
|
||||
Button btn_lat = itemLocation.getActionView().findViewById(R.id.btn_lat);
|
||||
lonText = itemLocation.getActionView().findViewById(R.id.lon);
|
||||
latText = itemLocation.getActionView().findViewById(R.id.lat);
|
||||
btn_lon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (lon != -1) {
|
||||
findEditText(lon);
|
||||
}
|
||||
}
|
||||
});
|
||||
btn_lat.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (lat != -1) {
|
||||
findEditText(lat);
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private void findEditText(double value) {
|
||||
View view = getWindow().getDecorView().findFocus();
|
||||
if (view instanceof EditText) {
|
||||
EditText editText = ((EditText) view);
|
||||
String content = String.valueOf(value);
|
||||
editText.setText(content);
|
||||
editText.setSelection(content.length());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLocationEvent(GnssInfo info) {
|
||||
if (info != null && info.bean != null) {
|
||||
lon = info.bean.getLongitude();
|
||||
lat = info.bean.getLatitude();
|
||||
if (lonText != null)
|
||||
lonText.setText("Lon:" + lon);
|
||||
if (latText != null)
|
||||
latText.setText("Lat:" + lat);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
switch (id) {
|
||||
case R.id.action_settings_item:
|
||||
autopilotConfigAdapter.add();
|
||||
// linearLayoutManager.scrollToPositionWithOffset(dbAdapter.getItemCount() - 1, 0);
|
||||
recyclerView.scrollToPosition(autopilotConfigAdapter.getItemCount() - 1);
|
||||
return true;
|
||||
case R.id.action_save_item:
|
||||
onSave();
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
onBack();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void onBack() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("退出提示")
|
||||
.setMessage("是否配置页面")
|
||||
.setNegativeButton("取消",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
})
|
||||
.setPositiveButton("确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
//返回键处理
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
onBack();
|
||||
return true;
|
||||
} else {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* DividerItemDecoration is a {@link RecyclerView.ItemDecoration} that can be used as a divider
|
||||
* between items of a {@link LinearLayoutManager}. It supports both {@link #HORIZONTAL} and
|
||||
* {@link #VERTICAL} orientations.
|
||||
*
|
||||
* <pre>
|
||||
* mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
|
||||
* mLayoutManager.getOrientation());
|
||||
* recyclerView.addItemDecoration(mDividerItemDecoration);
|
||||
* </pre>
|
||||
*/
|
||||
public class HorizontalDividerItemDecoration extends RecyclerView.ItemDecoration {
|
||||
public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
|
||||
public static final int VERTICAL = LinearLayout.VERTICAL;
|
||||
|
||||
private static final String TAG = "DividerItem";
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
|
||||
private Drawable mDivider;
|
||||
|
||||
|
||||
private final Rect mBounds = new Rect();
|
||||
|
||||
/**
|
||||
* Creates a divider {@link RecyclerView.ItemDecoration} that can be used with a
|
||||
* {@link LinearLayoutManager}.
|
||||
*
|
||||
* @param context Current context, it will be used to access resources.
|
||||
*/
|
||||
public HorizontalDividerItemDecoration(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
mDivider = a.getDrawable(0);
|
||||
if (mDivider == null) {
|
||||
Log.w(TAG, "@android:attr/listDivider was not set in the theme used for this "
|
||||
+ "DividerItemDecoration. Please set that attribute all call setDrawable()");
|
||||
}
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the {@link Drawable} for this divider.
|
||||
*
|
||||
* @param drawable Drawable that should be used as a divider.
|
||||
*/
|
||||
public void setDrawable(@NonNull Drawable drawable) {
|
||||
if (drawable == null) {
|
||||
throw new IllegalArgumentException("Drawable cannot be null.");
|
||||
}
|
||||
mDivider = drawable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link Drawable} for this divider.
|
||||
*/
|
||||
@Nullable
|
||||
public Drawable getDrawable() {
|
||||
return mDivider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
if (parent.getLayoutManager() == null || mDivider == null) {
|
||||
return;
|
||||
}
|
||||
drawHorizontal(c, parent);
|
||||
}
|
||||
|
||||
|
||||
private void drawHorizontal(Canvas canvas, RecyclerView parent) {
|
||||
canvas.save();
|
||||
final int top;
|
||||
final int bottom;
|
||||
//noinspection AndroidLintNewApi - NewApi lint fails to handle overrides.
|
||||
if (parent.getClipToPadding()) {
|
||||
top = parent.getPaddingTop();
|
||||
bottom = parent.getHeight() - parent.getPaddingBottom();
|
||||
canvas.clipRect(parent.getPaddingLeft(), top,
|
||||
parent.getWidth() - parent.getPaddingRight(), bottom);
|
||||
} else {
|
||||
top = 0;
|
||||
bottom = parent.getHeight();
|
||||
}
|
||||
|
||||
final int childCount = parent.getChildCount();
|
||||
for (int i = 0; i < childCount; ) {
|
||||
final View child = parent.getChildAt(i);
|
||||
parent.getLayoutManager().getDecoratedBoundsWithMargins(child, mBounds);
|
||||
final int right = mBounds.right + Math.round(child.getTranslationX());
|
||||
final int left = right - mDivider.getIntrinsicWidth();
|
||||
mDivider.setBounds(left, top, right, bottom);
|
||||
mDivider.draw(canvas);
|
||||
i += 2;
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||
RecyclerView.State state) {
|
||||
if (mDivider == null) {
|
||||
outRect.set(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.DataShowAdapter;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.ErrorData;
|
||||
@@ -27,7 +28,6 @@ import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.utils.MyLinearLayoutManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.msg.ReportMessage;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import static com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
@@ -20,6 +22,7 @@ import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@@ -37,8 +40,11 @@ import com.mogo.telematic.client.status.ConnectState;
|
||||
import com.mogo.telematic.server.netty.NettyServerListener;
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.InfoTitleAdapter;
|
||||
import com.zhidao.adas.client.base.BaseActivity;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
@@ -66,19 +72,14 @@ import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.recorder.RecordDataManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
@@ -87,7 +88,7 @@ import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
|
||||
public class MainActivity extends BaseActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
|
||||
private final static String TAG = MainActivity.class.getSimpleName();
|
||||
private EditText etIp;
|
||||
private TextView role;
|
||||
@@ -106,7 +107,6 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
private RecyclerView infoFragment;
|
||||
private TextView tvConnectState;
|
||||
private ScheduledExecutorService mExecutorServiceConfigTimer;
|
||||
private Gson gson;
|
||||
|
||||
|
||||
private final List<String> titleFragmentData = new ArrayList<>();
|
||||
@@ -135,7 +135,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
private long recordKey;
|
||||
private String recordFileName;
|
||||
private int connectStatus;
|
||||
|
||||
private AutoPilotModeDialog autoPilotModeDialog;
|
||||
|
||||
public interface TITLE {
|
||||
String RECEIVE_TRAJECTORY = "车前引导线";
|
||||
@@ -175,7 +175,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
initView();
|
||||
firstFragment();
|
||||
gson = new Gson();
|
||||
|
||||
initAdas();
|
||||
connectStatus = AdasManager.getInstance().getIpcConnectionStatus();
|
||||
onUpdateConnectStateView();
|
||||
@@ -341,15 +341,15 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
titleFragmentData.add(TITLE.RECEIVE_ERROR);
|
||||
|
||||
|
||||
titleBtnData.add("下发站点1");
|
||||
titleBtnData.add("下发站点2");
|
||||
titleBtnData.add("启动自动驾驶");
|
||||
titleBtnData.add("自动驾驶路径查询");
|
||||
titleBtnData.add("下发SN");
|
||||
titleBtnData.add("数据采集5秒");
|
||||
titleBtnData.add("数据采集start");
|
||||
titleBtnData.add("数据采集end");
|
||||
titleBtnData.add("录音测试");
|
||||
titleBtnData.add("发送信号灯");
|
||||
titleBtnData.add("速度设置");
|
||||
titleBtnData.add("自动驾驶限速");
|
||||
titleBtnData.add("重启Docker");
|
||||
titleBtnData.add("重启IPC");
|
||||
titleBtnData.add("关机");
|
||||
@@ -871,82 +871,51 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("IPC 未连接");
|
||||
return;
|
||||
}
|
||||
switch (data) {
|
||||
case "下发站点1":
|
||||
MessagePad.Location startLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.820319143036112)
|
||||
.setLongitude(112.57770688564666)
|
||||
.build();
|
||||
MessagePad.Location endLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.82355278566775)
|
||||
.setLongitude(112.57001723522112)
|
||||
.build();
|
||||
MessagePad.RouteInfo info = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation)
|
||||
.setStartName("KXCNMZ")
|
||||
.setEndLocation(endLocation)
|
||||
.setEndName("SDYJKXCXMBZ")
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info);
|
||||
//"{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
// " {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
// if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
// toastMsg("IPC 未连接");
|
||||
// return;
|
||||
// }
|
||||
switch (position) {
|
||||
case 0:
|
||||
if (autoPilotModeDialog == null) {
|
||||
autoPilotModeDialog = new AutoPilotModeDialog(this);
|
||||
}
|
||||
if (!autoPilotModeDialog.isShowing()) {
|
||||
autoPilotModeDialog.show();
|
||||
}
|
||||
|
||||
break;
|
||||
case "下发站点2":
|
||||
MessagePad.Location startLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.823347858814472)
|
||||
.setLongitude(112.56994205894226)
|
||||
.build();
|
||||
MessagePad.Location endLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.819811964643154)
|
||||
.setLongitude(112.57732459897345)
|
||||
.build();
|
||||
MessagePad.RouteInfo info2 = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation2)
|
||||
.setStartName("SDYJKXCXMBDM")
|
||||
.setEndLocation(endLocation2)
|
||||
.setEndName("KXCNMDM")
|
||||
// .addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info2);
|
||||
// "{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
//" {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
break;
|
||||
case "自动驾驶路径查询":
|
||||
case 1:
|
||||
//自动驾驶路径查询
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
break;
|
||||
case "下发SN":
|
||||
case 2:
|
||||
//发送sn
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
break;
|
||||
case "数据采集5秒":
|
||||
case 3:
|
||||
//数据采集5秒
|
||||
boolean b = AdasManager.getInstance().startRecordPackage(1, 5, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + b);
|
||||
break;
|
||||
case "数据采集start":
|
||||
case 4:
|
||||
//数据采集start
|
||||
boolean bStart = AdasManager.getInstance().startRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bStart);
|
||||
break;
|
||||
case "数据采集end":
|
||||
case 5:
|
||||
//数据采集end
|
||||
boolean bEnd = AdasManager.getInstance().stopRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bEnd);
|
||||
break;
|
||||
case "录音测试":
|
||||
case 6:
|
||||
//录音测试
|
||||
CupidLogUtils.w(TAG, "录音测试");
|
||||
RecordDataManager.getInstance().init(MainActivity.this, "1234567", "", 22, "", "");
|
||||
RecordDataManager.getInstance().record();
|
||||
break;
|
||||
case "发送信号灯":
|
||||
case 7:
|
||||
//发送信号灯
|
||||
MessagePad.TrafficLightStatus left = MessagePad.TrafficLightStatus.newBuilder()
|
||||
.setPhaseNo("1")
|
||||
.setColor("R")
|
||||
@@ -969,25 +938,55 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
.build();
|
||||
AdasManager.getInstance().sendTrafficLightData("10038", 26.848153, 112.574883, "180.0", "SN", 100413, -4, 201, 0, detail);
|
||||
break;
|
||||
case "速度设置":
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(28);
|
||||
case 8:
|
||||
//速度设置
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("自动驾驶限速");
|
||||
View view = getLayoutInflater().inflate(R.layout.dialog_speed, null);
|
||||
final EditText et = (EditText) view.findViewById(R.id.et);
|
||||
builder.setView(view);//
|
||||
builder.setCancelable(false);//
|
||||
builder.setPositiveButton("设置", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Editable editable = et.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
// 条件不成立不能关闭 AlertDialog 窗口
|
||||
Toast.makeText(MainActivity.this, "请输入速度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String temp = et.getText().toString().trim();
|
||||
double speed = Double.parseDouble(temp) / 3.6;
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(speed);
|
||||
}
|
||||
});
|
||||
//设置反面按钮,并做事件处理
|
||||
builder.setNegativeButton("取消", null);
|
||||
builder.show();//显示Dialog对话框
|
||||
|
||||
break;
|
||||
case "重启Docker":
|
||||
case 9:
|
||||
//重启Docker
|
||||
AdasManager.getInstance().rebootAPDocker();
|
||||
break;
|
||||
case "重启IPC":
|
||||
case 10:
|
||||
//重启IPC
|
||||
AdasManager.getInstance().rebootIPC();
|
||||
break;
|
||||
case "关机":
|
||||
case 11:
|
||||
//关机
|
||||
AdasManager.getInstance().shutdownIPC();
|
||||
break;
|
||||
case "采集类型":
|
||||
case 12:
|
||||
//采集类型
|
||||
AdasManager.getInstance().sendRecordCause(recordKey, recordFileName, "1", "变道有干扰");
|
||||
break;
|
||||
case "打开演示模式":
|
||||
case 13:
|
||||
//打开演示模式
|
||||
AdasManager.getInstance().sendDemoModeReq(1);
|
||||
break;
|
||||
case "关闭演示模式":
|
||||
case 14:
|
||||
//关闭演示模式
|
||||
AdasManager.getInstance().sendDemoModeReq(0);
|
||||
break;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
package com.zhidao.adas.client.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -21,6 +21,7 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.adapter.ConfigAdapter;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.Config;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AiCloudToStartAutopilot {
|
||||
|
||||
private String action = "aiCloudToStartAutopilot";
|
||||
public ResultDTO result;
|
||||
|
||||
public static class ResultDTO {
|
||||
public EndLatLonDTO endLatLon;
|
||||
public Integer speedLimit = 20;
|
||||
public StartLatLonDTO startLatLon;
|
||||
public List<WayLatLonsDTO> wayLatLons;
|
||||
|
||||
public static class EndLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class StartLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class WayLatLonsDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.PreferencesUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AutopilotConfigActivity extends AppCompatActivity {
|
||||
|
||||
public static void launch(Context context) {
|
||||
Intent intent = new Intent(context,AutopilotConfigActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private EditText start_lon1;
|
||||
private EditText start_lat1;
|
||||
private EditText stop_lon1;
|
||||
private EditText stop_lat1;
|
||||
private EditText t_lon1;
|
||||
private EditText t_lat1;
|
||||
|
||||
private EditText start_lon2;
|
||||
private EditText start_lat2;
|
||||
private EditText stop_lon2;
|
||||
private EditText stop_lat2;
|
||||
private EditText t_lon2;
|
||||
private EditText t_lat2;
|
||||
|
||||
private EditText start_lon3;
|
||||
private EditText start_lat3;
|
||||
private EditText stop_lon3;
|
||||
private EditText stop_lat3;
|
||||
private EditText t_lon3;
|
||||
private EditText t_lat3;
|
||||
|
||||
private EditText start_lon4;
|
||||
private EditText start_lat4;
|
||||
private EditText stop_lon4;
|
||||
private EditText stop_lat4;
|
||||
private EditText t_lon4;
|
||||
private EditText t_lat4;
|
||||
private List<AiCloudToStartAutopilot> list;
|
||||
|
||||
AiCloudToStartAutopilot data1;
|
||||
AiCloudToStartAutopilot data2;
|
||||
AiCloudToStartAutopilot data3;
|
||||
AiCloudToStartAutopilot data4;
|
||||
private String init_all_path = "[\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 26.82355278566775,\n" +
|
||||
" \"lon\": 112.57001723522112\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 26.820319143036112,\n" +
|
||||
" \"lon\": 112.57770688564666\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_autopilot_cloud_config);
|
||||
start_lon1 = findViewById(R.id.start_lon1);
|
||||
start_lat1 = findViewById(R.id.start_lat1);
|
||||
stop_lon1 = findViewById(R.id.stop_lon1);
|
||||
stop_lat1 = findViewById(R.id.stop_lat1);
|
||||
t_lon1 = findViewById(R.id.t_lon1);
|
||||
t_lat1 = findViewById(R.id.t_lat1);
|
||||
|
||||
start_lon2 = findViewById(R.id.start_lon2);
|
||||
start_lat2 = findViewById(R.id.start_lat2);
|
||||
stop_lon2 = findViewById(R.id.stop_lon2);
|
||||
stop_lat2 = findViewById(R.id.stop_lat2);
|
||||
t_lon2 = findViewById(R.id.t_lon2);
|
||||
t_lat2 = findViewById(R.id.t_lat2);
|
||||
|
||||
start_lon3 = findViewById(R.id.start_lon3);
|
||||
start_lat3 = findViewById(R.id.start_lat3);
|
||||
stop_lon3 = findViewById(R.id.stop_lon3);
|
||||
stop_lat3 = findViewById(R.id.stop_lat3);
|
||||
t_lon3 = findViewById(R.id.t_lon3);
|
||||
t_lat3 = findViewById(R.id.t_lat3);
|
||||
|
||||
start_lon4 = findViewById(R.id.start_lon4);
|
||||
start_lat4 = findViewById(R.id.start_lat4);
|
||||
stop_lon4 = findViewById(R.id.stop_lon4);
|
||||
stop_lat4 = findViewById(R.id.stop_lat4);
|
||||
t_lon4 = findViewById(R.id.t_lon4);
|
||||
t_lat4 = findViewById(R.id.t_lat4);
|
||||
//开始执行
|
||||
final Button button = findViewById(R.id.start);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String json = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.SEL_PATH, null);
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "请先选择路线", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
json = json.split("##")[1];
|
||||
Log.i("开始执行自动驾驶", json);
|
||||
// AdasManager.getInstance().aiCloudToAdasData(json);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
data1.result.startLatLon.lon = Double.parseDouble(start_lon1.getText().toString().trim());
|
||||
data1.result.startLatLon.lat = Double.parseDouble(start_lat1.getText().toString().trim());
|
||||
data1.result.endLatLon.lon = Double.parseDouble(stop_lon1.getText().toString().trim());
|
||||
data1.result.endLatLon.lat = Double.parseDouble(stop_lat1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat1.getText().toString().trim());
|
||||
|
||||
|
||||
data2.result.startLatLon.lon = Double.parseDouble(start_lon2.getText().toString().trim());
|
||||
data2.result.startLatLon.lat = Double.parseDouble(start_lat2.getText().toString().trim());
|
||||
data2.result.endLatLon.lon = Double.parseDouble(stop_lon2.getText().toString().trim());
|
||||
data2.result.endLatLon.lat = Double.parseDouble(stop_lat2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat2.getText().toString().trim());
|
||||
|
||||
|
||||
data3.result.startLatLon.lon = Double.parseDouble(start_lon3.getText().toString().trim());
|
||||
data3.result.startLatLon.lat = Double.parseDouble(start_lat3.getText().toString().trim());
|
||||
data3.result.endLatLon.lon = Double.parseDouble(stop_lon3.getText().toString().trim());
|
||||
data3.result.endLatLon.lat = Double.parseDouble(stop_lat3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat3.getText().toString().trim());
|
||||
|
||||
|
||||
data4.result.startLatLon.lon = Double.parseDouble(start_lon4.getText().toString().trim());
|
||||
data4.result.startLatLon.lat = Double.parseDouble(start_lat4.getText().toString().trim());
|
||||
data4.result.endLatLon.lon = Double.parseDouble(stop_lon4.getText().toString().trim());
|
||||
data4.result.endLatLon.lat = Double.parseDouble(stop_lat4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat4.getText().toString().trim());
|
||||
|
||||
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.ALL_PATH, gson.toJson(list));
|
||||
}
|
||||
});
|
||||
View path1 = findViewById(R.id.path1);
|
||||
View path2 = findViewById(R.id.path2);
|
||||
View path3 = findViewById(R.id.path3);
|
||||
View path4 = findViewById(R.id.path4);
|
||||
path1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线1", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "1##" + gson.toJson(list.get(0)));
|
||||
button.setText("开始执行自动驾驶(路线1)");
|
||||
}
|
||||
});
|
||||
path2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线2", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "2##" + gson.toJson(list.get(1)));
|
||||
button.setText("开始执行自动驾驶(路线2)");
|
||||
}
|
||||
});
|
||||
path3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线3", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "3##" + gson.toJson(list.get(2)));
|
||||
button.setText("开始执行自动驾驶(路线3)");
|
||||
}
|
||||
});
|
||||
path4.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线4", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "4##" + gson.toJson(list.get(3)));
|
||||
button.setText("开始执行自动驾驶(路线4)");
|
||||
}
|
||||
});
|
||||
|
||||
String allPath = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.ALL_PATH, init_all_path);
|
||||
list = gson.fromJson(allPath, new TypeToken<List<AiCloudToStartAutopilot>>() {
|
||||
}.getType());
|
||||
data1 = list.get(0);
|
||||
data2 = list.get(1);
|
||||
data3 = list.get(2);
|
||||
data4 = list.get(3);
|
||||
start_lon1.setText(String.valueOf(data1.result.startLatLon.lon));
|
||||
start_lat1.setText(String.valueOf(data1.result.startLatLon.lat));
|
||||
stop_lon1.setText(String.valueOf(data1.result.endLatLon.lon));
|
||||
stop_lat1.setText(String.valueOf(data1.result.endLatLon.lat));
|
||||
t_lon1.setText(String.valueOf(data1.result.wayLatLons.get(0).lon));
|
||||
t_lat1.setText(String.valueOf(data1.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon2.setText(String.valueOf(data2.result.startLatLon.lon));
|
||||
start_lat2.setText(String.valueOf(data2.result.startLatLon.lat));
|
||||
stop_lon2.setText(String.valueOf(data2.result.endLatLon.lon));
|
||||
stop_lat2.setText(String.valueOf(data2.result.endLatLon.lat));
|
||||
t_lon2.setText(String.valueOf(data2.result.wayLatLons.get(0).lon));
|
||||
t_lat2.setText(String.valueOf(data2.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon3.setText(String.valueOf(data3.result.startLatLon.lon));
|
||||
start_lat3.setText(String.valueOf(data3.result.startLatLon.lat));
|
||||
stop_lon3.setText(String.valueOf(data3.result.endLatLon.lon));
|
||||
stop_lat3.setText(String.valueOf(data3.result.endLatLon.lat));
|
||||
t_lon3.setText(String.valueOf(data3.result.wayLatLons.get(0).lon));
|
||||
t_lat3.setText(String.valueOf(data3.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon4.setText(String.valueOf(data4.result.startLatLon.lon));
|
||||
start_lat4.setText(String.valueOf(data4.result.startLatLon.lat));
|
||||
stop_lon4.setText(String.valueOf(data4.result.endLatLon.lon));
|
||||
stop_lat4.setText(String.valueOf(data4.result.endLatLon.lat));
|
||||
t_lon4.setText(String.valueOf(data4.result.wayLatLons.get(0).lon));
|
||||
t_lat4.setText(String.valueOf(data4.result.wayLatLons.get(0).lat));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,58 @@ package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.zhidao.adas.client.bean.AutoPilotMode;
|
||||
import com.zhidao.support.adas.high.common.JsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/8
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String ALL_PATH = "all_path";//所有路线
|
||||
public static final String SEL_PATH = "sel_path";//选择的路线
|
||||
private static final String ALL_PATH = "all_path";//所有路线
|
||||
private static final String DEFAULT_PATH = "[{\"endLatLon\":{\"latitude\":40.19774,\"longitude\":116.72704},\"endName\":\"汇源果汁\",\"name\":\"北京市顺义区北小营镇\",\"speedLimit\":20.0,\"startLatLon\":{\"latitude\":40.20047,\"longitude\":116.73512},\"startName\":\"13号路口西\"},{\"endLatLon\":{\"latitude\":40.19996,\"longitude\":116.73584},\"endName\":\"13号路口(主路)\",\"name\":\"北京市顺义区北小营镇\",\"speedLimit\":20.0,\"startLatLon\":{\"latitude\":40.19763,\"longitude\":116.72686},\"startName\":\"汇源果汁\"}]";
|
||||
|
||||
public static List<AutoPilotMode> getPaths(Context context) {
|
||||
String json = PreferencesUtils.getString(context, ALL_PATH, DEFAULT_PATH);
|
||||
List<AutoPilotMode> list = JsonUtil.fromJson(json, new TypeToken<List<AutoPilotMode>>() {
|
||||
}.getType());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean setPath(Context context, List<AutoPilotMode> list) {
|
||||
if (list != null) {
|
||||
return PreferencesUtils.putString(context, ALL_PATH, JsonUtil.toJson(list));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addPath(Context context, List<AutoPilotMode> list, AutoPilotMode mode) {
|
||||
if (list == null)
|
||||
list = new ArrayList<>();
|
||||
if (!list.contains(mode)) {
|
||||
list.add(mode);
|
||||
return PreferencesUtils.putString(context, ALL_PATH, JsonUtil.toJson(list));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean delPath(Context context, List<AutoPilotMode> list, AutoPilotMode mode) {
|
||||
if (list == null) {
|
||||
return PreferencesUtils.delete(context, ALL_PATH);
|
||||
} else {
|
||||
if (list.contains(mode)) {
|
||||
list.remove(mode);
|
||||
return PreferencesUtils.putString(context, ALL_PATH, JsonUtil.toJson(list));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/***********************是否使用固定IP******************/
|
||||
// 0:固定IP 1:指定 2:UDP
|
||||
|
||||
9
app_ipc_monitoring/src/main/res/drawable/bg_dialog.xml
Normal file
9
app_ipc_monitoring/src/main/res/drawable/bg_dialog.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
||||
12
app_ipc_monitoring/src/main/res/drawable/ic_add_false.xml
Normal file
12
app_ipc_monitoring/src/main/res/drawable/ic_add_false.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,32C246.88,32 32,246.88 32,512s214.88,480 480,480 480,-214.88 480,-480C991.2,247.2 776.8,32.8 512,32z"
|
||||
android:fillColor="#98FB98"/>
|
||||
<path
|
||||
android:pathData="M751.49,482.02H536.64V261.6a30.05,30.05 0,1 0,-60.13 0v220.32H267.52a30.5,30.5 0,0 0,-36 29.92c-0.96,15.68 10.88,29.12 26.56,30.08h217.76v214.37a30.05,30.05 0,1 0,60.16 0v-214.37h214.4c15.58,-1.44 29.09,-10.91 30.08,-26.59V512c-0.32,-6.88 -4.48,-29.98 -28.99,-29.98z"
|
||||
android:fillColor="#F5F5F5"/>
|
||||
</vector>
|
||||
12
app_ipc_monitoring/src/main/res/drawable/ic_add_true.xml
Normal file
12
app_ipc_monitoring/src/main/res/drawable/ic_add_true.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,32C246.88,32 32,246.88 32,512s214.88,480 480,480 480,-214.88 480,-480C991.2,247.2 776.8,32.8 512,32z"
|
||||
android:fillColor="#1afa29"/>
|
||||
<path
|
||||
android:pathData="M751.49,482.02H536.64V261.6a30.05,30.05 0,1 0,-60.13 0v220.32H267.52a30.5,30.5 0,0 0,-36 29.92c-0.96,15.68 10.88,29.12 26.56,30.08h217.76v214.37a30.05,30.05 0,1 0,60.16 0v-214.37h214.4c15.58,-1.44 29.09,-10.91 30.08,-26.59V512c-0.32,-6.88 -4.48,-29.98 -28.99,-29.98z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
12
app_ipc_monitoring/src/main/res/drawable/ic_minus_false.xml
Normal file
12
app_ipc_monitoring/src/main/res/drawable/ic_minus_false.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,1024C229.21,1024 0,794.79 0,512S229.21,0 512,0s512,229.21 512,512c-0.85,282.45 -229.55,511.15 -512,512z"
|
||||
android:fillColor="#98FB98"/>
|
||||
<path
|
||||
android:pathData="M778.72,537.6H245.42c-17.75,0 -32.09,-14.34 -32.09,-32.09v-4.27c0,-17.75 14.34,-32.09 32.09,-32.09h533.33c17.78,0 32.09,14.34 32.09,32.09v4.27a32.29,32.29 0,0 1,-32.12 32.09z"
|
||||
android:fillColor="#F5F5F5"/>
|
||||
</vector>
|
||||
12
app_ipc_monitoring/src/main/res/drawable/ic_minus_true.xml
Normal file
12
app_ipc_monitoring/src/main/res/drawable/ic_minus_true.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,1024C229.21,1024 0,794.79 0,512S229.21,0 512,0s512,229.21 512,512c-0.85,282.45 -229.55,511.15 -512,512z"
|
||||
android:fillColor="#1afa29"/>
|
||||
<path
|
||||
android:pathData="M778.72,537.6H245.42c-17.75,0 -32.09,-14.34 -32.09,-32.09v-4.27c0,-17.75 14.34,-32.09 32.09,-32.09h533.33c17.78,0 32.09,14.34 32.09,32.09v4.27a32.29,32.29 0,0 1,-32.12 32.09z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_add_true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/ic_add_false" />
|
||||
</selector>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_minus_true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/ic_minus_false" />
|
||||
</selector>
|
||||
8
app_ipc_monitoring/src/main/res/drawable/text.xml
Normal file
8
app_ipc_monitoring/src/main/res/drawable/text.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#DCDCDC" android:state_focused="true" />
|
||||
<item android:color="#DCDCDC" android:state_pressed="true" />
|
||||
<item android:color="#DCDCDC" android:state_selected="true" />
|
||||
<item android:color="#C0C0C0" android:state_enabled="false" />
|
||||
<item android:color="#ffffff" />
|
||||
</selector>
|
||||
@@ -1,529 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF"
|
||||
android:orientation="vertical">
|
||||
tools:context=".ui.AutopilotConfigActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始执行自动驾驶" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="存储配置" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path1"
|
||||
android:id="@+id/toolbar_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线1"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
android:layout_gravity="center"
|
||||
android:text="标题"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
<include layout="@layout/content_autopilot_cloud_config" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线2"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线3"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线4"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat4"
|
||||
android:layout_width="120dp"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -4,7 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F5F5F5"
|
||||
tools:context=".ui.mian.MainActivity">
|
||||
tools:context=".ui.MainActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/include_title"
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#fff"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="#F5F5F5"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/no_date"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_dialog">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="160dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="160dp"
|
||||
android:gravity="center"
|
||||
android:text="选择自动驾驶线路"
|
||||
android:textColor="#333333"
|
||||
android:textSize="18sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_toEndOf="@+id/title"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="配置"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/title"
|
||||
app:layout_constraintStart_toEndOf="@+id/title"
|
||||
app:layout_constraintTop_toTopOf="@+id/title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_margin="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
30
app_ipc_monitoring/src/main/res/layout/dialog_speed.xml
Normal file
30
app_ipc_monitoring/src/main/res/layout/dialog_speed.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="0123456789."
|
||||
android:gravity="center"
|
||||
android:hint="速度"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="10"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="km/h"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
225
app_ipc_monitoring/src/main/res/layout/item_autopilot_config.xml
Normal file
225
app_ipc_monitoring/src/main/res/layout/item_autopilot_config.xml
Normal file
@@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint_speed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/speed"
|
||||
android:text="最大限速:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/path_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/hint_speed"
|
||||
android:hint="路线名称"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_name"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="开始点名称"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/end_name"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="结束点名称"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/end_lon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/end_lat"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="35dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:paddingBottom="35dp"
|
||||
android:text="删\n除"
|
||||
android:textColor="@drawable/text" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint_via"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="2dp"
|
||||
android:text="途经:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minus"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/selector_minus" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:text="0"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@drawable/selector_add" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/RecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/layout_btn"
|
||||
android:layout_toEndOf="@id/hint_via" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
66
app_ipc_monitoring/src/main/res/layout/item_via.xml
Normal file
66
app_ipc_monitoring/src/main/res/layout/item_via.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="点1"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/lon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/lat"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
8
app_ipc_monitoring/src/main/res/layout/layout_del.xml
Normal file
8
app_ipc_monitoring/src/main/res/layout/layout_del.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/action_del"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_del"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
64
app_ipc_monitoring/src/main/res/layout/layout_location.xml
Normal file
64
app_ipc_monitoring/src/main/res/layout/layout_location.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_lon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="选择"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:maxLines="1"
|
||||
android:text="Lon:"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_lat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="选择"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:maxLines="1"
|
||||
android:text="Lat:"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
28
app_ipc_monitoring/src/main/res/menu/menu_create.xml
Normal file
28
app_ipc_monitoring/src/main/res/menu/menu_create.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="xyz.anndou.bank.MainActivity">
|
||||
<item
|
||||
android:id="@+id/action_location_item"
|
||||
android:title="@string/action_del"
|
||||
app:actionLayout="@layout/layout_location"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_del_item"
|
||||
android:title="@string/action_del"
|
||||
app:actionLayout="@layout/layout_del"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings_item"
|
||||
android:icon="@android:drawable/ic_menu_add"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_save_item"
|
||||
android:icon="@android:drawable/ic_menu_save"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_save"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
@@ -1,3 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">工控机监控</string>
|
||||
<string name="action_settings">添加</string>
|
||||
<string name="action_save">保存</string>
|
||||
<string name="action_del">删除</string>
|
||||
<string name="no_date">没有数据\n请点击右上角\"⊕\"添加</string>
|
||||
</resources>
|
||||
|
||||
@@ -16,5 +16,16 @@
|
||||
<item name="android:windowEnableSplitTouch">false</item>
|
||||
<item name="android:splitMotionEvents">false</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomDialog" parent="Theme.MaterialComponents.Light.Dialog">
|
||||
<!--背景颜色及和透明程度-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--是否去除标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--是否去除边框-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否模糊-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface OnAdasConnectStatusListener {
|
||||
* 与工控机链接状态变化
|
||||
*
|
||||
* @param ipcConnectionStatus {@link Constants.IPC_CONNECTION_STATUS}
|
||||
* @param failedMsg 连接异常信息
|
||||
* @param failedMsg 连接异常信息 需要判null
|
||||
*/
|
||||
void onConnectionIPCStatus(@Define.IPCConnectionStatus int ipcConnectionStatus, String failedMsg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user