[add] 测试代码 接口联调
This commit is contained in:
@@ -8,4 +8,13 @@ import com.mogo.commons.data.BaseData;
|
||||
* @since: 8/13/21
|
||||
*/
|
||||
public class CheckResultData extends BaseData {
|
||||
public Data data;
|
||||
|
||||
public static class Data {
|
||||
public vehicle mVehicle;
|
||||
}
|
||||
|
||||
public static class vehicle {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.elegant.network.ParamsBuilder;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
@@ -29,6 +30,7 @@ import com.mogo.eagle.core.function.call.check.CallerCheckManager;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.module.common.view.ImageViewClipBounds;
|
||||
import com.mogo.module.common.view.SpacesItemDecoration;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
@@ -240,23 +242,24 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
//网络请求,获取自车检测结果(工控机上报云端)
|
||||
//网络请求,获取自车检测结果(工控机上报云端)append("sn", MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
public static void loadDetail() {
|
||||
final Map<String, Object> query = new ParamsProvider.Builder(context)
|
||||
.append("sn", MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
final Map<String, Object> params = ParamsBuilder.of(false)
|
||||
.append("sn", "SNDFD05063")//测试代码
|
||||
.build();
|
||||
CheckApiServiceFactory.getDataApiService(context).loadMonitorDetail(query)
|
||||
CheckApiServiceFactory.getDataApiService(context).loadMonitorDetail(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
.subscribe(new SubscribeImpl<CheckResultData>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
public void onSuccess(CheckResultData o) {
|
||||
super.onSuccess(o);
|
||||
Log.d(TAG, "车辆自检结果是:" + o.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
Log.d(TAG, "车辆自检失败:" + "message:" + message + "code:" + code);
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -12,22 +11,11 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.model.CheckItemInfo;
|
||||
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
@@ -93,6 +81,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
private TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
private ImageView iconAuto;
|
||||
|
||||
private TextView iconyingTitle;
|
||||
private TextView yingRiskState;
|
||||
@@ -101,11 +90,9 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
super(itemView);
|
||||
viewTitle = itemView.findViewById(R.id.list_item_title);
|
||||
//自动驾驶
|
||||
iconAuto = itemView.findViewById(R.id.icon_auto);
|
||||
iconAutoTitle = itemView.findViewById(R.id.icon_auto_title);
|
||||
autoRiskState = itemView.findViewById(R.id.auto_risk_state);
|
||||
itemView.findViewById(R.id.auto_layout).setOnClickListener(v -> {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +137,8 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
try {
|
||||
Object list = dataArrayList.get(position);
|
||||
if (position == 0) {
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_right);
|
||||
|
||||
if (list instanceof ArrayList && ((ArrayList) list).size() > 0) {
|
||||
CheckItemInfo item = (CheckItemInfo) ((ArrayList) list).get(0);
|
||||
((CheckTitleViewHolder) holder).mTextView.setText(item.getTitle());
|
||||
@@ -159,9 +148,19 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckTitleViewHolder) holder).errorImage.setImageResource(R.drawable.check_wrong);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (position == 1) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
});
|
||||
} else if (position == 2) {
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -182,7 +181,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size();
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ package com.mogo.eagle.core.function.check.view;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
/**
|
||||
@@ -12,11 +15,37 @@ import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckListDialog extends BaseFloatDialog {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private Context mContext;
|
||||
private int span;
|
||||
|
||||
|
||||
public CheckListDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
initView();
|
||||
}
|
||||
|
||||
public CheckListDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_info_list);
|
||||
mRecyclerView = findViewById(R.id.module_services_id_recycler_view);
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(mContext, 4);
|
||||
//表示竖直显示.默认VERTICAL
|
||||
layoutManager.setOrientation(GridLayoutManager.HORIZONTAL);
|
||||
mRecyclerView.addItemDecoration(new CheckListGridItem());
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
cancel();
|
||||
});
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
class CheckListGridItem extends RecyclerView.ItemDecoration {
|
||||
//分割线的宽度
|
||||
private static final int DIVIDER_SIZE = 5;
|
||||
|
||||
private final Paint mPaint = new Paint();
|
||||
|
||||
public CheckListGridItem() {
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mPaint.setColor(Color.RED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
super.onDraw(c, parent, state);
|
||||
RecyclerView.LayoutManager manager = parent.getLayoutManager();
|
||||
if (manager instanceof GridLayoutManager) {
|
||||
//表格的边框主要是由分割线和下分割线
|
||||
for (int i = 0; i < parent.getChildCount(); ++i) {
|
||||
//获取子元素
|
||||
View child = parent.getChildAt(i);
|
||||
//我们首先来制作子元素右分割线,或者说纵向分割线
|
||||
setUpVerticalDivider(child, c);
|
||||
//制作横向分割线
|
||||
setUpHorizontalDivider(child, c);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("LayoutManager使用错误");
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpVerticalDivider(View child, Canvas canvas) {
|
||||
float left = child.getRight();
|
||||
float top = child.getTop();
|
||||
float right = left + DIVIDER_SIZE;
|
||||
float bottom = child.getBottom() + DIVIDER_SIZE;
|
||||
canvas.drawRect(left, top, right, bottom, mPaint);
|
||||
}
|
||||
|
||||
private void setUpHorizontalDivider(View child, Canvas canvas) {
|
||||
float left = child.getLeft();
|
||||
float top = child.getBottom();
|
||||
float right = child.getRight();
|
||||
float bottom = top + DIVIDER_SIZE;
|
||||
canvas.drawRect(left, top, right, bottom, mPaint);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
outRect.set(0, 0, DIVIDER_SIZE, DIVIDER_SIZE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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="1900px"
|
||||
android:layout_height="1140px"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/check_dialog_back">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cancel_info_list_button"
|
||||
android:layout_width="@dimen/dp_106"
|
||||
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"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_89"
|
||||
android:gravity="center"
|
||||
android:text="自检结果"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/check_list_recycler"
|
||||
android:layout_marginLeft="@dimen/dp_143"
|
||||
android:layout_marginTop="@dimen/dp_143"
|
||||
android:layout_marginRight="@dimen/dp_143"
|
||||
android:layout_marginBottom="@dimen/dp_143"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -17,7 +17,7 @@
|
||||
android:layout_marginStart="@dimen/dp_80"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:text="版本检测:(以下 1 项需要优化,版本升级后需要重启设备)"
|
||||
android:text="硬件检测:"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_42"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -30,7 +30,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_318"
|
||||
android:layout_marginTop="@dimen/dp_181"
|
||||
android:layout_marginBottom="@dimen/dp_70"
|
||||
android:clickable="true"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -41,6 +43,7 @@
|
||||
android:layout_width="@dimen/dp_150"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_gravity="center"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/auto" />
|
||||
|
||||
<TextView
|
||||
@@ -58,7 +61,7 @@
|
||||
<TextView
|
||||
android:id="@+id/auto_risk_state"
|
||||
android:layout_width="@dimen/dp_260"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
|
||||
Reference in New Issue
Block a user