diff --git a/libraries/tanlulib/build.gradle b/libraries/tanlulib/build.gradle index 9cb0c7210b..8ade04975a 100644 --- a/libraries/tanlulib/build.gradle +++ b/libraries/tanlulib/build.gradle @@ -66,7 +66,7 @@ dependencies { implementation rootProject.ext.dependencies.arouter kapt rootProject.ext.dependencies.aroutercompiler - implementation rootProject.ext.dependencies.uploadroadinfo + implementation rootProject.ext.dependencies.mogoaicloudtanlu if (Boolean.valueOf(RELEASE)) { diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/MogoTanluApiProvider.java b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/MogoTanluApiProvider.java index 56b30bee6f..66ea04be90 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/MogoTanluApiProvider.java +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/MogoTanluApiProvider.java @@ -5,6 +5,8 @@ import android.util.ArrayMap; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.analytics.AnalyticsUtils; +import com.mogo.map.location.MogoLocation; +import com.mogo.module.common.MogoApisHandler; import com.mogo.service.share.IMogoTanluProvider; import com.mogo.service.share.TanluUploadParams; import com.mogo.utils.logger.Logger; @@ -38,9 +40,10 @@ public class MogoTanluApiProvider implements IMogoTanluProvider { properties.put("type", params.getEventType()); properties.put("from", params.getFromType()); AnalyticsUtils.track("v2x_share_type", properties); + MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation(); MainService.Companion.launchService(context, new UploadParams(params.getEventType(), params.getFromType(), params.getDuration(), params.getParentId(), - params.getLocation().lat, params.getLocation().lon)); + params.getLocation().lat, params.getLocation().lon, location.getAddress(), location.getBearing(), location.getAdCode(), location.getCityCode())); }else{ Logger.e(API_MODULE_NAME,"params为空,无法上报情报"); } diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt index 2f824402d2..159f420e5c 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt @@ -44,6 +44,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { private var mLatitude: Double = 0.0 private var mSpeed: Float = 0f + private var mAddress: String = "" + private var mDirection: Float = 0f + private var mAreaCode: String = "" + private var mCityCode: String = "" + + private var getVideoFailed: (() -> Unit)? = null private var interceptors: ArrayList = ArrayList(1) @@ -71,6 +77,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { zdCarCoderController.init() } + fun takePhoto( photoType: Int, cameraId: Int, @@ -81,7 +88,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType") this.mType = type @@ -90,6 +101,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + CustomStatusHandler.offerPhotoStatus(isCustom) zdCarCoderController.takePhoto(photoType, cameraId, haveVoice) trackGetPhoto(1) @@ -109,7 +125,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { fromType: String, longitude: Double, latitude: Double, - speed: Float + speed: Float, + address: String, + direction: Float, + areaCode: String, + cityCode: String ) { Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed") this.mType = type @@ -118,6 +138,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { this.mLongitude = longitude this.mLatitude = latitude this.mSpeed = speed + this.mAddress = address + this.mDirection = direction + this.mAreaCode = areaCode + this.mCityCode = cityCode + if (DebugConfig.getCarMachineType() == 0) { //自研车机 outputVideoPath = getCompressVideoPath() CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType)) @@ -130,8 +155,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { // } else { //失败了,传空地址,发起请求 val entity = TakeEntity(isCustom, id, fromType) - videoAndThumbMap["video"] = "" - videoAndThumbMap["thumb"] = "" +// videoAndThumbMap["video"] = "" +// videoAndThumbMap["thumb"] = "" // CosStatusController().sendInformationDirectly( // INFO_TYPE_VIDEO, diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt index 7ebddece68..46bc7c564d 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/MainService.kt @@ -76,6 +76,12 @@ class MainService : Service() { private var mLatitude: Double = 0.0 private lateinit var serviceApis: IMogoServiceApis + private var mAddress: String = "" + private var mDirection: Float = 0f + private var mAreaCode: String = "" + private var mCityCode: String = "" + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { //清理多媒体资源和sp策略数据 clearStrategyType(this) @@ -95,6 +101,11 @@ class MainService : Service() { mainInfoId = it.parentId mLongitude = it.lon mLatitude = it.lat + mAddress = it.addr + mDirection = it.direction + mAreaCode = it.areaCode + mCityCode = it.cityCode + Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ") if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) { // 如果是策略上报,isCustom = false @@ -274,7 +285,7 @@ class MainService : Service() { Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()) .subscribe { - CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) } // } @@ -292,7 +303,7 @@ class MainService : Service() { ) { Log.d("MainService", "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom") // if (isAuthorization(BaseApplication.getAppContext())) { - CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed) + CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode) // } postVideoAlarmTask(isInterval) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/UploadParams.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/UploadParams.kt index 3cd50e64a8..4dcef19944 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/UploadParams.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/UploadParams.kt @@ -3,14 +3,18 @@ package com.zhidao.roadcondition.service import android.os.Parcel import android.os.Parcelable -class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: Long, val lat: Double, val lon: Double) : Parcelable { +class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: Long, val lat: Double, val lon: Double,val addr:String,val direction:Float,val areaCode:String,val cityCode:String) : Parcelable { constructor(parcel: Parcel) : this( parcel.readString()!!, parcel.readString()!!, parcel.readInt(), parcel.readLong(), parcel.readDouble(), - parcel.readDouble() + parcel.readDouble(), + parcel.readString()!!, + parcel.readFloat(), + parcel.readString()!!, + parcel.readString()!! ) override fun writeToParcel(parcel: Parcel, flags: Int) { @@ -20,6 +24,10 @@ class UploadParams(val eventType: String, val fromType: String, val duration: In parcel.writeLong(parentId) parcel.writeDouble(lat) parcel.writeDouble(lon) + parcel.writeString(addr) + parcel.writeFloat(direction) + parcel.writeString(areaCode) + parcel.writeString(cityCode) } @@ -28,7 +36,7 @@ class UploadParams(val eventType: String, val fromType: String, val duration: In } override fun toString(): String { - return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId='$parentId', lat=$lat, lon=$lon)" + return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId=$parentId, lat=$lat, lon=$lon, addr='$addr', direction=$direction, areaCode='$areaCode', cityCode='$cityCode')" } diff --git a/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/entity/MogoSnapshotSetData.aidl b/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/entity/MogoSnapshotSetData.aidl deleted file mode 100644 index 52a9105824..0000000000 --- a/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/entity/MogoSnapshotSetData.aidl +++ /dev/null @@ -1,3 +0,0 @@ -// ShapshotSetData.aidl -package com.mogo.module.common.entity; -parcelable MogoSnapshotSetData; diff --git a/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/machinevision/IMachineVisionInterface.aidl b/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/machinevision/IMachineVisionInterface.aidl deleted file mode 100644 index c456abaca1..0000000000 --- a/modules/mogo-module-common/src/main/aidl/com/mogo/module/common/machinevision/IMachineVisionInterface.aidl +++ /dev/null @@ -1,14 +0,0 @@ -// IMachineVisionInterface.aidl -package com.mogo.module.common.machinevision; -import com.mogo.module.common.entity.MogoSnapshotSetData; - -// Declare any non-default types here with import statements - -interface IMachineVisionInterface { - - oneway void postData(in MogoSnapshotSetData data); - - oneway void hideViewIfExist(); - - oneway void showViewIfExist(); -} diff --git a/modules/mogo-module-share/build.gradle b/modules/mogo-module-share/build.gradle index ff0ca393b8..1c1221a11e 100644 --- a/modules/mogo-module-share/build.gradle +++ b/modules/mogo-module-share/build.gradle @@ -46,7 +46,7 @@ dependencies { kapt rootProject.ext.dependencies.aroutercompiler implementation rootProject.ext.dependencies.rxjava implementation rootProject.ext.dependencies.rxandroid - implementation rootProject.ext.dependencies.uploadroadinfo + implementation rootProject.ext.dependencies.mogoaicloudtanlu if (Boolean.valueOf(RELEASE)) { implementation rootProject.ext.dependencies.mogoutils diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java index 6707683ea8..ada9bed5b4 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java @@ -12,6 +12,8 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; +import com.mogo.cloud.tanlu.bean.MarkerExploreWay; +import com.mogo.cloud.tanlu.bean.location.MarkerLocation; import com.mogo.commons.voice.AIAssist; import com.mogo.map.MogoLatLng; import com.mogo.map.location.MogoLocation; @@ -31,8 +33,7 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener; import com.mogo.map.search.poisearch.MogoPoiResult; import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery; import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerLocation; +//import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.share.bean.VoiceCmdData; import com.mogo.module.share.bean.event.MarkerInfo; @@ -291,7 +292,7 @@ public class TanluManager implements IMogoMarkerClickListener, @Override public void onQueryRoadInfoSuccess(@NotNull List roadInfoList) { if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) { - if ( TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { speakFailVoice("未发现附近的特殊路况"); } else { speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); @@ -312,7 +313,7 @@ public class TanluManager implements IMogoMarkerClickListener, public void onQueryRoadInfoFail(@NotNull String msg, int code) { Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg); // speakFailVoice(searchfaileVoiceStrings[1]); - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { speakFailVoice("未发现附近的特殊路况"); } else { speakFailVoice("未发现" + mKeywords + "附近的特殊路况"); @@ -362,7 +363,8 @@ public class TanluManager implements IMogoMarkerClickListener, MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setBindObj(markerExploreWayList.get(i)); markerShowEntity.setTextContent(list.get(i).getAddr()); - markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation()); + + markerShowEntity.setMarkerLocation(getLocation(markerExploreWayList.get(i).getLocation())); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -381,6 +383,16 @@ public class TanluManager implements IMogoMarkerClickListener, //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据 } + private com.mogo.module.common.entity.MarkerLocation getLocation(MarkerLocation location) { + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); + markerLocation.setLat(location.getLat()); + markerLocation.setLon(location.getLon()); + markerLocation.setAddress(location.getAddress()); + markerLocation.setAngle(location.getAngle()); + + return markerLocation; + + } /** * marker动画 @@ -458,7 +470,7 @@ public class TanluManager implements IMogoMarkerClickListener, MogoLatLng latLon = poi.getPoint(); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---1---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -473,7 +485,7 @@ public class TanluManager implements IMogoMarkerClickListener, Logger.e(TAG, "poi == null"); Double longit; //经度 Double lat; //维度 - if (TextUtils.equals(mKeywords,"附近")) { + if (TextUtils.equals(mKeywords, "附近")) { Logger.d(TAG, "附近 -onPoiSearched---2---"); longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude(); lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude(); @@ -533,7 +545,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerExploreWay.setCityName(cityName); markerExploreWay.setPoiType(poiType); - MarkerLocation markerLocation = new MarkerLocation(); + com.mogo.module.common.entity.MarkerLocation markerLocation = new com.mogo.module.common.entity.MarkerLocation(); markerLocation.setLat(lat); markerLocation.setLon(lon); markerLocation.setAddress(address); @@ -542,6 +554,7 @@ public class TanluManager implements IMogoMarkerClickListener, markerShowEntity.setBindObj(markerExploreWay); markerShowEntity.setTextContent(address); markerShowEntity.setMarkerType(ShareConstants.MODEL_NAME); + markerShowEntity.setMarkerLocation(markerLocation); IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity); @@ -572,11 +585,11 @@ public class TanluManager implements IMogoMarkerClickListener, @Override public void onAnimEnd() { - UiThreadHandler.postDelayed( () -> { + UiThreadHandler.postDelayed(() -> { if (mogoAnimationMarker != null) { mogoAnimationMarker.destroy(); } - }, 1_200L ); + }, 1_200L); } }); } diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt index 8a1486b276..5c56223851 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/callback/RoadInfoCallback.kt @@ -1,5 +1,7 @@ package com.mogo.module.share.callback +//import com.mogo.module.common.entity.MarkerExploreWay + import com.mogo.cloud.tanlu.bean.MarkerExploreWay diff --git a/modules/mogo-modules-mvision/.gitignore b/modules/mogo-modules-mvision/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/modules/mogo-modules-mvision/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/modules/mogo-modules-mvision/build.gradle b/modules/mogo-modules-mvision/build.gradle deleted file mode 100644 index ebff9c6729..0000000000 --- a/modules/mogo-modules-mvision/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'com.alibaba.arouter' - -android { - compileSdkVersion rootProject.ext.android.compileSdkVersion - // buildToolsVersion rootProject.ext.android.buildToolsVersion - defaultConfig { - minSdkVersion rootProject.ext.android.minSdkVersion - targetSdkVersion rootProject.ext.android.targetSdkVersion - versionCode Integer.valueOf(VERSION_CODE) - versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION") - - javaCompileOptions { - annotationProcessorOptions { - arguments = [AROUTER_MODULE_NAME: project.getName()] - } - } - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles 'consumer-rules.pro' - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - targetCompatibility 1.8 - sourceCompatibility 1.8 - } - -} -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - implementation rootProject.ext.dependencies.androidxappcompat - implementation rootProject.ext.dependencies.androidxconstraintlayout - implementation rootProject.ext.dependencies.arouter - annotationProcessor rootProject.ext.dependencies.aroutercompiler - if (Boolean.valueOf(RELEASE)) { - api rootProject.ext.dependencies.mogomap - api rootProject.ext.dependencies.mogomapapi - api rootProject.ext.dependencies.mogoutils - api rootProject.ext.dependencies.mogocommons - api rootProject.ext.dependencies.mogoserviceapi - implementation rootProject.ext.dependencies.modulecommon - } else { - api project(":libraries:mogo-map") - api project(":libraries:mogo-map-api") - api project(":foudations:mogo-utils") - api project(":foudations:mogo-commons") - api project(':services:mogo-service-api') - implementation project(':modules:mogo-module-common') - } -} - -apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/modules/mogo-modules-mvision/consumer-rules.pro b/modules/mogo-modules-mvision/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/modules/mogo-modules-mvision/gradle.properties b/modules/mogo-modules-mvision/gradle.properties deleted file mode 100644 index d905dbfdd1..0000000000 --- a/modules/mogo-modules-mvision/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -GROUP=com.mogo.module -POM_ARTIFACT_ID=module-machine-vision -VERSION_CODE=1 diff --git a/modules/mogo-modules-mvision/proguard-rules.pro b/modules/mogo-modules-mvision/proguard-rules.pro deleted file mode 100644 index 481bb43481..0000000000 --- a/modules/mogo-modules-mvision/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/modules/mogo-modules-mvision/src/androidTest/java/com/mogo/module/machine/vision/ExampleInstrumentedTest.java b/modules/mogo-modules-mvision/src/androidTest/java/com/mogo/module/machine/vision/ExampleInstrumentedTest.java deleted file mode 100644 index 3b66fb5c01..0000000000 --- a/modules/mogo-modules-mvision/src/androidTest/java/com/mogo/module/machine/vision/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.mogo.module.machine.vision; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith( AndroidJUnit4.class ) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals( "com.mogo.module.machine.vision.test", appContext.getPackageName() ); - } -} \ No newline at end of file diff --git a/modules/mogo-modules-mvision/src/main/AndroidManifest.xml b/modules/mogo-modules-mvision/src/main/AndroidManifest.xml deleted file mode 100644 index 4188fe3b46..0000000000 --- a/modules/mogo-modules-mvision/src/main/AndroidManifest.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/IMogoMachineVisionProvider.java b/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/IMogoMachineVisionProvider.java deleted file mode 100644 index f87f55e13a..0000000000 --- a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/IMogoMachineVisionProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mogo.module.machine.vision; - -import com.mogo.service.module.IMogoModuleProvider; - -public -/** - * @author congtaowang - * @since 2020/10/27 - *

- * 描述 - */ -interface IMogoMachineVisionProvider extends IMogoModuleProvider { - - String path = "/machinevision/api"; -} diff --git a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapService.java b/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapService.java deleted file mode 100644 index 7bb820473b..0000000000 --- a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapService.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.mogo.module.machine.vision; - -import android.app.Service; -import android.content.Intent; -import android.content.ServiceConnection; -import android.os.IBinder; -import android.os.RemoteException; -import android.view.Gravity; -import android.view.View; -import android.view.WindowManager; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.mogo.module.common.entity.MogoSnapshotSetData; -import com.mogo.module.common.machinevision.IMachineVisionInterface; -import com.mogo.module.common.wm.WindowManagerView; -import com.mogo.utils.UiThreadHandler; -import com.mogo.utils.logger.Logger; - -public -/** - * @author congtaowang - * @since 2020/10/26 - * - * 描述 - */ -class MachineVisionMapService extends Service { - - private static final String TAG = "MachineVisionMapService"; - - private IBinder mBinder; - - private WindowManagerView mMachineVisionMapViewManager; - private View mRootView; - private View mClickView; - private MachineVisionMapView mMapView; - - @Nullable - @Override - public IBinder onBind( Intent intent ) { - mBinder = new MachineVisionMapServiceBinder(); - addMachineVisionMapView(); - Logger.d( TAG, "onBind" ); - return mBinder; - } - - @Override - public boolean onUnbind( Intent intent ) { - if ( mMachineVisionMapViewManager != null && mMachineVisionMapViewManager.isShowing() ) { - mMachineVisionMapViewManager.dismiss(); - } - MachineVisionMapViewHandler.getInstance().destroyMapView(); - mMachineVisionMapViewManager = null; - Logger.d( TAG, "onUnbind" ); - return true; - } - - @Override - public void onRebind( Intent intent ) { - super.onRebind( intent ); - addMachineVisionMapView(); - Logger.d( TAG, "onRebind" ); - } - - @Override - public void onCreate() { - super.onCreate(); - } - - public class MachineVisionMapServiceBinder extends IMachineVisionInterface.Stub { - - private static final String TAG = "MachineVisionMapServiceBinder"; - - @Override - public void postData( MogoSnapshotSetData data ) throws RemoteException { - Logger.d( TAG, "current Thread:%s", Thread.currentThread().getName() ); - MachineVisionMapViewHandler.getInstance().renderSnapshotSetData( data ); - } - - @Override - public void linkToDeath( @NonNull DeathRecipient recipient, int flags ) { - super.linkToDeath( recipient, flags ); - } - - @Override - public boolean unlinkToDeath( @NonNull DeathRecipient recipient, int flags ) { - return super.unlinkToDeath( recipient, flags ); - } - - @Override - public void hideViewIfExist() throws RemoteException { - if ( mRootView != null ) { - Logger.d( TAG, "hideViewIfExist" ); - UiThreadHandler.post( () -> { - if ( mRootView != null ) { - mRootView.setVisibility( View.GONE ); - } - } ); - } - } - - @Override - public void showViewIfExist() throws RemoteException { - if ( mRootView != null ) { - Logger.d( TAG, "showViewIfExist" ); - UiThreadHandler.post( () -> { - if ( mRootView != null ) { - mRootView.setVisibility( View.VISIBLE ); - } - } ); - } - } - } - - private boolean isSmall = true; - - private void addMachineVisionMapView() { - mMachineVisionMapViewManager = new WindowManagerView.Builder( getApplicationContext() ) - .contentView( R.layout.module_mvision_layout_view ) - .size( - WindowManager.LayoutParams.WRAP_CONTENT, - WindowManager.LayoutParams.WRAP_CONTENT - ) - .position( - getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_x ), - getResources().getDimensionPixelOffset( R.dimen.module_mvision_view_y ) - ) - .gravity( Gravity.TOP | Gravity.LEFT ) - .showInWindowManager(); - mRootView = mMachineVisionMapViewManager.findViewById( R.id.module_mvision_map_root ); - mClickView = mMachineVisionMapViewManager.findViewById(R.id.module_mvision_map_click); - mMapView = mMachineVisionMapViewManager.findViewById(R.id.module_mvision_map_view); - MachineVisionMapViewHandler.getInstance().setMachineVisionMapView( mMapView ); - mMachineVisionMapViewManager.show(); - - mClickView.setOnClickListener(v -> { - int width, height, x, y; - if (isSmall) { - // 变大 - isSmall = false; - width = getResources().getDimensionPixelSize(R.dimen.module_mvision_big_view_width); - height = getResources().getDimensionPixelSize(R.dimen.module_mvision_big_view_height); - x = getResources().getDimensionPixelSize(R.dimen.module_mvision_big_view_x); - y = getResources().getDimensionPixelSize(R.dimen.module_mvision_big_view_y); - }else{ - // 变小 - isSmall = true; - width = getResources().getDimensionPixelSize(R.dimen.module_mvision_view_width); - height = getResources().getDimensionPixelSize(R.dimen.module_mvision_view_height); - x = getResources().getDimensionPixelSize(R.dimen.module_mvision_view_x); - y = getResources().getDimensionPixelSize(R.dimen.module_mvision_view_y); - } - mRootView.getLayoutParams().width = width; - mRootView.getLayoutParams().height = height; - mRootView.setLayoutParams(mRootView.getLayoutParams()); - - mClickView.getLayoutParams().width = width; - mClickView.getLayoutParams().height = height; - mClickView.setLayoutParams(mClickView.getLayoutParams()); - - mMapView.getLayoutParams().width = width; - mMapView.getLayoutParams().height = height; - mMapView.setLayoutParams(mMapView.getLayoutParams()); - - mMachineVisionMapViewManager.exchangeSizeAndPosition(width, height, x, y); - Logger.d(TAG, "zoom out map view"); - }); - } - - @Override - public void onDestroy() { - super.onDestroy(); - MachineVisionMapViewHandler.getInstance().release(); - if ( mMachineVisionMapViewManager != null ) { - mMachineVisionMapViewManager.dismiss(); - mRootView = null; - mClickView = null; - mMapView = null; - } - } -} diff --git a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapView.java b/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapView.java deleted file mode 100644 index 6b70ef1b3b..0000000000 --- a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapView.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mogo.module.machine.vision; - -import android.content.Context; -import android.util.AttributeSet; - -import androidx.annotation.Nullable; - -import com.mogo.map.MogoBaseMapView; -import com.mogo.utils.logger.Logger; - -public -/** - * @author congtaowang - * @since 2020/10/26 - * - * 描述 - */ -class MachineVisionMapView extends MogoBaseMapView { - - private static final String TAG = "MachineVisionMapView"; - - public MachineVisionMapView( Context context ) { - this( context, null ); - } - - public MachineVisionMapView( Context context, @Nullable AttributeSet attrs ) { - this( context, attrs, 0 ); - } - - public MachineVisionMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { - super( context, attrs, defStyleAttr ); - } - - @Override - protected void addMapView( Context context ) { - Logger.d(TAG, "addMapView"); - } -} diff --git a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapViewHandler.java b/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapViewHandler.java deleted file mode 100644 index b918a60d6b..0000000000 --- a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MachineVisionMapViewHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.mogo.module.machine.vision; - -import com.mogo.module.common.drawer.SnapshotSetDataDrawer; -import com.mogo.module.common.entity.MogoSnapshotSetData; - -public -/** - * @author congtaowang - * @since 2020/10/27 - * - * 描述 - */ -class MachineVisionMapViewHandler { - - private static volatile MachineVisionMapViewHandler sInstance; - - private MachineVisionMapViewHandler() { - } - - public static MachineVisionMapViewHandler getInstance() { - if ( sInstance == null ) { - synchronized ( MachineVisionMapViewHandler.class ) { - if ( sInstance == null ) { - sInstance = new MachineVisionMapViewHandler(); - } - } - } - return sInstance; - } - - public synchronized void release() { - sInstance = null; - mMachineVisionMapView = null; - } - - private Object readResolve() { - // 阻止反序列化,必须实现 Serializable 接口 - return sInstance; - } - - private MachineVisionMapView mMachineVisionMapView; - - public void setMachineVisionMapView( MachineVisionMapView mMachineVisionMapView ) { - this.mMachineVisionMapView = mMachineVisionMapView; - } - - public void destroyMapView(){ - if ( mMachineVisionMapView != null ) { - mMachineVisionMapView.onDestroy(); - } - } - - public void renderSnapshotSetData( MogoSnapshotSetData data ) { - if ( data == null ) { - return; - } - if ( mMachineVisionMapView == null ) { - return; - } - SnapshotSetDataDrawer.getInstance().renderSnapshotData( data, true ); - } -} diff --git a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MogoMachineVisionProvider.java b/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MogoMachineVisionProvider.java deleted file mode 100644 index a33c945ccc..0000000000 --- a/modules/mogo-modules-mvision/src/main/java/com/mogo/module/machine/vision/MogoMachineVisionProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.mogo.module.machine.vision; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; - -import com.alibaba.android.arouter.facade.annotation.Route; -import com.mogo.commons.AbsMogoApplication; - -public -/** - * @author congtaowang - * @since 2020/10/27 - * - * 描述 - */ -@Route( path = IMogoMachineVisionProvider.path) -class MogoMachineVisionProvider implements IMogoMachineVisionProvider { - - private static final String TAG = "MogoMachineVisionProvider"; - - private Intent mMachineVisionServiceIntent; - - @Override - public Fragment createFragment( Context context, Bundle data ) { - return null; - } - - @Override - public View createView( Context context ) { - return null; - } - - @NonNull - @Override - public String getModuleName() { - return null; - } - - @Override - public int getType() { - return 0; - } - - @Override - public void init( Context context ) { - mMachineVisionServiceIntent = new Intent( context, MachineVisionMapService.class ); - context.startService( mMachineVisionServiceIntent ); - } - - @Override - public void onDestroy() { - if ( mMachineVisionServiceIntent != null ) { - AbsMogoApplication.getApp().stopService( mMachineVisionServiceIntent ); - } - } -} diff --git a/modules/mogo-modules-mvision/src/main/res/layout/module_mvision_layout_view.xml b/modules/mogo-modules-mvision/src/main/res/layout/module_mvision_layout_view.xml deleted file mode 100644 index ca3cd5c8a5..0000000000 --- a/modules/mogo-modules-mvision/src/main/res/layout/module_mvision_layout_view.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/modules/mogo-modules-mvision/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-modules-mvision/src/main/res/values-xhdpi/dimens.xml deleted file mode 100644 index d7917ae5cf..0000000000 --- a/modules/mogo-modules-mvision/src/main/res/values-xhdpi/dimens.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - 460px - 460px - 204px - 368px - - 0px - 0px - 1920px - 1080px - \ No newline at end of file diff --git a/modules/mogo-modules-mvision/src/test/java/com/mogo/module/machine/vision/ExampleUnitTest.java b/modules/mogo-modules-mvision/src/test/java/com/mogo/module/machine/vision/ExampleUnitTest.java deleted file mode 100644 index fefd93d5cd..0000000000 --- a/modules/mogo-modules-mvision/src/test/java/com/mogo/module/machine/vision/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.module.machine.vision; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals( 4, 2 + 2 ); - } -} \ No newline at end of file