[BusPassenger v1.0.0]Bus乘客端module init(v1.0.0实际在单屏车上做为司机端使用,APP_IDENTITY_MODE暂改为0xA0)
This commit is contained in:
1
OCH/mogo-och-bus-passenger/.gitignore
vendored
Normal file
1
OCH/mogo-och-bus-passenger/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
73
OCH/mogo-och-bus-passenger/build.gradle
Normal file
73
OCH/mogo-och-bus-passenger/build.gradle
Normal file
@@ -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()
|
||||
0
OCH/mogo-och-bus-passenger/consumer-rules.pro
Normal file
0
OCH/mogo-och-bus-passenger/consumer-rules.pro
Normal file
3
OCH/mogo-och-bus-passenger/gradle.properties
Normal file
3
OCH/mogo-och-bus-passenger/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-bus-passenger
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och-bus-passenger/proguard-rules.pro
vendored
Normal file
21
OCH/mogo-och-bus-passenger/proguard-rules.pro
vendored
Normal file
@@ -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
|
||||
@@ -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 <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.och.bus.passenger.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
5
OCH/mogo-och-bus-passenger/src/main/AndroidManifest.xml
Normal file
5
OCH/mogo-och-bus-passenger/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.bus.passenger">
|
||||
|
||||
</manifest>
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,12 @@ public
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
* <p>
|
||||
* 网约车-出租车
|
||||
* 网约车-出租车-乘客端
|
||||
*/
|
||||
@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;
|
||||
@@ -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<MogoLatLng> mPolylinePointList;
|
||||
// 渐变色
|
||||
private List<Integer> 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<MogoLatLng> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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\""
|
||||
// 构建的是否是演示(美化)模式
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user