diff --git a/OCH/mogo-och-bus-passenger/.gitignore b/OCH/mogo-och-bus-passenger/.gitignore new file mode 100644 index 0000000000..42afabfd2a --- /dev/null +++ b/OCH/mogo-och-bus-passenger/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/build.gradle b/OCH/mogo-och-bus-passenger/build.gradle new file mode 100644 index 0000000000..b38804a63d --- /dev/null +++ b/OCH/mogo-och-bus-passenger/build.gradle @@ -0,0 +1,73 @@ +apply plugin: 'com.android.library' +apply plugin: 'com.alibaba.arouter' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +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") + + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + + javaCompileOptions { + annotationProcessorOptions { + arguments = [AROUTER_MODULE_NAME: project.getName()] + } + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + buildTypes { + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + debug { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation rootProject.ext.dependencies.kotlinstdlibjdk7 + implementation rootProject.ext.dependencies.androidxappcompat + implementation rootProject.ext.dependencies.arouter + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'com.google.android.material:material:1.2.1' + annotationProcessor rootProject.ext.dependencies.aroutercompiler + implementation rootProject.ext.dependencies.rxandroid + implementation rootProject.ext.dependencies.androidxconstraintlayout + implementation rootProject.ext.dependencies.amapnavi3dmap + if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { + implementation rootProject.ext.dependencies.mogoutils + implementation rootProject.ext.dependencies.mogocommons + implementation rootProject.ext.dependencies.modulecommon + implementation rootProject.ext.dependencies.mogo_core_data + implementation rootProject.ext.dependencies.mogo_core_function_call + implementation rootProject.ext.dependencies.mogo_core_function_v2x + }else { + implementation project(":core:mogo-core-utils") + implementation project(":foudations:mogo-commons") + implementation project(':modules:mogo-module-common') + implementation project(':core:mogo-core-data') + implementation project(':core:mogo-core-function-call') + implementation project(':core:function-impl:mogo-core-function-v2x') + } +} + +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/consumer-rules.pro b/OCH/mogo-och-bus-passenger/consumer-rules.pro new file mode 100644 index 0000000000..e69de29bb2 diff --git a/OCH/mogo-och-bus-passenger/gradle.properties b/OCH/mogo-och-bus-passenger/gradle.properties new file mode 100644 index 0000000000..2ed1ed2f42 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/gradle.properties @@ -0,0 +1,3 @@ +GROUP=com.mogo.och +POM_ARTIFACT_ID=och-bus-passenger +VERSION_CODE=1 diff --git a/OCH/mogo-och-bus-passenger/proguard-rules.pro b/OCH/mogo-och-bus-passenger/proguard-rules.pro new file mode 100644 index 0000000000..481bb43481 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/proguard-rules.pro @@ -0,0 +1,21 @@ +# 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/OCH/mogo-och-bus-passenger/src/androidTest/java/com/mogo/och/bus/passenger/ExampleInstrumentedTest.java b/OCH/mogo-och-bus-passenger/src/androidTest/java/com/mogo/och/bus/passenger/ExampleInstrumentedTest.java new file mode 100644 index 0000000000..2685ade0a4 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/androidTest/java/com/mogo/och/bus/passenger/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.mogo.och.bus.passenger; + +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.och.bus.passenger.test", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/main/AndroidManifest.xml b/OCH/mogo-och-bus-passenger/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..e0687231c1 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/IMogoOCH.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/IMogoOCH.java new file mode 100644 index 0000000000..fb146e17c3 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/IMogoOCH.java @@ -0,0 +1,22 @@ +package com.mogo.och.bus.passenger; + +import androidx.annotation.IdRes; +import androidx.fragment.app.FragmentActivity; + +import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider; + +/** + * 网约车抽象接口 + * + * Created on 2022/3/29 + */ +interface IMogoOCH extends IMoGoFunctionProvider { + + /** + * 初始化网约车容器 + * + * @param activity + * @param containerId 容器ID + */ + void createCoverage(FragmentActivity activity, @IdRes int containerId); +} diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java new file mode 100644 index 0000000000..83725660cb --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java @@ -0,0 +1,89 @@ +package com.mogo.och.bus.passenger; + +import android.content.Context; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.elegant.utils.UiThreadHandler; +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; +import com.mogo.map.MogoMapUIController; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.och.bus.passenger.constant.BusPassengerConst; +import com.mogo.service.statusmanager.IMogoStatusChangedListener; +import com.mogo.service.statusmanager.StatusDescriptor; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P; + +/** + * 网约车-Bus-乘客端 + * + * Created on 2022/3/29 + */ +@Route(path = BusPassengerConst.PATH) +public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener { + private static final String TAG = MogoOCHBusPassenger.class.getSimpleName(); + + private FragmentActivity mActivity; + private int mContainerId; + + @Override + public void createCoverage(FragmentActivity activity, int containerId) { + + } + + @Nullable + @Override + public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) { + this.mActivity = activity; + this.mContainerId = containerId; + + UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L); + return null; + } + + @NotNull + @Override + public String getFunctionName() { + return null; + } + + @Override + public void onDestroy() { + // 若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠 + if (mActivity == null) return; + mActivity.finish(); + } + + @Override + public void init(Context context) { + MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus" + , StatusDescriptor.VR_MODE, this); + MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus" + , StatusDescriptor.TOP_VIEW, this); + } + + @Override + public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + if (descriptor == StatusDescriptor.VR_MODE){ + if (isTrue){ + + }else { + + } + } + } + + /** + * 进入鹰眼模式,设置手势缩放地图失效 + */ + private void stepIntoVrMode() { + CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "进入vr模式" ); + MogoMapUIController.getInstance() + .openVrMode( false ); + } +} diff --git a/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt new file mode 100644 index 0000000000..b3515af9ba --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/main/java/com/mogo/och/bus/passenger/constant/BusPassengerConst.kt @@ -0,0 +1,28 @@ +package com.mogo.och.bus.passenger.constant + +import com.mogo.commons.debug.DebugConfig + +/** + * Created on 2021/12/6 + */ +class BusPassengerConst { + companion object { + + private const val BASE_URL_OCH_DEV = "http://tech-dev.zhidaohulian.com" + private const val BASE_URL_OCH_QA = "https://tech-qa.zhidaohulian.com" + private const val BASE_URL_OCH_RELEASE = "https://tech.zhidaohulian.com" + + @JvmStatic + fun getBaseUrl(): String { + return when (DebugConfig.getNetMode()) { + DebugConfig.NET_MODE_DEV, DebugConfig.NET_MODE_DEMO -> BASE_URL_OCH_DEV + DebugConfig.NET_MODE_QA -> BASE_URL_OCH_QA + DebugConfig.NET_MODE_RELEASE -> BASE_URL_OCH_RELEASE + else -> BASE_URL_OCH_RELEASE + } + } + + // OCH arouter 路由path + const val PATH = "/och/api" + } +} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/test/java/com/mogo/och/bus/passenger/ExampleUnitTest.java b/OCH/mogo-och-bus-passenger/src/test/java/com/mogo/och/bus/passenger/ExampleUnitTest.java new file mode 100644 index 0000000000..a0652d588f --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/test/java/com/mogo/och/bus/passenger/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.mogo.och.bus.passenger; + +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 diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxi.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxiPassenger.java similarity index 95% rename from OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxi.java rename to OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxiPassenger.java index cb96b48ac4..5675c85b9c 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxi.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/MogoOCHTaxiPassenger.java @@ -25,12 +25,12 @@ public * @author congtaowang * @since 2021/1/15 *

- * 网约车-出租车 + * 网约车-出租车-乘客端 */ @Route( path = TaxiPassengerConst.PATH ) -class MogoOCHTaxi implements IMogoOCH, IMogoStatusChangedListener { +class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener { - private static final String TAG = "MogoOCHTaxi"; + private static final String TAG = "MogoOCHTaxiPassenger"; private TaxiPassengerBaseFragment ochTaxiPassengerFragment; private FragmentActivity mActivity; private int mContainerId; diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/OCHTaxiOverlayManager.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/OCHTaxiOverlayManager.java deleted file mode 100644 index ed9e0bc0f7..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/OCHTaxiOverlayManager.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.mogo.och.taxi.passenger; - -import android.content.Context; - -import com.mogo.eagle.core.data.map.MogoLatLng; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.v2x.events.utils.LocationUtils; -import com.mogo.eagle.core.utilcode.util.ColorUtils; -import com.mogo.map.MogoOverlayManager; -import com.mogo.map.overlay.IMogoOverlayManager; -import com.mogo.map.overlay.IMogoPolyline; -import com.mogo.map.overlay.MogoPolylineOptions; -import com.mogo.module.common.MogoApisHandler; -import java.util.ArrayList; -import java.util.List; - -public class OCHTaxiOverlayManager { - - - private IMogoPolyline mMoGoPolyline; - // 连接线参数 - private MogoPolylineOptions mPolylineOptions; - // 线路径集合 - private List mPolylinePointList; - // 渐变色 - private List mPolylineColors; - private Context mContext; - IMogoOverlayManager mogoOverlayManager; - public OCHTaxiOverlayManager(Context context) { - mPolylineOptions = new MogoPolylineOptions(); - // 绘制路径集合 - mPolylinePointList = new ArrayList<>(); - // 引导线颜色 - mPolylineColors = new ArrayList<>(); - mContext = context; - mogoOverlayManager = MogoOverlayManager.getInstance(); - } - - /** - * 绘制最优路线 - * - * @param polylinePoint 要绘制的经纬度度集合 - */ - public IMogoPolyline draw(MogoLocation carLocal, List polylinePoint) { - if (mMoGoPolyline != null) { - mMoGoPolyline.remove(); - mPolylinePointList.clear(); - mPolylineColors.clear(); - } - if (polylinePoint != null) { - - // 将当前车辆位置放进去 - mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude())); - // 过滤后台推送的推荐路线集合 - for (MogoLatLng polyline : polylinePoint) { - //需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃 - if (LocationUtils.isPointOnCarFront(carLocal, polyline)) { - mPolylinePointList.add(polyline); - } - } - mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size())); - // 替换路径集合 - mPolylineOptions.points(mPolylinePointList); - // 线条粗细,渐变,渐变色值 - mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors); - // 绘制线 - mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions); - } - return mMoGoPolyline; - } - -} diff --git a/app/functions/och.gradle b/app/functions/och.gradle index 301d25a9cf..fa05f78b8f 100644 --- a/app/functions/och.gradle +++ b/app/functions/och.gradle @@ -61,7 +61,7 @@ project.dependencies { } // Bus乘客端 - fPadLenovoOchBusPassengerImplementation (project(':OCH:mogo-och-bus')) { + fPadLenovoOchBusPassengerImplementation (project(':OCH:mogo-och-bus-passenger')) { exclude group: 'com.mogo.commons' //by group exclude group: 'com.mogo.module' //by group exclude group: 'com.mogo.map' //by group diff --git a/app/productFlavors/fPadLenovoOchBusPassenger.gradle b/app/productFlavors/fPadLenovoOchBusPassenger.gradle index 74487113d3..963ba6b66b 100644 --- a/app/productFlavors/fPadLenovoOchBusPassenger.gradle +++ b/app/productFlavors/fPadLenovoOchBusPassenger.gradle @@ -26,8 +26,8 @@ project.android.productFlavors { // GPS数据提供源: 0-Android系统,1-工控机,2-OBU buildConfigField 'int', 'GPS_PROVIDER', "1" - // 构建的应用身份类型,出租车0|小巴A-司机0|乘客1 - buildConfigField 'int', 'APP_IDENTITY_MODE', "0xA1" + // 构建的应用身份类型,出租车0|小巴A-司机0|乘客1 (注:20220330 bus passengerv1.0.0实际是做为车上单屏司机端使用) + buildConfigField 'int', 'APP_IDENTITY_MODE', "0xA0" // 连接的工控机IP地址 buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.103\"" // 构建的是否是演示(美化)模式 diff --git a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt index d809d41149..cfc0e863ff 100644 --- a/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt +++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/logger/scene/SceneConstant.kt @@ -29,11 +29,12 @@ class SceneConstant { //小巴车 const val M_BUS = "M_BUS_" + //小巴车乘客屏 + const val M_BUS_P = "M_BUS_P" //出租车 const val M_TAXI = "M_TAXI_" //出租车乘客屏 const val M_TAXI_P = "M_TAXI_P" - } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 391339c25e..d3520d33ff 100644 --- a/settings.gradle +++ b/settings.gradle @@ -81,9 +81,9 @@ include ':test:crashreport-apmbyte' //OCH 业务模块 include ':OCH:mogo-och-bus' +include ':OCH:mogo-och-bus-passenger' include ':OCH:mogo-och-taxi' include ':OCH:mogo-och-taxi-passenger' include ':OCH:mogo-och-noop' -