升级kotlin版本

This commit is contained in:
董宏宇
2021-08-04 21:08:51 +08:00
parent f9548def7e
commit be361ca514
9 changed files with 101 additions and 90 deletions

View File

@@ -15,7 +15,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20'
classpath "com.alibaba:arouter-register:1.0.2"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
// classpath ("com.tencent.matrix:matrix-gradle-plugin:0.6.6") { changing = true }

View File

@@ -1,6 +1,6 @@
ext {
time = ""
kotlin_version = "1.4.10"
kotlin_version = "1.4.20"
android = [
launcherApplicationId : "com.mogo.launcher",
independentApplicationId : "com.mogo.launcher.app",

View File

@@ -42,7 +42,8 @@ android {
}
dependencies {
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter

View File

@@ -4,7 +4,6 @@ import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
@@ -24,10 +23,12 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
private String TAG = "MoGoWarningProvider";
private MoGoWarningFragment mMoGoWarningFragment;
private Context mContext;
@Override
public void init(Context context) {
Logger.d(TAG, "初始化蘑菇预警模块 ……");
mContext = context;
}
@Override
@@ -48,11 +49,6 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
return ModuleType.TYPE_CARD_FRAGMENT;
}
@Override
public void showWarningV2X(int v2xType, @Nullable String alertMessage) {
mMoGoWarningFragment.showWarningV2X(v2xType, alertMessage);
}
@Override
public void showWarningTrafficLight(int checkLightId) {
mMoGoWarningFragment.showWarningTrafficLight(checkLightId);
@@ -72,4 +68,14 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
public void disableLimitingVelocity() {
mMoGoWarningFragment.disableLimitingVelocity();
}
@Override
public void showWarningV2X(int v2xType, @NonNull String alertMessage, @NonNull String tag) {
mMoGoWarningFragment.showWarningV2X(v2xType, alertMessage, tag);
}
@Override
public void disableWarningV2X(@NonNull String tag) {
}
}

View File

@@ -1,91 +1,87 @@
package com.mogo.module.warning.receiver;
package com.mogo.module.warning.receiver
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.module.warning.WaringConst;
import com.mogo.module.warning.WarningTypeEnum;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.warning.IMoGoWaringProvider;
import com.mogo.utils.logger.Logger;
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.module.warning.WaringConst
import com.mogo.module.warning.WarningTypeEnum
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.mogo.service.warning.IMoGoWaringProvider
import com.mogo.utils.logger.Logger
import kotlin.random.Random
/**
* V2X 测试面板广播接收,目的是可以通过广播调用起来面板
*
* @author donghongyu
*/
public class TestWarningBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "TestPanelBroadcastReceiver";
private Context mContext;
private static IMogoServiceApis mMogoServiceApis;
private static IMoGoWaringProvider mIMoGoWaringProvider;
@Override
public void onReceive(Context context, Intent intent) {
class TestWarningBroadcastReceiver : BroadcastReceiver() {
private var mContext: Context? = null
override fun onReceive(context: Context, intent: Intent) {
try {
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mIMoGoWaringProvider = mMogoServiceApis.getWaringProviderApi();
this.mContext = context;
int warningType = intent.getIntExtra(WaringConst.BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY, 0);
Logger.d(TAG, "warningType:" + warningType);
mMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS)
.navigation(context) as IMogoServiceApis
mIMoGoWaringProvider = mMogoServiceApis!!.waringProviderApi
mContext = context
val warningType =
intent.getIntExtra(WaringConst.BROADCAST_TEST_CONTROL_TYPE_EXTRA_KEY, 0)
Logger.d(TAG, "warningType:$warningType")
// 分发场景
dispatchWaring(warningType);
} catch (Exception e) {
e.printStackTrace();
dispatchWaring(warningType)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 分发处理场景
*
* @param warningType 场景类型
*/
private void dispatchWaring(int warningType) {
mIMoGoWaringProvider.showWarningV2X(warningType, "预警消息");
switch (warningType) {
case WarningTypeEnum.WARING_TYPE_PRIOR_COLLISION://前向碰撞
break;
case WarningTypeEnum.WARING_TYPE_INTERSECTION_COLLISION://交叉路口碰撞
break;
case WarningTypeEnum.WARING_TYPE_LEFT_AUXILIARY://左转辅助
break;
case WarningTypeEnum.WARING_TYPE_BLIND_AREA_COLLISION://盲区/变道辅助
break;
case WarningTypeEnum.WARING_TYPE_REVERSE_OVERTAKING://逆向超车
break;
case WarningTypeEnum.WARING_TYPE_VEHICLE_BRAKES://紧急制动-前车急刹
break;
case WarningTypeEnum.WARING_TYPE_ABNORMAL_VEHICLE://异常车辆提醒
break;
case WarningTypeEnum.WARING_TYPE_VEHICLE_CONTROL://车辆失控预警
break;
case WarningTypeEnum.WARING_TYPE_ROAD_HAZARDS://道路危险情况提示
break;
case WarningTypeEnum.WARING_TYPE_SPEED_LIMIT://限速预警
break;
case WarningTypeEnum.WARING_TYPE_RED_LIGHT://闯红灯预警
break;
case WarningTypeEnum.WARING_TYPE_VULNERABLE_TRANSPORT_PARTICIPANT://弱势交通参与者
break;
case WarningTypeEnum.WARING_TYPE_TRAFFIC_SPEED_GUIDE://绿波通行车速引导
break;
case WarningTypeEnum.WARING_TYPE_CAR_PLATE://车内标牌
break;
case WarningTypeEnum.WARING_TYPE_TRAFFIC_JAM_AHEAD://前方道路拥堵
break;
case WarningTypeEnum.WARING_TYPE_SPECIAL_VEHICLE_ACCESS://紧急车辆提醒(特种车辆优先通行)
break;
private fun dispatchWaring(warningType: Int) {
mIMoGoWaringProvider!!.showWarningV2X(warningType, "预警消息", Random.nextDouble().toString())
when (warningType) {
WarningTypeEnum.WARING_TYPE_PRIOR_COLLISION -> {
}
WarningTypeEnum.WARING_TYPE_INTERSECTION_COLLISION -> {
}
WarningTypeEnum.WARING_TYPE_LEFT_AUXILIARY -> {
}
WarningTypeEnum.WARING_TYPE_BLIND_AREA_COLLISION -> {
}
WarningTypeEnum.WARING_TYPE_REVERSE_OVERTAKING -> {
}
WarningTypeEnum.WARING_TYPE_VEHICLE_BRAKES -> {
}
WarningTypeEnum.WARING_TYPE_ABNORMAL_VEHICLE -> {
}
WarningTypeEnum.WARING_TYPE_VEHICLE_CONTROL -> {
}
WarningTypeEnum.WARING_TYPE_ROAD_HAZARDS -> {
}
WarningTypeEnum.WARING_TYPE_SPEED_LIMIT -> {
}
WarningTypeEnum.WARING_TYPE_RED_LIGHT -> {
}
WarningTypeEnum.WARING_TYPE_VULNERABLE_TRANSPORT_PARTICIPANT -> {
}
WarningTypeEnum.WARING_TYPE_TRAFFIC_SPEED_GUIDE -> {
}
WarningTypeEnum.WARING_TYPE_CAR_PLATE -> {
}
WarningTypeEnum.WARING_TYPE_TRAFFIC_JAM_AHEAD -> {
}
WarningTypeEnum.WARING_TYPE_SPECIAL_VEHICLE_ACCESS -> {
}
}
}
}
companion object {
private const val TAG = "TestPanelBroadcastReceiver"
private var mMogoServiceApis: IMogoServiceApis? = null
private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
}
}

View File

@@ -14,18 +14,20 @@ interface MoGoWarningContract {
*
*/
interface View : IView {
/**
* 展示VR下V2X预警弹窗
* 展示VR下V2X预警
*
* @param v2xType V2X类型
* @param alertMessage 提醒文本
*/
fun showWarningV2X(v2xType: Int, alertMessage: String?)
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String)
/**
* 关闭VR下V2X预警弹窗
* 关闭指定floatTag 的 VR下V2X预警弹窗
* @param tag 弹窗标识
*/
fun disableWarningV2X()
fun disableWarningV2X(tag: String)
/**
* 展示红绿灯预警

View File

@@ -22,11 +22,11 @@ class MoGoWarningFragment : MvpFragment<MoGoWarningContract.View?, WaringPresent
return WaringPresenter(this)
}
override fun showWarningV2X(v2xType: Int, alertMessage: String?) {
override fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String) {
WarningNotificationManager.show(activity)
}
override fun disableWarningV2X() {
override fun disableWarningV2X(tag: String) {
}

View File

@@ -10,12 +10,12 @@ class WaringPresenter(view: MoGoWarningContract.View?) :
Presenter<MoGoWarningContract.View?>(view) {
fun showWarningV2X(v2xType: Int, alertMessage: String?) {
mView?.showWarningV2X(v2xType, alertMessage)
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String) {
mView?.showWarningV2X(v2xType, alertMessage, tag)
}
fun disableWarningV2X() {
mView?.disableWarningV2X()
fun disableWarningV2X(tag: String) {
mView?.disableWarningV2X(tag)
}
fun showWarningTrafficLight(checkLightId: Int) {

View File

@@ -13,7 +13,13 @@ interface IMoGoWaringProvider : IMogoModuleProvider {
* @param v2xType V2X类型
* @param alertMessage 提醒文本
*/
fun showWarningV2X(v2xType: Int, alertMessage: String?)
fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String)
/**
* 关闭指定floatTag 的 VR下V2X预警弹窗
* @param tag 弹窗标识
*/
fun disableWarningV2X(tag: String)
/**
* 展示红绿灯预警