1.错误msg呈现
2.多余单元格删除逻辑(适配UI)
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@@ -4,7 +4,7 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
@@ -82,6 +82,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.mogo.eagle.core.function.check
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.check.ICheckProvider
|
||||
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
|
||||
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack
|
||||
import com.mogo.eagle.core.function.check.net.CheckNetWork
|
||||
import com.mogo.eagle.core.function.check.net.CheckNetWork.checkNetWork
|
||||
import com.mogo.eagle.core.function.check.net.CheckResultData
|
||||
import com.mogo.eagle.core.function.check.view.CheckActivity
|
||||
import com.mogo.eagle.core.function.check.view.CheckDialog
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
@@ -14,7 +17,6 @@ import com.mogo.eagle.core.utilcode.util.AppUtils
|
||||
import com.mogo.eagle.core.utilcode.util.LogUtils
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.service.receiver.MogoReceiver
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.utils.ActivityLifecycleManager
|
||||
@@ -63,16 +65,22 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
}
|
||||
|
||||
override fun checkMonitor(context: Context) {
|
||||
CheckNetWork.checkNetWork(context, ICheckResultCallBack { state ->
|
||||
updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, state.data.vehicle.state)
|
||||
if (state.data.vehicle.state == 1) {
|
||||
hasTipShow = false
|
||||
} else {
|
||||
if (!hasTipShow) {
|
||||
showDialog(context)
|
||||
hasTipShow = true //已弹框
|
||||
checkNetWork(context, object : ICheckResultCallBack {
|
||||
override fun callBackWithCheckData(data: CheckResultData) {
|
||||
updateMonitoringStatus(MogoReceiver.ACTION_CHECK_VEHICLE_MONITORING, data.data.vehicle.state)
|
||||
if (data.data.vehicle.state == 1) {
|
||||
hasTipShow = false
|
||||
} else {
|
||||
if (!hasTipShow) {
|
||||
showDialog(context)
|
||||
hasTipShow = true //已弹框
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun callBackWithError(message: String, code: Int) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -9,4 +9,6 @@ import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
*/
|
||||
public interface ICheckResultCallBack {
|
||||
void callBackWithCheckData(CheckResultData data);
|
||||
|
||||
void callBackWithError(String message, int code);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ object CheckNetWork {
|
||||
|
||||
override fun onError(message: String, code: Int) {
|
||||
super.onError(message, code)
|
||||
ThreadUtils.runOnUiThread { callbackFlow?.callBackWithError(message,code) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -101,15 +101,27 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void run() {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callBackWithError(String message, int code) {
|
||||
if (message != null) {
|
||||
mCheckAdapter.errorMsg = message;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
CheckInfoListDialog mCheckInfoListDialog;
|
||||
String errorMsg;
|
||||
|
||||
public CheckAdapter(@NonNull Context context, @NonNull CheckResultData checkResult) {
|
||||
mContext = context;
|
||||
@@ -60,7 +61,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
if (mCheckInfoListDialog!=null && mCheckInfoListDialog.isShowing()){
|
||||
if (mCheckInfoListDialog != null && mCheckInfoListDialog.isShowing()) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -105,9 +106,14 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (errorMsg != null) {
|
||||
errorMsgShow(holder, position);
|
||||
}
|
||||
|
||||
if (mCheckResultData == null || mCheckResultData.getData() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (position == 0) {
|
||||
if (mCheckResultData.getData().getVehicle().getState() == 1) {
|
||||
@@ -130,7 +136,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
if (mCheckInfoListDialog != null){
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES, mCheckResultData);
|
||||
@@ -150,7 +156,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
if (mCheckInfoListDialog != null){
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
mCheckInfoListDialog = new CheckInfoListDialog(mContext, CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_SOFT, mCheckResultData);
|
||||
@@ -163,6 +169,27 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
}
|
||||
|
||||
private void errorMsgShow(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
((CheckTitleViewHolder) holder).mTextView.setText(errorMsg);
|
||||
break;
|
||||
case 1:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("硬件检测:");
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(errorMsg);
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
break;
|
||||
case 2:
|
||||
((CheckListViewHolder) holder).viewTitle.setText("系统检测:");
|
||||
((CheckListViewHolder) holder).autoRiskState.setText(errorMsg);
|
||||
((CheckListViewHolder) holder).autoRiskState.setTextColor(
|
||||
(mContext.getResources().getColor(R.color.check_icon_error_color)));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 3;
|
||||
|
||||
@@ -29,8 +29,8 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
//item类型
|
||||
public static final int ITEM_TYPE_CONTENT = 0;//内容
|
||||
public static final int ITEM_TYPE_BOTTOM = 1;//footer类型
|
||||
//底部View个数
|
||||
private int mBottomCount = 1;
|
||||
//适配UI的空白表格
|
||||
private int mBottomCount = 0;
|
||||
|
||||
public CheckInfoAdapter(Context context, String style, List checkResultData) {
|
||||
mContext = context;
|
||||
@@ -97,6 +97,11 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (isEven(showData.size())) {
|
||||
mBottomCount = 0;
|
||||
} else {
|
||||
mBottomCount = 1;
|
||||
}
|
||||
return showData.size() * 2 + mBottomCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginRight="@dimen/dp_24"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/check_right" />
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_result_tx"
|
||||
@@ -31,7 +30,6 @@
|
||||
android:ellipsize="end"
|
||||
android:gravity="left"
|
||||
android:maxLines="2"
|
||||
android:text="检测中检测中检测中检测中老链路来了来了"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/dp_38"
|
||||
app:layout_constraintLeft_toRightOf="@+id/info_check_icon" />
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="连接异常"
|
||||
android:textColor="@color/check_little_btn_green"
|
||||
android:textColor="@color/check_icon_error_color"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintTop_toTopOf="@+id/icon_auto_title" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -55,7 +55,7 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
delayCheckUtil.waitingForCheck();
|
||||
// 车辆检测
|
||||
VehicleMonitoring monitoring = new VehicleMonitoring(this);
|
||||
//monitoring.vehicleCheck();
|
||||
monitoring.vehicleCheck();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user