diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java index 9292cd1797..71530157c3 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckActivity.java @@ -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(RequestOptions.create(context)) { + .subscribe(new SubscribeImpl(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) { diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckAdapter.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckAdapter.java index 2cfc7358cc..7d2805d48e 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckAdapter.java +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckAdapter.java @@ -30,12 +30,12 @@ public class CheckAdapter extends RecyclerView.Adapter 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 @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 } ((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 } ((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> { Log.d(TAG, "系统检测结果:"); - mCheckInfoListDialog = new CheckInfoListDialog(mContext, "系统自检结果"); + mCheckInfoListDialog = new CheckInfoListDialog(mContext, "系统自检结果", mCheckResultData); mCheckInfoListDialog.show(); }); } diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoAdapter.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoAdapter.java index 0289c8c34e..67343ab341 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoAdapter.java +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoAdapter.java @@ -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); diff --git a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoListDialog.java b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoListDialog.java index 592dde915a..4d0e1bb028 100644 --- a/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoListDialog.java +++ b/core/function-impl/mogo-core-function-check/src/main/java/com/mogo/eagle/core/function/check/view/CheckInfoListDialog.java @@ -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(); diff --git a/core/function-impl/mogo-core-function-check/src/main/res/layout/check_list.xml b/core/function-impl/mogo-core-function-check/src/main/res/layout/check_list.xml index e8ab3ddfe3..12c70f5266 100644 --- a/core/function-impl/mogo-core-function-check/src/main/res/layout/check_list.xml +++ b/core/function-impl/mogo-core-function-check/src/main/res/layout/check_list.xml @@ -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" /> diff --git a/core/function-impl/mogo-core-function-check/src/main/res/layout/check_titel.xml b/core/function-impl/mogo-core-function-check/src/main/res/layout/check_titel.xml index 79a4bcba6a..89aa819e03 100644 --- a/core/function-impl/mogo-core-function-check/src/main/res/layout/check_titel.xml +++ b/core/function-impl/mogo-core-function-check/src/main/res/layout/check_titel.xml @@ -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"