网格线宽度修改;首次网络请求未赋值成功修复
This commit is contained in:
@@ -105,6 +105,8 @@ public class CheckActivity extends AppCompatActivity {
|
||||
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);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,17 +126,13 @@ public class CheckActivity extends AppCompatActivity {
|
||||
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());
|
||||
if (o instanceof CheckResultData) {
|
||||
sCheckResultData = (CheckResultData) o;
|
||||
}
|
||||
if (mCheckAdapter == null && sCheckResultData != null) {
|
||||
mCheckAdapter = new CheckAdapter(context, sCheckResultData);
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
if (o != null){
|
||||
mCheckAdapter.mCheckResultData = o;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
if (((CheckResultData) o).getData().getVehicle().getState() == 1) {
|
||||
|
||||
@@ -30,12 +30,12 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
private CheckInfoListDialog mCheckInfoListDialog;
|
||||
private static CheckInfoListDialog mCheckInfoListDialog;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
mCheckResultData = checkResult;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +98,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (mCheckResultData == null || mCheckResultData.getData() == null) {
|
||||
Log.d(TAG, "onBindViewHolder 无数据或数据结构错误");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -123,7 +122,10 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, "硬件自检结果");
|
||||
if (mCheckInfoListDialog != null){
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, "硬件自检结果", mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
|
||||
});
|
||||
@@ -140,7 +142,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, "系统自检结果");
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, "系统自检结果", mCheckResultData);
|
||||
mCheckInfoListDialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
@@ -22,9 +23,11 @@ import org.w3c.dom.Text;
|
||||
public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private CheckResultData mCheckResultData;
|
||||
|
||||
public CheckInfoAdapter(Context context) {
|
||||
public CheckInfoAdapter(Context context, CheckResultData checkResultData) {
|
||||
mContext = context;
|
||||
mCheckResultData = checkResultData;
|
||||
mLayoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@@ -40,12 +43,14 @@ 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("运行状态");
|
||||
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 {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,6 +63,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView checkIcon;
|
||||
private TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
checkIcon = v.findViewById(R.id.info_check_icon);
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.function.check.R;
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
|
||||
/**
|
||||
@@ -23,12 +24,14 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
private TextView titleView;
|
||||
private int span;
|
||||
private String mTitle;
|
||||
private CheckResultData mCheckResultData;
|
||||
|
||||
|
||||
public CheckInfoListDialog(@NonNull Context context, String title) {
|
||||
public CheckInfoListDialog(@NonNull Context context, String title,CheckResultData checkResultData) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mTitle = title;
|
||||
mCheckResultData = checkResultData;
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -47,12 +50,12 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
layoutManager.setOrientation(GridLayoutManager.VERTICAL);
|
||||
//网格绘制
|
||||
try {
|
||||
CheckInfoGridItemDivider gridLayoutDivider = new CheckInfoGridItemDivider(2, Color.parseColor("#CCCCCC"));
|
||||
CheckInfoGridItemDivider gridLayoutDivider = new CheckInfoGridItemDivider(3, Color.parseColor("#767FCD"));
|
||||
mRecyclerView.addItemDecoration(gridLayoutDivider);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext));
|
||||
mRecyclerView.setAdapter(new CheckInfoAdapter(mContext, mCheckResultData));
|
||||
//关闭按钮
|
||||
findViewById(R.id.cancel_info_list_button).setOnClickListener(v -> {
|
||||
cancel();
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="运行正常"
|
||||
android:text="检测中..."
|
||||
android:textColor="@color/check_little_btn_green"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintTop_toTopOf="@+id/icon_auto_title" />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_65"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:text="自动驾驶车辆存在风险"
|
||||
android:text="自动驾驶车辆体检中,请稍候……"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_64"
|
||||
app:layout_constraintLeft_toRightOf="@+id/check_tip_image"
|
||||
|
||||
Reference in New Issue
Block a user