add log
This commit is contained in:
@@ -33,7 +33,6 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
|
||||
private var hasTipShow = false //是否已经弹框提示
|
||||
var dialog: CheckDialog? = null
|
||||
override fun init(context: Context) {
|
||||
LogUtils.dTag(TAG, "初始化 CheckProvider 模块")
|
||||
mContext = context
|
||||
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
|
||||
TAG,
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -91,20 +90,15 @@ public class CheckActivity extends AppCompatActivity {
|
||||
mRecyclerView.setAdapter(mCheckAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void checkAction() {
|
||||
CheckNetWork.INSTANCE.checkNetWork(this.getApplicationContext(), new ICheckResultCallBack() {
|
||||
@Override
|
||||
public void callBackWithCheckData(CheckResultData data) {
|
||||
Log.d("CheckActivity", "车辆自检结果是:" + data.toString());
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (data != null && mCheckAdapter != null) {
|
||||
mCheckAdapter.errorMsg = null;
|
||||
mCheckAdapter.mCheckResultData = data;
|
||||
mCheckAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -121,7 +115,6 @@ public class CheckActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* **************************************************************************************检测动画
|
||||
*/
|
||||
@@ -180,16 +173,12 @@ public class CheckActivity extends AppCompatActivity {
|
||||
public void animatorScanCarBorder(boolean show, int weight) {
|
||||
if (show) {
|
||||
mValueAnimator = ValueAnimator.ofInt(0, weight);
|
||||
} else {
|
||||
}
|
||||
mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
}
|
||||
mValueAnimator.addUpdateListener(animation -> {
|
||||
Rect rect = new Rect(0, 0, (int) mValueAnimator.getAnimatedValue(), scanTopImageView.getHeight());
|
||||
setProgressBarRefresh((int) mValueAnimator.getAnimatedValue());
|
||||
scanTopImageView.setClip(rect);
|
||||
tipsImageView.setClip(rect);
|
||||
});
|
||||
mValueAnimator.setDuration(DURATION_TIME);
|
||||
mValueAnimator.start();
|
||||
@@ -200,7 +189,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
*/
|
||||
public void setProgressBarRefresh(int animateValue) {
|
||||
if (mProgressBar != null) {
|
||||
double scale = new BigDecimal((float) animateValue / scanBottomCarImage.getWidth())
|
||||
double scale = BigDecimal.valueOf((float) animateValue / scanBottomCarImage.getWidth())
|
||||
.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (mProgressBar.getProgress() < 100) {
|
||||
mProgressBar.setProgress((int) scale);
|
||||
@@ -231,7 +220,7 @@ public class CheckActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mCheckAdapter.ondestry();
|
||||
mCheckAdapter.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.check.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -23,7 +22,6 @@ import com.mogo.eagle.core.function.check.net.CheckResultData;
|
||||
*/
|
||||
public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private static final String TAG = "CheckActivity";
|
||||
LayoutInflater mLayoutInflater;
|
||||
CheckResultData mCheckResultData;
|
||||
private Context mContext;
|
||||
@@ -51,13 +49,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
if (viewType == CheckItemInfo.CheckAdapterStyleEnum.ITEM_TYPE_CHECK_TITLE) {
|
||||
View v = mLayoutInflater.inflate(R.layout.check_titel, parent,
|
||||
false);
|
||||
CheckTitleViewHolder holder = new CheckTitleViewHolder(v);
|
||||
return holder;
|
||||
return new CheckTitleViewHolder(v);
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_list, parent,
|
||||
false);
|
||||
CheckListViewHolder holder = new CheckListViewHolder(v);
|
||||
return holder;
|
||||
return new CheckListViewHolder(v);
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
@@ -66,7 +62,7 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
}
|
||||
}
|
||||
|
||||
public void ondestry() {
|
||||
public void onDestroy() {
|
||||
mContext = null;
|
||||
mCheckInfoListDialog = null;
|
||||
}
|
||||
@@ -74,9 +70,9 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 顶部view列表
|
||||
*/
|
||||
class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView errorImage;
|
||||
private TextView mTextView;
|
||||
private static class CheckTitleViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView errorImage;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckTitleViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -88,11 +84,11 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
/**
|
||||
* 版本->软件检测
|
||||
*/
|
||||
class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView viewTitle;
|
||||
private static class CheckListViewHolder extends RecyclerView.ViewHolder {
|
||||
private final TextView viewTitle;
|
||||
private TextView iconAutoTitle;
|
||||
private TextView autoRiskState;
|
||||
private ImageView iconAuto;
|
||||
private final TextView autoRiskState;
|
||||
private final ImageView iconAuto;
|
||||
|
||||
public CheckListViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@@ -135,7 +131,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "硬件检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
@@ -155,7 +150,6 @@ public class CheckAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||
((CheckListViewHolder) holder).autoRiskState.setText("存在异常项");
|
||||
}
|
||||
((CheckListViewHolder) holder).iconAuto.setOnClickListener(v -> {
|
||||
Log.d(TAG, "系统检测结果:");
|
||||
if (mCheckInfoListDialog != null) {
|
||||
mCheckInfoListDialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ import com.mogo.module.common.dialog.BaseFloatDialog;
|
||||
*/
|
||||
public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
private ImageView cancel;
|
||||
private boolean showWarning;
|
||||
private TextView checkDetail;
|
||||
private Context mContext;
|
||||
|
||||
public CheckDialog(@NonNull Context context, boolean hasError) {
|
||||
@@ -37,11 +35,11 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
|
||||
public void initView() {
|
||||
setContentView(R.layout.check_dialog);
|
||||
cancel = findViewById(R.id.cancel_button);
|
||||
ImageView cancel = findViewById(R.id.cancel_button);
|
||||
cancel.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
checkDetail = findViewById(R.id.check_detail);
|
||||
TextView checkDetail = findViewById(R.id.check_detail);
|
||||
checkDetail.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
if (mContext != null) {
|
||||
@@ -50,17 +48,15 @@ public class CheckDialog extends BaseFloatDialog {
|
||||
});
|
||||
|
||||
//根据条件显示体检页面/风险提示
|
||||
if (showWarning == true) {
|
||||
if (showWarning) {
|
||||
findViewById(R.id.error_view).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.INVISIBLE);
|
||||
|
||||
} else {
|
||||
findViewById(R.id.error_view).setVisibility(View.INVISIBLE);
|
||||
findViewById(R.id.check_view).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void cancel() {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -25,14 +24,14 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
LayoutInflater mLayoutInflater;
|
||||
private Context mContext;
|
||||
private String mStyle;
|
||||
private List<CheckResultData.CheckListItem> showData;
|
||||
private final List<CheckResultData.CheckListItem> showData;
|
||||
//item类型
|
||||
public static final int ITEM_TYPE_CONTENT = 0;//内容
|
||||
public static final int ITEM_TYPE_BOTTOM = 1;//footer类型
|
||||
//适配UI的空白表格
|
||||
private int mBottomCount = 0;
|
||||
|
||||
public CheckInfoAdapter(Context context, String style, List checkResultData) {
|
||||
public CheckInfoAdapter(Context context, String style, List<CheckResultData.CheckListItem> checkResultData) {
|
||||
mContext = context;
|
||||
mStyle = style;
|
||||
showData = checkResultData;
|
||||
@@ -50,7 +49,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
View v = mLayoutInflater.inflate(R.layout.check_info_adapter, parent,
|
||||
false);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoAdapter.CheckInfoViewHolder(v);
|
||||
CheckInfoAdapter.CheckInfoViewHolder holder = new CheckInfoViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@@ -62,7 +61,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
if (position < showData.size() * 2) {
|
||||
int index = position / 2;
|
||||
CheckResultData.CheckListItem positionItem = showData.get(index);
|
||||
if (isEven(position) == true) {//偶数隐藏图片显示检测指标
|
||||
if (isEven(position)) {//偶数隐藏图片显示检测指标
|
||||
((CheckInfoViewHolder) holder).checkIcon.setVisibility(View.GONE);
|
||||
((CheckInfoViewHolder) holder).mTextView.setText(positionItem.getName());
|
||||
} else {//奇数显示图片和检测指标结果
|
||||
@@ -105,9 +104,9 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
return showData.size() * 2 + mBottomCount;
|
||||
}
|
||||
|
||||
public class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView checkIcon;
|
||||
private TextView mTextView;
|
||||
private static class CheckInfoViewHolder extends RecyclerView.ViewHolder {
|
||||
private final ImageView checkIcon;
|
||||
private final TextView mTextView;
|
||||
|
||||
public CheckInfoViewHolder(View v) {
|
||||
super(v);
|
||||
@@ -116,7 +115,7 @@ public class CheckInfoAdapter extends RecyclerView.Adapter {
|
||||
}
|
||||
}
|
||||
|
||||
public class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
private static class CheckInfoFooter extends RecyclerView.ViewHolder {
|
||||
public CheckInfoFooter(View v) {
|
||||
super(v);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
@@ -19,9 +18,8 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
* @since: 9/22/21
|
||||
*/
|
||||
public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
private String TAG = getClass().getSimpleName();
|
||||
private static final int[] ATTRS = new int[]{android.R.attr.listDivider};
|
||||
private Drawable divider;
|
||||
private final Drawable divider;
|
||||
|
||||
public CheckInfoGridItemDivider(Context context) {
|
||||
final TypedArray a = context.obtainStyledAttributes(ATTRS);
|
||||
@@ -44,7 +42,6 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
|
||||
drawHorizontal(c, parent);
|
||||
drawVertical(c, parent);
|
||||
|
||||
@@ -138,10 +135,7 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
|
||||
|
||||
//是否为第一行
|
||||
private boolean isFirstRaw(int pos, int spanCount) {
|
||||
if (pos < spanCount) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return pos < spanCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
List resultData = showInfoResult();
|
||||
List<CheckResultData.CheckListItem> resultData = showInfoResult();
|
||||
CheckInfoAdapter adapter = new CheckInfoAdapter(mContext, mStyle, resultData);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
//关闭按钮
|
||||
@@ -72,13 +72,13 @@ public class CheckInfoListDialog extends BaseFloatDialog {
|
||||
});
|
||||
}
|
||||
|
||||
public List showInfoResult() {
|
||||
public List<CheckResultData.CheckListItem> showInfoResult() {
|
||||
|
||||
if (result.size() > 0) {
|
||||
result.clear();
|
||||
}
|
||||
try {
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList();
|
||||
List<CheckResultData.CheckListItem> checkListResult = new ArrayList<CheckResultData.CheckListItem>();
|
||||
try {
|
||||
if (mStyle.equals(CheckItemInfo.CheckInfoStyle.CHECK_INFO_STYLE_DEVICES)) {
|
||||
checkListResult = mCheckResultData.getData().getDevices();
|
||||
|
||||
@@ -15,8 +15,8 @@ import com.mogo.eagle.core.function.check.R;
|
||||
* @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);
|
||||
private final int maxHeight = (int) getContext().getResources().getDimension(R.dimen.check_height);
|
||||
private final int maxWeight = (int) getContext().getResources().getDimension(R.dimen.check_width);
|
||||
|
||||
public CheckInfoRecyclerView(@NonNull Context context) {
|
||||
super(context);
|
||||
|
||||
Reference in New Issue
Block a user