Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu
# Conflicts: # .idea/misc.xml # core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java # core/function-impl/mogo-core-function-obu-mogo/src/main/java/com/mogo/eagle/core/function/obu/mogo/MogoPrivateObuManager.kt
This commit is contained in:
@@ -1,19 +1,40 @@
|
||||
package com.mogo.eagle.core.function.check;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.elegant.network.ParamsBuilder;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.eagle.core.function.check.view.CheckDialog;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils;
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener;
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider;
|
||||
import com.mogo.utils.ActivityLifecycleManager;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
* 鹰眼系统、自动驾驶系统 检测模块
|
||||
@@ -27,6 +48,8 @@ public class VehicleMonitoringManager implements ICheckProvider {
|
||||
private static final String TAG = "VehicleMonitoringManager";
|
||||
private Context mContext;
|
||||
private final Map<String, CopyOnWriteArrayList> mListeners = new ConcurrentHashMap<>();
|
||||
private boolean hasTipShow = false;//是否已经弹框提示
|
||||
CheckDialog dialog;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -56,33 +79,78 @@ public class VehicleMonitoringManager implements ICheckProvider {
|
||||
|
||||
@Override
|
||||
public void startCheckActivity(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.start(context);
|
||||
}
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(starter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showCheckDialog(Context context) {
|
||||
if (context != null) {
|
||||
CheckActivity.showDialog(context);
|
||||
}
|
||||
showDialog(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMonitor(Context context) {
|
||||
public void checkMonitor(Context context) {
|
||||
if (context != null) {
|
||||
return CheckActivity.checkMonitor(context);
|
||||
CheckActivity.checkMonitor(context, new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithErrorState(Integer state) {
|
||||
updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, state);
|
||||
if (state == 1) {
|
||||
hasTipShow = false;
|
||||
} else {
|
||||
if (hasTipShow == false) {
|
||||
showDialog(context);
|
||||
hasTipShow = true;//已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
public void showDialog(Context context) {
|
||||
try {
|
||||
if (ActivityLifecycleManager.getInstance().isAppActive() == true &&
|
||||
AppUtils.isAppRunning(getPackageName(context)) &&
|
||||
ActivityUtils.getTopActivity() instanceof CheckActivity == false) {
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return 当前应用的版本名称
|
||||
*/
|
||||
public static synchronized String getPackageName(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
return packageInfo.packageName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "com.mogo.launcher.f";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMonitoringStatus(String module, boolean hasError) {
|
||||
public void updateMonitoringStatus(String module, Integer state) {
|
||||
List<IMogoCheckListener> listeners = mListeners.get(module);
|
||||
if (listeners != null && !listeners.isEmpty()) {
|
||||
for (IMogoCheckListener listener : listeners) {
|
||||
if (listener != null) {
|
||||
listener.updateMonitoringStatus(hasError);
|
||||
listener.updateMonitoringStatus(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 8/6/21
|
||||
*/
|
||||
public interface ICheckListener {
|
||||
|
||||
/**
|
||||
* 工控机->鹰眼定位数据延时
|
||||
*/
|
||||
void getAutoLocationTimeCallbackDelayed(long time);
|
||||
|
||||
/**
|
||||
* 工控机->鹰眼识别数据延时
|
||||
*/
|
||||
void getAutoDataCallbackDelayed(long time);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
import com.mogo.service.adas.IMogoAdasDataCallback;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 自车检测结果回调
|
||||
* @since: 9/28/21
|
||||
*/
|
||||
public interface ICheckResultCallBack {
|
||||
void callBackWithErrorState(Integer state);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.eagle.core.function.check.api;
|
||||
|
||||
/**
|
||||
* @author xiaoyuzhou
|
||||
* @date 2021/7/5 2:54 下午
|
||||
* <p>
|
||||
* 软件环境检测
|
||||
* -----> 自动驾驶版本
|
||||
* -----> 鹰眼版本
|
||||
*/
|
||||
public interface SoftCheckApi {
|
||||
|
||||
/**
|
||||
* 检测「自动驾驶」版本
|
||||
*/
|
||||
void checkAutoPilotSoftVersion();
|
||||
|
||||
/**
|
||||
* 检测「鹰眼」版本
|
||||
*/
|
||||
void checkEagleEyeSoftVersion();
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.check.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class CheckResultData extends BaseData {
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Data {
|
||||
public static class Data implements Serializable{
|
||||
private Vehicle vehicle;
|
||||
private List<CheckListItem> soft;
|
||||
private List<CheckListItem> devices;
|
||||
@@ -97,7 +98,7 @@ public class CheckResultData extends BaseData {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vehicle {
|
||||
public static class Vehicle implements Serializable {
|
||||
private String id;
|
||||
private String sn;
|
||||
private String vin;
|
||||
@@ -236,7 +237,7 @@ public class CheckResultData extends BaseData {
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckListItem {
|
||||
public static class CheckListItem implements Serializable{
|
||||
private String name;
|
||||
private String stateValue;
|
||||
private List<CheckResultData.CheckListItem> items;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
@@ -52,10 +53,9 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private static final String TAG = "CheckActivity";
|
||||
private static RecyclerView mRecyclerView;
|
||||
private static CheckResultData sCheckResultData;
|
||||
private static Context context;
|
||||
private static Context mContext;
|
||||
private static NetworkStatusUtil.NetWorkStatus sNetWorkStatus;
|
||||
private ImageView mImageView;
|
||||
private static String packageName = "com.mogo.launcher.f";
|
||||
//车模
|
||||
private ImageView scanBottomCarImage;
|
||||
//扫描束
|
||||
@@ -73,7 +73,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
private final static long DURATION_TIME = 1000;
|
||||
private static CheckAdapter mCheckAdapter;
|
||||
private static boolean isFront = false;
|
||||
private static CheckDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -82,6 +81,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
animation();
|
||||
loadDetail(mContext, null);
|
||||
}
|
||||
/**
|
||||
* 列表View初始化
|
||||
*/
|
||||
@@ -94,40 +99,39 @@ public class CheckActivity extends AppCompatActivity {
|
||||
scanTopImageView = findViewById(R.id.scan_car_top_image);
|
||||
tipsImageView = findViewById(R.id.scan_car_tips);
|
||||
mProgressBar = findViewById(R.id.check_progress);
|
||||
context = mImageView.getContext();
|
||||
packageName = getPackageName(context);
|
||||
mContext = mImageView.getContext();
|
||||
mImageView.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
animation();
|
||||
loadDetail(context);
|
||||
|
||||
mRecyclerView = findViewById(R.id.check_list);
|
||||
CheckLinearLayout linearLayoutManager =
|
||||
new CheckLinearLayout(this, CheckLinearLayout.VERTICAL, false);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.check_item_space_vr)));
|
||||
mRecyclerView.setLayoutManager(linearLayoutManager);
|
||||
mCheckAdapter = new CheckAdapter(context, sCheckResultData);
|
||||
mCheckAdapter = new CheckAdapter(mContext, sCheckResultData);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态下指标监测
|
||||
*/
|
||||
public static boolean checkMonitor(Context context) {
|
||||
public static void checkMonitor(Context context, ICheckResultCallBack checkResultCallBack) {
|
||||
Log.d(TAG, "checkMonitor");
|
||||
loadDetail(context);
|
||||
return true;
|
||||
mContext = context;
|
||||
loadDetail(mContext, checkResultCallBack);
|
||||
}
|
||||
|
||||
//网络请求,获取自车检测结果(工控机上报云端)
|
||||
public static void loadDetail(Context context) {
|
||||
public static void loadDetail(Context context, ICheckResultCallBack checkResultCallBack) {
|
||||
mContext = context;
|
||||
final Map<String, Object> params = ParamsBuilder.of(false)
|
||||
.append("sn", MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.build();
|
||||
CheckApiServiceFactory.getDataApiService(context).loadMonitorDetail(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<CheckResultData>(RequestOptions.create(context)) {
|
||||
.subscribe(new SubscribeImpl<CheckResultData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(CheckResultData o) {
|
||||
super.onSuccess(o);
|
||||
@@ -139,12 +143,8 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mCheckAdapter.mCheckResultData = o;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
if (((CheckResultData) o).getData().getVehicle().getState() == 1) {
|
||||
CallerCheckManager.updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, false);
|
||||
} else {
|
||||
CallerCheckManager.updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, true);
|
||||
showDialog(context);
|
||||
if (checkResultCallBack != null) {
|
||||
checkResultCallBack.callBackWithErrorState(o.getData().getVehicle().getState());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -153,29 +153,11 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Log.d(TAG, "车辆自检失败,请稍后重试" + "==" + message + String.valueOf(code));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return 当前应用的版本名称
|
||||
*/
|
||||
public static synchronized String getPackageName(Context context) {
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
Log.d(TAG, "包名:" + packageInfo.packageName);
|
||||
return packageInfo.packageName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "com.mogo.launcher.f";
|
||||
}
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
@@ -264,28 +246,19 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent starter = new Intent(context, CheckActivity.class);
|
||||
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(starter);
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指标异常弹框
|
||||
*/
|
||||
public static void showDialog(Context context) {
|
||||
try {
|
||||
if (AppUtils.isAppRunning(getPackageName(context)) &&
|
||||
(ActivityUtils.getTopActivity() instanceof CheckActivity == false)) {
|
||||
if (dialog != null) {
|
||||
dialog.cancel();
|
||||
}
|
||||
dialog = new CheckDialog(context, true);
|
||||
dialog.show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,9 +267,4 @@ public class CheckActivity extends AppCompatActivity {
|
||||
isFront = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
private static CheckInfoListDialog mCheckInfoListDialog;
|
||||
CheckInfoListDialog mCheckInfoListDialog;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
|
||||
@@ -40,11 +40,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
setContentView(R.layout.check_dialog);
|
||||
cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
CallerCheckManager.startCheckActivity(mContext);
|
||||
}
|
||||
@@ -63,11 +63,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextPaint;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -23,7 +24,6 @@ import java.util.List;
|
||||
* @since: 9/23/21
|
||||
*/
|
||||
public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
private static final String TAG = "CheckInfoAdapter";
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
@@ -48,37 +48,29 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (position == 0 || position == 2) {
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("模块名称");
|
||||
} else if (position == 1 || position == 3) {
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("运行状态");
|
||||
} else {
|
||||
try {
|
||||
if ((position - 4) < showData.size() * 2) {
|
||||
int index = (position - 4) / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||
String state = (String) positionItem.getStateValue();
|
||||
if (state.equals("1")) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||
} else if ((state.equals("0"))) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||
} else {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||
}
|
||||
try {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.VISIBLE);
|
||||
String state = (String) positionItem.getStateValue();
|
||||
if (state.equals("1")) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("正常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_right);
|
||||
} else if ((state.equals("0"))) {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText("异常");
|
||||
((CheckInfoViewHolder) holder).checkIcon.setImageResource(R.drawable.check_wrong);
|
||||
} else {
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(state);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -94,7 +86,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return showData.size() * 2 + 4;
|
||||
return showData.size() * 2;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
@@ -107,4 +99,5 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
mTextView = v.findViewById(R.id.info_result_tx);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -25,7 +27,7 @@ import java.util.List;
|
||||
public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
|
||||
private static final String TAG = "CheckInfoListDialog";
|
||||
private RecyclerView mRecyclerView;
|
||||
private CheckInfoRecyclerView mRecyclerView;
|
||||
private Context mContext;
|
||||
private TextView titleView;
|
||||
private int span;
|
||||
@@ -33,7 +35,6 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
private CheckResultData mCheckResultData;
|
||||
private List<CheckResultData.CheckListItem> result = new ArrayList<>();
|
||||
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, String style, CheckResultData checkResultData) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
@@ -68,14 +69,18 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext, mStyle, resultData));
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
cancel();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
|
||||
// List<CheckResultData.CheckListItem> test = new ArrayList();//测试数据
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
@@ -98,19 +103,22 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.d(TAG, "检测指标结果值===" + result.toString());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
// test.addAll(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 列表自适应高+限高
|
||||
* @since: 9/29/21
|
||||
*/
|
||||
public class CheckInfoRecyclerView extends RecyclerView {
|
||||
private int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthSpec, int heightSpec) {
|
||||
super.onMeasure(widthSpec, heightSpec);
|
||||
int limitHeight = getMeasuredHeight();
|
||||
if (getMeasuredHeight() > maxHeight) {
|
||||
limitHeight = maxHeight;
|
||||
}
|
||||
setMeasuredDimension(maxWeight, limitHeight);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#767FCD"/>
|
||||
<stroke android:width="3px"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_position_line_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:left="@dimen/dp_3"
|
||||
android:right="@dimen/dp_3"
|
||||
android:top="@dimen/dp_3"><!--设置只有顶部和左右边有边框-->
|
||||
<shape>
|
||||
<solid android:color="@color/check_info_title_back" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -2,34 +2,38 @@
|
||||
<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="@dimen/dp_405"
|
||||
android:layout_height="@dimen/dp_127">
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_gravity="left">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_46"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:gravity="left"
|
||||
android:paddingRight="@dimen/dp_25"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/info_check_icon"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginLeft="@dimen/dp_40"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/check_right" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_result_tx"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="检测中"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginLeft="@dimen/dp_27"
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
android:text="检测中检测中检测中检测中老链路来了来了"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_38"
|
||||
android:layout_marginLeft="@dimen/dp_27"
|
||||
app:layout_constraintLeft_toRightOf="@+id/info_check_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="1900px"
|
||||
android:layout_height="1140px"
|
||||
android:layout_gravity="center"
|
||||
@@ -12,7 +13,7 @@
|
||||
android:layout_height="@dimen/dp_106"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:src="@drawable/module_common_icon_close"
|
||||
android:src="@drawable/check_close"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
android:id="@+id/check_info_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_69"
|
||||
android:layout_marginTop="@dimen/dp_70"
|
||||
android:gravity="center"
|
||||
android:text="自检结果"
|
||||
android:textColor="#fff"
|
||||
@@ -29,17 +30,29 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<include
|
||||
android:id="@+id/check_title_item"
|
||||
layout="@layout/check_info_title_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_66"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_info_title"></include>
|
||||
|
||||
<com.mogo.eagle.core.function.check.view.CheckInfoRecyclerView
|
||||
android:id="@+id/check_list_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_184"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
android:layout_marginBottom="@dimen/dp_80"
|
||||
android:background="@drawable/check_recycler_shape"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/check_title_item" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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="@dimen/check_width"
|
||||
android:layout_height="@dimen/dp_127"
|
||||
android:background="@drawable/check_title_item_shape"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_one"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="模块名称"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_two"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_two"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="运行状态"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_one"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_thr"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_thr"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="模块名称"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintRight_toLeftOf="@+id/title_for"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_two"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_for"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="运行状态"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@+id/title_thr"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -11,6 +11,7 @@
|
||||
<color name="check_icon_error_color">#EE3132</color>
|
||||
<color name="check_info_position_line_color">#666DA5</color>
|
||||
<color name="check_info_shape_color">#767FCD</color>
|
||||
<color name="check_info_title_back">#151738</color>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<resources>
|
||||
<dimen name="check_width">1900px</dimen>
|
||||
<dimen name="check_height">730px</dimen>
|
||||
</resources>
|
||||
@@ -6,6 +6,6 @@
|
||||
@android:drawable/progress_indeterminate_horizontal
|
||||
</item>
|
||||
<item name="android:progressDrawable">@drawable/check_progress</item>
|
||||
<item name="android:listDivider">@drawable/check_driver</item>
|
||||
<item name="android:listDivider">@drawable/check_title_item_shape</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -46,7 +46,7 @@ class MogoPrivateObuManager private constructor() {
|
||||
mIMogoMapService = mMogoServiceApis!!.mapServiceApi
|
||||
|
||||
//自研obu
|
||||
MogoObuManager.getInstance().connect(context, "192.168.43.51")
|
||||
MogoObuManager.getInstance().connect(context, "192.168.20.199")
|
||||
MogoObuManager.getInstance().registerListener(mogoObuListener)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.smp;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -87,8 +88,8 @@ public class SmallMapDirectionView
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView)smpView.findViewById(R.id.aMapNaviView);
|
||||
rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
rlSmallMapBorder.addView(mAMapNaviView);
|
||||
// rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
// rlSmallMapBorder.addView(mAMapNaviView);
|
||||
|
||||
initAMapView();
|
||||
|
||||
@@ -280,4 +281,27 @@ public class SmallMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if(mAMapNaviView != null){
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.smp.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -34,6 +33,7 @@ public class SmallMapFragment extends Fragment {
|
||||
if (mRootView == null) {
|
||||
mRootView = inflater.inflate(R.layout.module_small_map_fragment, container, false);
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
} else {
|
||||
ViewGroup viewGroup = (ViewGroup) mRootView.getParent();
|
||||
if (viewGroup != null) {
|
||||
@@ -55,4 +55,23 @@ public class SmallMapFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mSmallMapDirectionView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mSmallMapDirectionView.onPause();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mSmallMapDirectionView.onDestroy();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user