diff --git a/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckActivity.java b/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckActivity.java deleted file mode 100644 index 904cc1df8f..0000000000 --- a/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mogo.module.check; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.PersistableBundle; -import android.widget.Button; - -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - -/** - * @author liujing - * @description 检测页面 - * @since: 7/27/21 - */ -public class CheckActivity extends AppCompatActivity { - - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_check); - - findViewById(R.id.btnBack).setOnClickListener(v -> { - finish(); - }); - } - - public static void start(Context context) { - Intent starter = new Intent(context, CheckActivity.class); - context.startActivity(starter); - } - -} diff --git a/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckProvider.java b/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckProvider.java index dade9feb9b..6fe54d157e 100644 --- a/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckProvider.java +++ b/modules/mogo-module-check/src/main/java/com/mogo/module/check/CheckProvider.java @@ -18,8 +18,8 @@ import com.mogo.utils.logger.Logger; */ @Route(path = MogoServicePaths.PATH_CHECK) public class CheckProvider implements ICheckProvider { - private static final String TAG = "CheckProvider"; - private Context mContext; + private static final String TAG = "CheckProvider"; + private Context mContext; @Override @@ -34,4 +34,11 @@ public class CheckProvider implements ICheckProvider { CheckActivity.start(context); } } + + @Override + public void showCheckDialog(Context context) { + if (context != null) { + CheckActivity.showDialog(context); + } + } } diff --git a/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckActivity.java b/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckActivity.java index 7ef3ea01c6..4f4ab51bb1 100644 --- a/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckActivity.java +++ b/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckActivity.java @@ -13,12 +13,15 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.module.check.R; import com.mogo.module.check.model.CheckItemInfo; import com.mogo.module.check.net.CheckApiServices; import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.MogoModulePaths; import com.mogo.module.common.constants.HostConst; import com.mogo.module.common.view.SpacesItemDecoration; +import com.mogo.service.MogoServicePaths; import com.mogo.utils.CommonUtils; import com.mogo.utils.network.utils.NetworkStatusUtil; import com.tencent.bugly.beta.Beta; @@ -418,6 +421,15 @@ public class CheckActivity extends AppCompatActivity { context.startActivity(starter); } + + /** + * 指标异常弹框 + */ + public static void showDialog(Context context) { + CheckDialog dialog = new CheckDialog(context, true); + dialog.show(); + } + @Override protected void onDestroy() { super.onDestroy(); diff --git a/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckDialog.java b/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckDialog.java index 0da021b1e2..0fb17b669e 100644 --- a/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckDialog.java +++ b/modules/mogo-module-check/src/main/java/com/mogo/module/check/view/CheckDialog.java @@ -1,22 +1,59 @@ package com.mogo.module.check.view; import android.content.Context; +import android.view.View; +import android.widget.ImageView; import androidx.annotation.NonNull; +import com.mogo.module.check.R; import com.mogo.module.common.dialog.BaseFloatDialog; /** * @author liujing - * @description 检测提示弹框 + * @description 车辆监控弹框提示 * @since: 7/30/21 */ public class CheckDialog extends BaseFloatDialog { - public CheckDialog(@NonNull Context context) { + + private ImageView cancel; + private boolean showError; + + public CheckDialog(@NonNull Context context, boolean hasError) { super(context); + showError = hasError; + initView(); } public CheckDialog(@NonNull Context context, int themeResId) { super(context, themeResId); } + + public void initView() { + setContentView(R.layout.check_dialog); + cancel = findViewById(R.id.cancel_button); + cancel.setOnClickListener(v -> { + cancel(); + }); + + //根据条件显示体检页面/风险提示 + if (showError == true) { + 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() { + super.dismiss(); + } + + @Override + public void dismiss() { + + } } diff --git a/modules/mogo-module-check/src/main/res/drawable/check_dialog_back.xml b/modules/mogo-module-check/src/main/res/drawable/check_dialog_back.xml new file mode 100644 index 0000000000..b6a2eaefba --- /dev/null +++ b/modules/mogo-module-check/src/main/res/drawable/check_dialog_back.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/modules/mogo-module-check/src/main/res/layout/check_dialog.xml b/modules/mogo-module-check/src/main/res/layout/check_dialog.xml index 29724e604b..0df7874ad0 100644 --- a/modules/mogo-module-check/src/main/res/layout/check_dialog.xml +++ b/modules/mogo-module-check/src/main/res/layout/check_dialog.xml @@ -4,7 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="1529px" android:layout_height="720px" - android:layout_gravity="center"> + android:layout_gravity="center" + android:background="@drawable/check_dialog_back"> + app:layout_constraintEnd_toEndOf="parent" /> diff --git a/modules/mogo-module-check/src/main/res/values-xhdpi-2560x1600/dimens.xml b/modules/mogo-module-check/src/main/res/values-xhdpi-2560x1600/dimens.xml index 41cb439749..912e36be0b 100644 --- a/modules/mogo-module-check/src/main/res/values-xhdpi-2560x1600/dimens.xml +++ b/modules/mogo-module-check/src/main/res/values-xhdpi-2560x1600/dimens.xml @@ -4,7 +4,7 @@ 38px 70px 133px - 78px + 50px 50px 1452px 715px diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 74730c8a74..0fa72b6820 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -72,6 +72,7 @@ import com.mogo.module.extensions.view.ArcView; import com.mogo.module.service.receiver.MogoReceiver; import com.mogo.module.share.manager.ServiceApisManager; import com.mogo.service.IMogoServiceApis; +import com.mogo.service.MogoServicePaths; import com.mogo.service.analytics.IMogoAnalytics; import com.mogo.service.connection.IMogoOnMessageListener; import com.mogo.service.entrance.ButtonIndex; @@ -408,6 +409,14 @@ public class EntranceFragment extends MvpFragment{ + MogoApisHandler.getInstance().getApis().getCheckProvider().showCheckDialog(getContext()); + return true; + }); + } private int debugPanelClickCount = 0; diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/monitoring/VehicleMonitoring.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/monitoring/VehicleMonitoring.java new file mode 100644 index 0000000000..f03e503951 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/monitoring/VehicleMonitoring.java @@ -0,0 +1,44 @@ +package com.mogo.module.main.monitoring; + + +import android.content.Context; +import android.os.Handler; +import android.os.Message; + +/** + * @author liujing + * @description 车辆监控 + * @since: 8/16/21 + */ +public class VehicleMonitoring implements Handler.Callback { + + private final Context mContext; + private final Handler mHandler = new Handler(); + //自动驾驶状态下10分钟弹框提示一次 + private static final long AUTO_CHECK_STATUS_DELAY = 10 * 60 * 1000; + private static final int AUTO_CHECK_STATUS = 10001; + private static final int MANUAL_CHECK_STATUS = 10002; + + public VehicleMonitoring(Context context) { + mContext = context; + } + + public void vehicleCheckForAuto() { + mHandler.sendEmptyMessageDelayed(AUTO_CHECK_STATUS, AUTO_CHECK_STATUS_DELAY); + } + + @Override + public boolean handleMessage(Message msg) { + switch (msg.what) { + case AUTO_CHECK_STATUS: + + return true; + case MANUAL_CHECK_STATUS: + return true; + default: + } + return false; + } + + +} diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java index 9b9f0d7615..2fbacb1bac 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/service/MogoMainService.java @@ -15,6 +15,7 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.main.EventDispatchCenter; import com.mogo.module.main.cards.MogoModulesManager; import com.mogo.module.main.delaycheck.DelayCheckUtil; +import com.mogo.module.main.monitoring.VehicleMonitoring; import com.mogo.service.IMogoServiceApis; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.logger.Logger; @@ -52,6 +53,9 @@ class MogoMainService extends Service implements IMogoLocationListener { // 开启延时检测 DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this); delayCheckUtil.waitingForCheck(); + //车辆检测 + VehicleMonitoring monitoring = new VehicleMonitoring(this); + monitoring.vehicleCheckForAuto(); } @Nullable diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java index a326988f48..d0f150202e 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/MogoServicePaths.java @@ -322,7 +322,7 @@ public class MogoServicePaths { public static final String PATH_V2X_FRONT_CRASH_WARNING = "/front/crashwarning"; /** - * ADAS 模块 + * 车辆检测 模块 */ public static final String PATH_CHECK = "/check/api"; diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/check/ICheckProvider.java b/services/mogo-service-api/src/main/java/com/mogo/service/check/ICheckProvider.java index 6cfb58df0b..620bf766e4 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/check/ICheckProvider.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/check/ICheckProvider.java @@ -12,4 +12,11 @@ public interface ICheckProvider extends IProvider { * 启动检测模块 */ void startCheckActivity(Context context); + + /** + * 检测弹框 + */ + void showCheckDialog(Context context); + + }