This commit is contained in:
lixiaopeng
2021-02-23 14:59:16 +08:00
parent b9b4b8d2e6
commit 6891d97505
20 changed files with 12 additions and 530 deletions

View File

@@ -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)) {

View File

@@ -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<TakePhotoInterceptor> = ArrayList(1)
@@ -130,8 +136,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,

View File

@@ -1,3 +1,3 @@
// ShapshotSetData.aidl
package com.mogo.module.common.entity;
package com.mogo.realtime.entity;
parcelable MogoSnapshotSetData;

View File

@@ -1,6 +1,6 @@
// IMachineVisionInterface.aidl
package com.mogo.module.common.machinevision;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.realtime.entity.MogoSnapshotSetData;
// Declare any non-default types here with import statements

View File

@@ -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

View File

@@ -1 +0,0 @@
/build

View File

@@ -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()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-machine-vision
VERSION_CODE=1

View File

@@ -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

View File

@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@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() );
}
}

View File

@@ -1,10 +0,0 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.machine.vision">
<application>
<service
android:name=".MachineVisionMapService"
android:exported="false"
android:process=":machinevision" />
</application>
</manifest>

View File

@@ -1,15 +0,0 @@
package com.mogo.module.machine.vision;
import com.mogo.service.module.IMogoModuleProvider;
public
/**
* @author congtaowang
* @since 2020/10/27
* <p>
* 描述
*/
interface IMogoMachineVisionProvider extends IMogoModuleProvider {
String path = "/machinevision/api";
}

View File

@@ -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;
}
}
}

View File

@@ -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");
}
}

View File

@@ -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 );
}
}

View File

@@ -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 );
}
}
}

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/module_mvision_map_root"
android:layout_width="@dimen/module_mvision_view_width"
android:layout_height="@dimen/module_mvision_view_height">
<com.mogo.module.machine.vision.MachineVisionMapView
android:id="@+id/module_mvision_map_view"
android:layout_width="@dimen/module_mvision_view_width"
android:layout_height="@dimen/module_mvision_view_height" />
<FrameLayout
android:layout_width="@dimen/module_mvision_view_width"
android:layout_height="@dimen/module_mvision_view_height"
android:id="@+id/module_mvision_map_click" />
</FrameLayout>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_mvision_view_width">460px</dimen>
<dimen name="module_mvision_view_height">460px</dimen>
<dimen name="module_mvision_view_x">204px</dimen>
<dimen name="module_mvision_view_y">368px</dimen>
<dimen name="module_mvision_big_view_x">0px</dimen>
<dimen name="module_mvision_big_view_y">0px</dimen>
<dimen name="module_mvision_big_view_width">1920px</dimen>
<dimen name="module_mvision_big_view_height">1080px</dimen>
</resources>

View File

@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals( 4, 2 + 2 );
}
}