[Delete]och,增加maven依赖
Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
# 网约车(Online Car Hailing)
|
||||
|
||||
## 小巴
|
||||
|
||||
## 出租车
|
||||
|
||||
## 无实现
|
||||
1
OCH/mogo-och-bus/.gitignore
vendored
1
OCH/mogo-och-bus/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,71 +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")
|
||||
|
||||
|
||||
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 {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogooch
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
} else {
|
||||
implementation project(":OCH:mogo-och")
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":modules:mogo-module-common")
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-bus
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och-bus/proguard-rules.pro
vendored
21
OCH/mogo-och-bus/proguard-rules.pro
vendored
@@ -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
|
||||
@@ -1,15 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.bus">
|
||||
|
||||
<application>
|
||||
<!--这里是为了测试增加的广播-->
|
||||
<receiver android:name=".receiver.TestOchBusBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.bus.test_control" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.mogo.och.bus;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.OCHConstants;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 网约车小巴业务实现入口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = OCHConstants.PATH)
|
||||
public class OchBusProvider implements IMoGoFunctionProvider {
|
||||
private static final String TAG = "OchBusProvider";
|
||||
private OchBusFragment busFragment;
|
||||
private int containerId;
|
||||
private FragmentActivity activity;
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
private void stepIntoVrMode(){
|
||||
Logger.d( TAG, "进入vr模式" );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
.openVrMode(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.VR_MODE, statusChangedListener);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.TOP_VIEW, statusChangedListener);
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (busFragment == null) {
|
||||
Logger.d(TAG, "准备add fragment======");
|
||||
busFragment = new OchBusFragment();
|
||||
activity.getSupportFragmentManager().beginTransaction().add(containerId, busFragment).commit();
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "准备show fragment");
|
||||
activity.getSupportFragmentManager().beginTransaction().show(busFragment).commit();
|
||||
}
|
||||
|
||||
private void hideFragment() {
|
||||
if (busFragment != null) {
|
||||
Logger.d(TAG, "准备hide fragment");
|
||||
activity.getSupportFragmentManager().beginTransaction().hide(busFragment).commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final IMogoStatusChangedListener statusChangedListener = (descriptor, isTrue) -> {
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
// 进入vr模式默认显示网约车小巴fragment
|
||||
if (isTrue) {
|
||||
showFragment();
|
||||
} else {
|
||||
hideFragment();
|
||||
}
|
||||
} else if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && descriptor == StatusDescriptor.TOP_VIEW) {
|
||||
// topView进行展示时推出网约车界面,但是不隐藏整个fragment
|
||||
if (busFragment != null && isTrue) {
|
||||
busFragment.hideOchBus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) {
|
||||
this.containerId = containerId;
|
||||
this.activity = activity;
|
||||
|
||||
UiThreadHandler.postDelayed(this::stepIntoVrMode, 5_000L );
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package com.mogo.och.bus.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.och.bus.view.VerticalDashLineView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Station Panel 中的车站列表adapter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusStationAdapter extends RecyclerView.Adapter<OchBusStationAdapter.ViewHolder> {
|
||||
private final Context context;
|
||||
private final List<OchBusStation> stationList = new ArrayList<>();
|
||||
private int currentStation;
|
||||
|
||||
public OchBusStationAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void refreshStationList(List<OchBusStation> stationList) {
|
||||
this.stationList.clear();
|
||||
this.stationList.addAll(stationList);
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation station = stationList.get(i);
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING || station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPPED ) {
|
||||
currentStation = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_och_bus_station, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
// Logger.d("OchBusStationAdapter", "position: " + position + " currPos: " + currentStation + " station: " + stationList.get(position));
|
||||
holder.tvStationName.setText(stationList.get(position).getSiteName());
|
||||
if (position == currentStation) {
|
||||
if (currentStation == 0) {
|
||||
// 在起始点
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arrived_station);
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
|
||||
} else {
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_current_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arriving_station);
|
||||
holder.vDashTop.setGradient(context.getResources().getColor(R.color.module_mogo_och_bus_arriving_start_dash_color), context.getResources().getColor(R.color.module_mogo_och_bus_arriving_end_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
|
||||
}
|
||||
} else if (position < currentStation) {
|
||||
// 驶过
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_icon_arrived_station);
|
||||
if (position == currentStation - 1) {
|
||||
holder.vDashBottom.setGradient(context.getResources().getColor(R.color.module_mogo_och_bus_leaving_start_dash_color), context.getResources().getColor(R.color.module_mogo_och_bus_leaving_end_dash_color));
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
|
||||
} else {
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_arrived_dash_color));
|
||||
}
|
||||
} else {
|
||||
holder.tvStationName.setTextColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_station_name_text_color));
|
||||
holder.ivIcon.setImageResource(R.drawable.module_mogo_och_bus_icon_not_arrive_station);
|
||||
holder.vDashTop.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
|
||||
holder.vDashBottom.setColor(context.getResources().getColor(R.color.module_mogo_och_bus_not_arrive_dash_color));
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
holder.tvStationNotice.setText("起点");
|
||||
holder.tvStationNotice.setVisibility(View.VISIBLE);
|
||||
holder.vDashTop.setVisibility(View.GONE);
|
||||
holder.vDashBottom.setVisibility(View.VISIBLE);
|
||||
} else if (position == getItemCount() - 1) {
|
||||
holder.tvStationNotice.setText("终点");
|
||||
holder.tvStationNotice.setVisibility(View.VISIBLE);
|
||||
holder.vDashTop.setVisibility(View.VISIBLE);
|
||||
holder.vDashBottom.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.tvStationNotice.setVisibility(View.GONE);
|
||||
holder.vDashTop.setVisibility(View.VISIBLE);
|
||||
holder.vDashBottom.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return stationList.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ivIcon;
|
||||
TextView tvStationName;
|
||||
TextView tvStationNotice;
|
||||
VerticalDashLineView vDashBottom, vDashTop;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ivIcon = itemView.findViewById(R.id.module_mogo_och_bus_station_icon);
|
||||
tvStationName = itemView.findViewById(R.id.module_mogo_och_bus_station_name);
|
||||
tvStationNotice = itemView.findViewById(R.id.module_mogo_och_bus_station_notice);
|
||||
vDashTop = itemView.findViewById(R.id.module_mogo_och_bus_station_top_dash);
|
||||
vDashBottom = itemView.findViewById(R.id.module_mogo_och_bus_station_bottom_dash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
* <p>
|
||||
* 小巴达到站点,推送需要下车的乘客列表
|
||||
*/
|
||||
class OchBusArriveAtStationMsg {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 公交驶离车站,同步服务端请求参数封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusLeaveStationRequest {
|
||||
private final String sn;
|
||||
private final int siteId;
|
||||
|
||||
public OchBusLeaveStationRequest(String sn, int siteId) {
|
||||
this.sn = sn;
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class OchBusOperationStatusRequest {
|
||||
|
||||
public String sn;
|
||||
// 0 - 关闭、1 - 启动
|
||||
public String status;
|
||||
|
||||
public OchBusOperationStatusRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
}
|
||||
|
||||
public OchBusOperationStatusRequest shutdown() {
|
||||
status = "0";
|
||||
return this;
|
||||
}
|
||||
|
||||
public OchBusOperationStatusRequest launch() {
|
||||
status = "1";
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class OchBusOperationStatusResponse extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String id;
|
||||
public String sn;
|
||||
public String areaCode;
|
||||
public String plateNumber;
|
||||
public int status;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
* <p>
|
||||
* 小巴订单
|
||||
*/
|
||||
class OchBusOrder {
|
||||
|
||||
/**
|
||||
* _id : bf014b186a0d417e8086f324e5cbcd1d
|
||||
* orderNo : XB20210324000002
|
||||
* orderType : 10
|
||||
* userName : 星期一
|
||||
* userPhone : 15555555555
|
||||
* startStationId : 1
|
||||
* startStation : 万集东门站
|
||||
* startStationCoordinate : [116.7354579447,40.1974932972]
|
||||
* endStationId : 2
|
||||
* endStation : 顺密路口站
|
||||
* endStationCoordinate : [116.7215386924,40.194019209]
|
||||
* orderDispatchType : 1
|
||||
* carNum : 京NB007
|
||||
* sn : F803BB2037EZD00088
|
||||
* orderStartTime : Mar 24, 2021 12:51:51 PM
|
||||
* orderEndTime : Mar 24, 2021 1:38:13 PM
|
||||
* cityCode : 010
|
||||
* areaCode : 1001
|
||||
* createTime : Mar 24, 2021 12:51:51 PM
|
||||
* updateTime : Mar 24, 2021 1:38:13 PM
|
||||
* travelDistance : 1.2
|
||||
*/
|
||||
|
||||
private String _id;
|
||||
private String orderNo;
|
||||
private int orderType;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private int startStationId;
|
||||
private String startStation;
|
||||
private int endStationId;
|
||||
private String endStation;
|
||||
private int orderDispatchType;
|
||||
private String carNum;
|
||||
private String sn;
|
||||
private String orderStartTime;
|
||||
private String orderEndTime;
|
||||
private String cityCode;
|
||||
private String areaCode;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
private double travelDistance;
|
||||
private List< Double > startStationCoordinate;
|
||||
private List< Double > endStationCoordinate;
|
||||
|
||||
public String get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public void set_id( String _id ) {
|
||||
this._id = _id;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo( String orderNo ) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOrderType( int orderType ) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName( String userName ) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone( String userPhone ) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public int getStartStationId() {
|
||||
return startStationId;
|
||||
}
|
||||
|
||||
public void setStartStationId( int startStationId ) {
|
||||
this.startStationId = startStationId;
|
||||
}
|
||||
|
||||
public String getStartStation() {
|
||||
return startStation;
|
||||
}
|
||||
|
||||
public void setStartStation( String startStation ) {
|
||||
this.startStation = startStation;
|
||||
}
|
||||
|
||||
public int getEndStationId() {
|
||||
return endStationId;
|
||||
}
|
||||
|
||||
public void setEndStationId( int endStationId ) {
|
||||
this.endStationId = endStationId;
|
||||
}
|
||||
|
||||
public String getEndStation() {
|
||||
return endStation;
|
||||
}
|
||||
|
||||
public void setEndStation( String endStation ) {
|
||||
this.endStation = endStation;
|
||||
}
|
||||
|
||||
public int getOrderDispatchType() {
|
||||
return orderDispatchType;
|
||||
}
|
||||
|
||||
public void setOrderDispatchType( int orderDispatchType ) {
|
||||
this.orderDispatchType = orderDispatchType;
|
||||
}
|
||||
|
||||
public String getCarNum() {
|
||||
return carNum;
|
||||
}
|
||||
|
||||
public void setCarNum( String carNum ) {
|
||||
this.carNum = carNum;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn( String sn ) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getOrderStartTime() {
|
||||
return orderStartTime;
|
||||
}
|
||||
|
||||
public void setOrderStartTime( String orderStartTime ) {
|
||||
this.orderStartTime = orderStartTime;
|
||||
}
|
||||
|
||||
public String getOrderEndTime() {
|
||||
return orderEndTime;
|
||||
}
|
||||
|
||||
public void setOrderEndTime( String orderEndTime ) {
|
||||
this.orderEndTime = orderEndTime;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode( String areaCode ) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime( String createTime ) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime( String updateTime ) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public double getTravelDistance() {
|
||||
return travelDistance;
|
||||
}
|
||||
|
||||
public void setTravelDistance( double travelDistance ) {
|
||||
this.travelDistance = travelDistance;
|
||||
}
|
||||
|
||||
public List< Double > getStartStationCoordinate() {
|
||||
return startStationCoordinate;
|
||||
}
|
||||
|
||||
public void setStartStationCoordinate( List< Double > startStationCoordinate ) {
|
||||
this.startStationCoordinate = startStationCoordinate;
|
||||
}
|
||||
|
||||
public List< Double > getEndStationCoordinate() {
|
||||
return endStationCoordinate;
|
||||
}
|
||||
|
||||
public void setEndStationCoordinate( List< Double > endStationCoordinate ) {
|
||||
this.endStationCoordinate = endStationCoordinate;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 重置车站状态请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusResetRequest {
|
||||
private String sn;
|
||||
private int siteId;
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
public OchBusResetRequest(String sn, int siteId, double lat, double lon) {
|
||||
this.sn = sn;
|
||||
this.siteId = siteId;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线请求参数封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusRoutesRequest {
|
||||
double lat;
|
||||
double lon;
|
||||
String sn;
|
||||
|
||||
public OchBusRoutesRequest(String sn, double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusRoutesResponse extends BaseData {
|
||||
private OchBusRoutesResult result;
|
||||
|
||||
public OchBusRoutesResult getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(OchBusRoutesResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResponse{" +
|
||||
"result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusRoutesResult {
|
||||
private List<OchBusStation> site;
|
||||
|
||||
public List<OchBusStation> getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
public void setSite(List<OchBusStation> site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResult{" +
|
||||
"site=" + site +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusStation {
|
||||
private int lineId;
|
||||
private int siteId;
|
||||
private String siteName;
|
||||
private String cityCode;
|
||||
private String areaCode;
|
||||
private String areaName;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private String siteDesc;
|
||||
private int siteState;
|
||||
private int isCurrentSite;// @see OchBusConst 是否是当前站 1:是 2:下一站 0:普通站
|
||||
private int siteColor;
|
||||
private String peoples;
|
||||
private int ifStop; // 是否需要停靠、1需要、0不需要
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setIfStop( int ifStop ) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public void setLineId(int lineId) {
|
||||
this.lineId = lineId;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public String getSiteName() {
|
||||
return siteName;
|
||||
}
|
||||
|
||||
public void setSiteName(String siteName) {
|
||||
this.siteName = siteName;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode(String areaCode) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName) {
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSiteDesc() {
|
||||
return siteDesc;
|
||||
}
|
||||
|
||||
public void setSiteDesc(String siteDesc) {
|
||||
this.siteDesc = siteDesc;
|
||||
}
|
||||
|
||||
public int getSiteState() {
|
||||
return siteState;
|
||||
}
|
||||
|
||||
public void setSiteState(int siteState) {
|
||||
this.siteState = siteState;
|
||||
}
|
||||
|
||||
public int getIsCurrentSite() {
|
||||
return isCurrentSite;
|
||||
}
|
||||
|
||||
public void setIsCurrentSite(int isCurrentSite) {
|
||||
this.isCurrentSite = isCurrentSite;
|
||||
}
|
||||
|
||||
public int getSiteColor() {
|
||||
return siteColor;
|
||||
}
|
||||
|
||||
public void setSiteColor(int siteColor) {
|
||||
this.siteColor = siteColor;
|
||||
}
|
||||
|
||||
public String getPeoples() {
|
||||
return peoples;
|
||||
}
|
||||
|
||||
public void setPeoples(String peoples) {
|
||||
this.peoples = peoples;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
"lineId=" + lineId +
|
||||
", siteId=" + siteId +
|
||||
", siteName='" + siteName + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", areaCode='" + areaCode + '\'' +
|
||||
", areaName='" + areaName + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", siteDesc='" + siteDesc + '\'' +
|
||||
", siteState=" + siteState +
|
||||
", isCurrentSite=" + isCurrentSite +
|
||||
", siteColor=" + siteColor +
|
||||
", peoples='" + peoples + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/25
|
||||
*
|
||||
* 小巴站点信息变更:停靠状态等
|
||||
*/
|
||||
class OchBusStationsChangedMsg {
|
||||
|
||||
public List< OchBusStation > data;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
/**
|
||||
* 查询下车乘客请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class QueryLeaveAwayPassengersRequest {
|
||||
private String sn;
|
||||
private int endSiteId;
|
||||
private int orderDispatchType = 4;
|
||||
|
||||
public QueryLeaveAwayPassengersRequest(int siteId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.endSiteId = siteId;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getEndSiteId() {
|
||||
return endSiteId;
|
||||
}
|
||||
|
||||
public void setEndSiteId(int endSiteId) {
|
||||
this.endSiteId = endSiteId;
|
||||
}
|
||||
|
||||
public int getOrderDispatchType() {
|
||||
return orderDispatchType;
|
||||
}
|
||||
|
||||
public void setOrderDispatchType(int orderDispatchType) {
|
||||
this.orderDispatchType = orderDispatchType;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/26
|
||||
*
|
||||
* 到站查询下车乘客
|
||||
*/
|
||||
class QueryLeaveAwayPassengersResponse extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
|
||||
public List< LeaveAwayPassenger > info;
|
||||
}
|
||||
|
||||
public static class LeaveAwayPassenger {
|
||||
|
||||
/**
|
||||
* _id : 9a3b0aacb5f241eabb5ed9f8615d9af6
|
||||
* orderNo : XB20210324000001
|
||||
* orderType : 10
|
||||
* userName : 星期一
|
||||
* userPhone : 15555555555
|
||||
* startStationId : 1
|
||||
* startStation : 万集东门站
|
||||
* startStationCoordinate : [116.7354579447,40.1974932972]
|
||||
* endStationId : 2
|
||||
* endStation : 顺密路口站
|
||||
* endStationCoordinate : [116.7215386924,40.194019209]
|
||||
* orderDispatchType : 1
|
||||
* carNum : 京NB007
|
||||
* sn : F803BB2037EZD00088
|
||||
* orderStartTime : 2021-03-24 11:51:24
|
||||
* orderEndTime :
|
||||
* arrivedStartStationTime :
|
||||
* arrivedEndStationTime :
|
||||
* cityCode : 010
|
||||
* areaCode : 1001
|
||||
* createTime : 2021-03-24 11:51:24
|
||||
* updateTime : 2021-03-24 12:32:10
|
||||
* personNum :
|
||||
* travelDistance : 1.2
|
||||
* vehicleColour :
|
||||
* lastBrandName :
|
||||
* headImgUrl :
|
||||
*/
|
||||
|
||||
public String _id;
|
||||
public String orderNo;
|
||||
public int orderType;
|
||||
public String userName;
|
||||
public String userPhone;
|
||||
public int startStationId;
|
||||
public String startStation;
|
||||
public int endStationId;
|
||||
public String endStation;
|
||||
public int orderDispatchType;
|
||||
public String carNum;
|
||||
public String sn;
|
||||
public String orderStartTime;
|
||||
public String orderEndTime;
|
||||
public String arrivedStartStationTime;
|
||||
public String arrivedEndStationTime;
|
||||
public String cityCode;
|
||||
public String areaCode;
|
||||
public String createTime;
|
||||
public String updateTime;
|
||||
public String personNum;
|
||||
public double travelDistance;
|
||||
public String vehicleColour;
|
||||
public String lastBrandName;
|
||||
public String headImgUrl;
|
||||
public List< Double > startStationCoordinate;
|
||||
public List< Double > endStationCoordinate;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class QueryOchBusOperationStatusRequest {
|
||||
|
||||
public String sn;
|
||||
|
||||
public QueryOchBusOperationStatusRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class UpdateSiteStatusRequest {
|
||||
|
||||
public String sn;
|
||||
// 0 - 关闭、1 - 启动
|
||||
public int siteId;
|
||||
|
||||
public UpdateSiteStatusRequest( int siteId ) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.och.bus.constant;
|
||||
|
||||
/**
|
||||
* 常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusConst {
|
||||
// 测试用的广播
|
||||
public static final String BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType";
|
||||
// 无状态
|
||||
public static final int STATION_STATUS_IDLE = 0;
|
||||
// 到站
|
||||
public static final int STATION_STATUS_STOPPED = 1;
|
||||
// 离开某一站
|
||||
public static final int STATION_STATUS_LEAVING = 2;
|
||||
// 下一站
|
||||
public static final int STATION_STATUS_ARRIVING = 3;
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
package com.mogo.och.bus.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.BaseOchFragment;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.presenter.OchBusPresenter;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPresenter > implements SlidePanelView.OnSlidePanelMoveToEndListener {
|
||||
private static final String TAG = "OchBusFragment";
|
||||
|
||||
private TextView mCurrentStationName;
|
||||
private TextView mStartStationFlag;
|
||||
private TextView mNextStationName;
|
||||
private TextView mEndStationFlag;
|
||||
|
||||
private View mBus;
|
||||
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
mBus = findViewById( R.id.module_och_bus_tag );
|
||||
mCurrentStationName = findViewById( R.id.module_och_bus_current_station );
|
||||
mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag );
|
||||
mNextStationName = findViewById( R.id.module_och_bus_order_end_station );
|
||||
mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag );
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
mBus.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "重置了车站状态" );
|
||||
mPresenter.debugResetStationStatus();
|
||||
} );
|
||||
|
||||
mBus.setOnLongClickListener( view -> {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
Logger.d( TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() );
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
switch ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
|
||||
hideAutopilotBiz();
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged( false );
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged( true );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected OchBusPresenter createPresenter() {
|
||||
return new OchBusPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据站点列表信息刷新车站面板,滑块面板
|
||||
*
|
||||
* @param stationList 车站列表信息
|
||||
* @param currentStation 当前站点
|
||||
* @param nextStation 下个站点
|
||||
*/
|
||||
public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ) {
|
||||
if ( getActivity() == null ) {
|
||||
return;
|
||||
}
|
||||
getActivity().runOnUiThread( () -> {
|
||||
if ( stationList == null ) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
// 渲染小巴路线数据
|
||||
renderCurrentStationStatus( stationList, currentStation, nextStation );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新刷新站点信息
|
||||
*/
|
||||
private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation, int nextStation ) {
|
||||
|
||||
String currentStationName = null;
|
||||
String nextStationName = null;
|
||||
int startStationFlagVisibility = View.INVISIBLE;
|
||||
int endStationFlagVisibility = View.INVISIBLE;
|
||||
|
||||
boolean isArriveEndStation = false;
|
||||
boolean isArriveAtStation = false;
|
||||
boolean isArriveAtStartStation = false;
|
||||
|
||||
// 获取当前站点的名称
|
||||
currentStationName = stationList.get( currentStation ).getSiteName();
|
||||
|
||||
// 是否到达起点
|
||||
if ( currentStation == 0 ) {
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
isArriveAtStartStation = true;
|
||||
mStartStationFlag.setText( "始" );
|
||||
}
|
||||
// 是否到达站点
|
||||
else if ( currentStation > 0 && currentStation < stationList.size() - 1 ) {
|
||||
isArriveAtStation = true;
|
||||
}
|
||||
// 是否到达终点
|
||||
else if ( currentStation == stationList.size() - 1 ) {
|
||||
isArriveEndStation = true;
|
||||
nextStationName = "--";
|
||||
mStartStationFlag.setText( "终" );
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
endStationFlagVisibility = View.INVISIBLE;
|
||||
}
|
||||
|
||||
// 获取下一站点名称
|
||||
if ( nextStation > currentStation && nextStation <= stationList.size() - 1 ) {
|
||||
nextStationName = stationList.get( nextStation ).getSiteName();
|
||||
}
|
||||
|
||||
// 是否到达终点
|
||||
if ( nextStation == stationList.size() - 1 ) {
|
||||
endStationFlagVisibility = View.VISIBLE;
|
||||
}
|
||||
|
||||
// 重置滑动按钮文字
|
||||
if ( isArriveEndStation ) {
|
||||
showSlidePanle( "单程结束" );
|
||||
} else if ( isArriveAtStartStation ) {
|
||||
showSlidePanle( "滑动出发" );
|
||||
} else if ( isArriveAtStation ) {
|
||||
showSlidePanle( "滑动出发" );
|
||||
}
|
||||
mCurrentStationName.setText( currentStationName );
|
||||
mNextStationName.setText( nextStationName );
|
||||
mStartStationFlag.setVisibility( startStationFlagVisibility );
|
||||
mEndStationFlag.setVisibility( endStationFlagVisibility );
|
||||
}
|
||||
|
||||
|
||||
public void hideOchBus() {
|
||||
// tvNotice.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.fragment_och_bus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
mPresenter.restartAutopilot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToEnd() {
|
||||
// 开启自动驾驶到下一站
|
||||
mPresenter.autoDriveToNextStation(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶可用状态
|
||||
*/
|
||||
public void onAutopilotEnableChange( boolean isEnable ) {
|
||||
onAutopilotStatusChanged(isEnable);
|
||||
if ( isEnable ) {
|
||||
showAutopilotBiz();
|
||||
} else {
|
||||
hideAutopilotBiz();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus();
|
||||
mPresenter.onChangeOperationStatus();
|
||||
// TODO 临时解决因为首次请求Http-DNS是北京的bug,后续需要考虑Http-DNS状态变化后向外同步的逻辑
|
||||
mPresenter.queryBusRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改经营状态
|
||||
* @param launch true-收车,false-出车
|
||||
*/
|
||||
public void changeOperationStatus( boolean launch ) {
|
||||
isOperationStatus = launch;
|
||||
if ( launch ) {
|
||||
// 出车的时候重制站点状态
|
||||
mPresenter.debugResetStationStatus();
|
||||
|
||||
tvOperationStatus.setText( "收车" );
|
||||
// showSlidePanle("滑动出发");
|
||||
showPanel();
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
tvOperationStatus.setText("出车");
|
||||
hideSlidePanel();
|
||||
hidPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* 小巴车相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
* <p>
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*/
|
||||
public interface IOchBusApiService {
|
||||
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
*
|
||||
* @param requestBody 请求参数
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1" )
|
||||
Observable< OchBusRoutesResponse > querySiteByCoordinate( @Body RequestBody requestBody );
|
||||
|
||||
|
||||
/**
|
||||
* 公交车驶离车站时,通知服务端
|
||||
*
|
||||
* @param requestBody 请求参数 {"sn":"","siteId":"车站id"}
|
||||
* @return 无返回值
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1" )
|
||||
Observable< OchBusRoutesResponse > leaveStation( @Body RequestBody requestBody );
|
||||
|
||||
/**
|
||||
* 调试用重置接口
|
||||
*
|
||||
* @param requestBody 请求参数{"siteId":1,"sn":"F803EB2046PZD00229"}
|
||||
* @return 返回值是重置后的车站列表
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1" )
|
||||
Observable< OchBusRoutesResponse > debugResetStationStatus( @Body RequestBody requestBody );
|
||||
|
||||
/**
|
||||
* 修改小巴运营状态
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/updateBusStatus/v1" )
|
||||
Observable< BaseData > changeOperationStatus( @Body OchBusOperationStatusRequest request );
|
||||
|
||||
/**
|
||||
* 查询小巴运营状态
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryBusStatus/v1" )
|
||||
Observable< OchBusOperationStatusResponse > queryOperationStatus( @Body QueryOchBusOperationStatusRequest request );
|
||||
|
||||
/**
|
||||
* 更新到站信息
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteDynamic/v1" )
|
||||
Observable< OchBusRoutesResponse > updateSiteStation( @Body UpdateSiteStatusRequest request );
|
||||
|
||||
/**
|
||||
* 到站查询下车乘客
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryOrderBySiteAndSn/v1" )
|
||||
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers( @Body QueryLeaveAwayPassengersRequest request );
|
||||
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.bean.OchBusOrder;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.bean.OchBusStationsChangedMsg;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
*
|
||||
* 小巴订单管理
|
||||
*/
|
||||
class OchBusOrderModel {
|
||||
private final String TAG = "OchBusOrderModel";
|
||||
|
||||
private static volatile OchBusOrderModel sInstance;
|
||||
|
||||
public static OchBusOrderModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OchBusOrderModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OchBusOrderModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi( mContext )
|
||||
.registerOnMessageListener( 401021, mOnOrderListener );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi( mContext )
|
||||
.registerOnMessageListener( 401020, mOnBusStationsChangedMsg );
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* 小巴订单
|
||||
* <p>
|
||||
* 1. 新订单
|
||||
*/
|
||||
private IMogoOnMessageListener< OchBusOrder > mOnOrderListener = new IMogoOnMessageListener< OchBusOrder >() {
|
||||
@Override
|
||||
public Class< OchBusOrder > target() {
|
||||
return OchBusOrder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OchBusOrder obj ) {
|
||||
Logger.i(TAG, "401021--小巴订单:" + GsonUtil.jsonFromObject(obj));
|
||||
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
runOnUiThread( () -> {
|
||||
if ( mOnBusOrderChangedListener != null ) {
|
||||
mOnBusOrderChangedListener.onBusOrderChanged( obj );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 站点信息变更推送
|
||||
* 新订单、取消订单、到达站点等都会导致停靠站点变更,故都会收到此推送
|
||||
*/
|
||||
private IMogoOnMessageListener< OchBusStationsChangedMsg > mOnBusStationsChangedMsg = new IMogoOnMessageListener< OchBusStationsChangedMsg >() {
|
||||
@Override
|
||||
public Class< OchBusStationsChangedMsg > target() {
|
||||
return OchBusStationsChangedMsg.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OchBusStationsChangedMsg obj ) {
|
||||
Logger.i(TAG, "401020--站点信息变更推送:" + GsonUtil.jsonFromObject(obj));
|
||||
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
runOnUiThread( () -> {
|
||||
if ( mOnBusStationsChangedListener != null ) {
|
||||
mOnBusStationsChangedListener.onBusStationsChanged( obj.data );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
private OnBusStationsChangedListener mOnBusStationsChangedListener;
|
||||
private OnBusOrderChangedListener mOnBusOrderChangedListener;
|
||||
|
||||
private OchBusOrderModel() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 小巴到站
|
||||
*/
|
||||
public void onArriveAtStation() {
|
||||
|
||||
}
|
||||
|
||||
public void setOnBusStationsChangedListener( OnBusStationsChangedListener onBusStationsChangedListener ) {
|
||||
this.mOnBusStationsChangedListener = onBusStationsChangedListener;
|
||||
}
|
||||
|
||||
public void setOnBusOrderChangedListener( OnBusOrderChangedListener mOnBusOrderChangedListener ) {
|
||||
this.mOnBusOrderChangedListener = mOnBusOrderChangedListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*/
|
||||
public interface OnBusStationsChangedListener {
|
||||
void onBusStationsChanged( List< OchBusStation > data );
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*/
|
||||
public interface OnBusOrderChangedListener {
|
||||
void onBusOrderChanged( OchBusOrder order );
|
||||
}
|
||||
|
||||
private void runOnUiThread( Runnable runnable ) {
|
||||
if ( Looper.myLooper() == Looper.getMainLooper() ) {
|
||||
runnable.run();
|
||||
} else {
|
||||
UiThreadHandler.postDelayed( runnable, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,653 +0,0 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusOrder;
|
||||
import com.mogo.och.bus.bean.OchBusResetRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.net.IOchBusApiService;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_LEAVING;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusPresenter extends Presenter< OchBusFragment > implements IMogoAdasOCHCallback,
|
||||
Handler.Callback,
|
||||
OchBusOrderModel.OnBusStationsChangedListener,
|
||||
OchBusOrderModel.OnBusOrderChangedListener {
|
||||
private static final String TAG = "OchBusPresenter";
|
||||
|
||||
// 运营类型
|
||||
private static final int VEHICLE_TYPE = 10;
|
||||
private static final int MSG_QUERY_BUS_STATION = 1001;
|
||||
private static final long QUERY_BUS_STATION_DELAY = 5000;
|
||||
|
||||
/**
|
||||
* 用来表示是否正在开往下一站
|
||||
*/
|
||||
private boolean isGoingToNextStation = false;
|
||||
|
||||
private IOchBusApiService mService;
|
||||
|
||||
/**
|
||||
* 运营状态、后端更具运营状态来判断车辆是否派单
|
||||
*/
|
||||
private boolean mIsWorking = false;
|
||||
|
||||
public OchBusPresenter( OchBusFragment view ) {
|
||||
super( view );
|
||||
mService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IOchBusApiService.class, HostConst.OCH_DOMAIN );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback( this );
|
||||
OchBusOrderModel.getInstance().init();
|
||||
OchBusOrderModel.getInstance().setOnBusStationsChangedListener( this );
|
||||
OchBusOrderModel.getInstance().setOnBusOrderChangedListener( this );
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler( this );
|
||||
|
||||
private final List< OchBusStation > stationList = new ArrayList<>();
|
||||
|
||||
private int currentStationIndex = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
Log.d(TAG, "onCreate ------> ");
|
||||
queryOperationStatus();
|
||||
queryBusRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴路线
|
||||
*/
|
||||
public void queryBusRoutes() {
|
||||
Logger.d( TAG, "查询小巴路线");
|
||||
|
||||
double lat = 40.1974932972;
|
||||
double lon = 116.7354579447;
|
||||
lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
|
||||
OchBusRoutesRequest request = new OchBusRoutesRequest( MoGoAiCloudClientConfig.getInstance().getSn(), lat, lon );
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
|
||||
mService.querySiteByCoordinate( requestBody )
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
|
||||
@Override
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o == null
|
||||
|| o.getResult() == null
|
||||
|| o.getResult().getSite() == null
|
||||
|| o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "获取到小巴路线数据: " + o );
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "获取小巴路线图失败" );
|
||||
// 重复请求小巴路线,直至成功
|
||||
queryBusStationDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message );
|
||||
// 重复请求小巴路线,直至成功
|
||||
queryBusStationDelay();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染站点信息
|
||||
*
|
||||
* @param site
|
||||
*/
|
||||
private void renderBusStationsStatus( List< OchBusStation > site ) {
|
||||
Logger.d( TAG, "渲染站点信息");
|
||||
|
||||
int lastStopStation = getNextStopStation();
|
||||
|
||||
stationList.clear();
|
||||
stationList.addAll( site );
|
||||
for ( int i = 0; i < stationList.size(); i++ ) {
|
||||
OchBusStation s = stationList.get( i );
|
||||
// 是否正在开往下一站
|
||||
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING ) {
|
||||
isGoingToNextStation = true;
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
|
||||
// 当前站点信息
|
||||
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING
|
||||
|| s.getIsCurrentSite() == STATION_STATUS_STOPPED ) {
|
||||
currentStationIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() );
|
||||
|
||||
if ( isGoingToNextStation ) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
|
||||
resetNextStopStation( lastStopStation );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置下一站
|
||||
*
|
||||
* @param lastStopStation
|
||||
*/
|
||||
private void resetNextStopStation( int lastStopStation ) {
|
||||
Logger.d( TAG, "重置下一站");
|
||||
|
||||
int nextStopStation = getNextStopStation();
|
||||
if ( nextStopStation < 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex ) {
|
||||
return;
|
||||
}
|
||||
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()
|
||||
== IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING ) {
|
||||
// 自动驾驶中动态设置下一个停靠站点
|
||||
autoDriveToNextStation( true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单状态、获取下一站靠站的的站点
|
||||
*
|
||||
* @return -1 当前已是最后一个站点
|
||||
*/
|
||||
private int getNextStopStation() {
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
return -1;
|
||||
}
|
||||
int nextStationIndex = currentStationIndex + 1;
|
||||
for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) {
|
||||
if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nextStationIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 延时查询站点信心
|
||||
*/
|
||||
private void queryBusStationDelay() {
|
||||
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY );
|
||||
}
|
||||
|
||||
/**
|
||||
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
|
||||
*/
|
||||
public void restartAutopilot() {
|
||||
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
|
||||
if ( isGoingToNextStation ) {
|
||||
autoDriveToNextStation( true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试、重置站点状态
|
||||
*/
|
||||
public void debugResetStationStatus() {
|
||||
Logger.d( TAG, "测试、重置站点状态");
|
||||
double lat = 40.1974932972;
|
||||
double lon = 116.7354579447;
|
||||
|
||||
// ADAS 经纬度,需要启动工控机
|
||||
lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
|
||||
OchBusResetRequest request = new OchBusResetRequest(MoGoAiCloudClientConfig.getInstance().getSn(), 1, lat, lon);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mService.debugResetStationStatus(requestBody)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<OchBusRoutesResponse>(RequestOptions.create(getContext())) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "获取到小巴路线数据: " + o);
|
||||
isGoingToNextStation = false;
|
||||
if (o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus(o.getResult().getSite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "获取小巴路线图失败");
|
||||
// 重复请求小巴路线,直至成功
|
||||
queryBusStationDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message);
|
||||
// 重复请求小巴路线,直至成功
|
||||
queryBusStationDelay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶到下一站
|
||||
*/
|
||||
public void autoDriveToNextStation( boolean isRestart ) {
|
||||
Logger.d( TAG, "开启自动驾驶到下一站");
|
||||
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
travelOver();
|
||||
return;
|
||||
}
|
||||
OchBusStation currentStation = stationList.get( currentStationIndex );
|
||||
|
||||
int nextStationIndex = getNextStopStation();
|
||||
|
||||
OchBusStation nextStation = stationList.get( nextStationIndex );
|
||||
currentStation.setIsCurrentSite( STATION_STATUS_LEAVING );
|
||||
nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING );
|
||||
|
||||
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
|
||||
currentAutopilot.isSpeakVoice = !isRestart;
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() );
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() );
|
||||
currentAutopilot.vehicleType = VEHICLE_TYPE;
|
||||
Logger.d( TAG, "开启自动驾驶====" + currentAutopilot );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( currentAutopilot );
|
||||
|
||||
if ( mView != null ) {
|
||||
mView.refreshBusStations( stationList, currentStationIndex, nextStationIndex );
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
|
||||
if ( isGoingToNextStation ) {
|
||||
// 为了避免恢复自动驾驶时重复的接口请求
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
|
||||
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( MoGoAiCloudClientConfig.getInstance().getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
|
||||
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt( AutopilotStationInfo data ) {
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
Logger.e( TAG, "到站异常,取消后续操作" );
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "到站====" );
|
||||
isGoingToNextStation = false;
|
||||
// 到达站点后,更新站点状态
|
||||
currentStationIndex = getNextStopStation();
|
||||
updateSiteStation();
|
||||
queryLeaveAwayPassengers();
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站后重置站点状态
|
||||
*/
|
||||
private void updateSiteStation() {
|
||||
Logger.d( TAG, "到站后重置站点状态");
|
||||
|
||||
mService.updateSiteStation( new UpdateSiteStatusRequest( stationList.get( currentStationIndex ).getSiteId() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o.getResult() == null && o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询到站下车乘客
|
||||
*/
|
||||
private void queryLeaveAwayPassengers() {
|
||||
Logger.d( TAG, "查询到站下车乘客");
|
||||
|
||||
mService.queryStationLeaveAwayPassengers( new QueryLeaveAwayPassengersRequest( stationList.get( currentStationIndex ).getSiteId() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< QueryLeaveAwayPassengersResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( QueryLeaveAwayPassengersResponse o ) {
|
||||
super.onSuccess( o );
|
||||
playLeavePassengersMsg( o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 播报下车乘客信息
|
||||
*
|
||||
* @param awayPassengersResponse
|
||||
*/
|
||||
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
|
||||
Logger.d( TAG, "播报下车乘客信息");
|
||||
|
||||
if ( currentStationIndex > stationList.size() - 1 ) {
|
||||
return;
|
||||
}
|
||||
String station = stationList.get( currentStationIndex ).getSiteName();
|
||||
StringBuilder builder = new StringBuilder( "已到达" );
|
||||
builder.append( station );
|
||||
if ( !station.endsWith( "站" ) ) {
|
||||
builder.append( "站" );
|
||||
}
|
||||
if ( awayPassengersResponse == null || awayPassengersResponse.result == null || awayPassengersResponse.result.info == null || awayPassengersResponse.result.info.isEmpty() ) {
|
||||
//
|
||||
} else {
|
||||
builder.append( ",请尾号为 " );
|
||||
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : awayPassengersResponse.result.info ) {
|
||||
if ( leaveAwayPassenger == null ) {
|
||||
continue;
|
||||
}
|
||||
String tailNum = null;
|
||||
try {
|
||||
tailNum = leaveAwayPassenger.userPhone.substring(leaveAwayPassenger.userPhone.length() - 4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tailNum = leaveAwayPassenger.userPhone;
|
||||
}
|
||||
builder.append( tailNum ).append( "。" );
|
||||
}
|
||||
builder.append( "的乘客下车" );
|
||||
}
|
||||
builder.append(",带好随身物品,下车请注意安全");
|
||||
Logger.d(TAG, "TTS:" + builder.toString());
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( builder.toString() );
|
||||
}
|
||||
|
||||
/**
|
||||
* 行程结束
|
||||
*/
|
||||
private void travelOver() {
|
||||
Logger.d( TAG, "行程结束");
|
||||
|
||||
if ( currentStationIndex >= stationList.size() ) {
|
||||
Logger.e( TAG, "travel over index out of station list" );
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "单程结束====" );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "感谢您体验’蘑菇车联‘无人驾驶小巴车,请您携带好随身物品,我们下次再见" );
|
||||
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( MoGoAiCloudClientConfig.getInstance().getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
|
||||
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
// 始发站改为Stoped,其他站改为Idle
|
||||
Logger.d( TAG, "单程真的结束了====" );
|
||||
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged( int state, String reason ) {
|
||||
Logger.d( TAG, "onStateChange: " + state );
|
||||
switch ( state ) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
// 设置UI【自动驾驶】按钮是否展示
|
||||
mView.onAutopilotEnableChange( true );
|
||||
// 改变UI自动驾驶状态
|
||||
mView.onAutopilotStatusChanged( false );
|
||||
if ( isGoingToNextStation ) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
// 改变UI自动驾驶状态
|
||||
mView.onAutopilotStatusChanged( true );
|
||||
break;
|
||||
default:
|
||||
mView.onAutopilotEnableChange( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage( Message msg ) {
|
||||
if ( msg.what == MSG_QUERY_BUS_STATION ) {
|
||||
queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isWorking() {
|
||||
return mIsWorking;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小巴运营状态
|
||||
*/
|
||||
public void onChangeOperationStatus() {
|
||||
Logger.d( TAG, "修改小巴运营状态");
|
||||
|
||||
mService.changeOperationStatus( isWorking() ? new OchBusOperationStatusRequest().shutdown() : new OchBusOperationStatusRequest().launch() )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
mIsWorking = !mIsWorking;
|
||||
if ( mIsWorking ) {
|
||||
if ( stationList != null && stationList.size() > 0 ) {
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "车辆已整备完毕,请前往" + stationList.get( 0 ).getSiteName() + "站点" );
|
||||
}
|
||||
}
|
||||
if ( mView != null ) {
|
||||
mView.changeOperationStatus( isWorking() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营状态
|
||||
*/
|
||||
public void queryOperationStatus() {
|
||||
Logger.d( TAG, "查询运营状态");
|
||||
|
||||
mService.queryOperationStatus( new QueryOchBusOperationStatusRequest() )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusOperationStatusResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusOperationStatusResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o.result != null ) {
|
||||
mIsWorking = o.result.status == 1;
|
||||
}
|
||||
if ( mView != null ) {
|
||||
mView.changeOperationStatus( isWorking() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "查询运营状态 error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "查询运营状态 exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBusStationsChanged( List< OchBusStation > data ) {
|
||||
renderBusStationsStatus( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBusOrderChanged( OchBusOrder order ) {
|
||||
if ( order == null ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( order.getUserPhone() ) ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String tailNum = null;
|
||||
try {
|
||||
tailNum = order.getUserPhone().substring( order.getUserPhone().length() - 4 );
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tailNum = order.getUserPhone();
|
||||
}
|
||||
Logger.d(TAG, "TTS:" + tailNum);
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "接到新订单,尾号 " + tailNum + " 上车站点为 " + order.getStartStation() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.bus.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.och.bus.constant.OchBusConst;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 测试小巴车的场景
|
||||
*
|
||||
* @author donghongyu
|
||||
* @date 4/26/21 12:08 PM
|
||||
*/
|
||||
public class TestOchBusBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "TestOchBusBroadcastReceiver";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int sceneType = intent.getIntExtra(OchBusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
Logger.d(TAG, "sceneType:" + sceneType);
|
||||
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* 强制拦截所有touch时间的约束布局
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class NoTouchConstraintLayout extends ConstraintLayout {
|
||||
public NoTouchConstraintLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoTouchConstraintLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoTouchConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if(DebugConfig.isDebug()){
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.DashPathEffect;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* 垂直虚线
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class VerticalDashLineView extends View {
|
||||
public VerticalDashLineView(Context context) {
|
||||
this(context,null);
|
||||
}
|
||||
|
||||
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private final Paint linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path dashPath = new Path();
|
||||
|
||||
private void init(){
|
||||
linePaint.setColor(Color.GREEN);
|
||||
linePaint.setStyle(Paint.Style.STROKE);
|
||||
linePaint.setStrokeWidth(2);
|
||||
linePaint.setPathEffect(new DashPathEffect(new float[]{5, 5}, 0));
|
||||
}
|
||||
|
||||
public void setGradient(int startColor, int endColor) {
|
||||
LinearGradient linearGradient = new LinearGradient(0, 0, getWidth(), getHeight(), startColor, endColor, Shader.TileMode.CLAMP);
|
||||
linePaint.setShader(linearGradient);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
linePaint.setShader(null);
|
||||
linePaint.setColor(color);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
dashPath.reset();
|
||||
dashPath.moveTo((float) getWidth()/2, 0);
|
||||
dashPath.lineTo((float) getWidth()/2,getHeight());
|
||||
canvas.drawPath(dashPath,linePaint);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 338 B |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="line">
|
||||
<stroke
|
||||
android:width="6px"
|
||||
android:dashGap="5px"
|
||||
android:dashWidth="5px"
|
||||
android:color="@color/module_mogo_och_bus_current_station_notice_text_color" />
|
||||
<gradient
|
||||
android:startColor="#f00"
|
||||
android:endColor="#0f0" />
|
||||
</shape>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:left="-600dp"
|
||||
android:right="-600dp">
|
||||
<rotate
|
||||
android:drawable="@drawable/module_mogo_och_bus_station_green_dash_line"
|
||||
android:visible="true"
|
||||
android:fromDegrees="90" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#2B6EFF"/>
|
||||
<corners android:radius="33px"/>
|
||||
</shape>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="3px"
|
||||
android:left="3px"
|
||||
android:right="3px"
|
||||
android:top="3px">
|
||||
<shape>
|
||||
<corners android:radius="32px" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,145 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
|
||||
android:background="@drawable/module_och_bus_panel_bkg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_tag_m_t"
|
||||
android:layout_marginRight="@dimen/module_mogo_och_autopilot_order_tag_m_r"
|
||||
android:background="@drawable/module_och_bus_panel_anchor_bkg"
|
||||
android:paddingLeft="@dimen/module_mogo_och_autopilot_order_tag_p_r"
|
||||
android:paddingTop="2px"
|
||||
android:paddingRight="@dimen/module_mogo_och_autopilot_order_tag_p_r"
|
||||
android:paddingBottom="2px"
|
||||
android:text="小巴车"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_order_tag_height"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/module_och_bus_order_status_stationInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft"
|
||||
android:paddingTop="@dimen/module_och_bus_order_status_stationInfo_paddingTop"
|
||||
android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight"
|
||||
android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="14px"
|
||||
android:text="当前站点:"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6px"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
|
||||
tools:text="后路站" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_start_station_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="始"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_next_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_och_bus_order_distance_anchor_marginTop"
|
||||
android:text="下一站:"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_order_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
|
||||
tools:text="后路站1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_end_station_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="终"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/greenDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14px"
|
||||
android:src="@drawable/module_mogo_och_icon_arrived_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dotLine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/module_och_dot_line"
|
||||
app:layout_constraintBottom_toTopOf="@+id/blueDot"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintRight_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/blueDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_mogo_och_icon_arriving_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.mogo.och.bus.view.VerticalDashLineView
|
||||
android:id="@+id/module_mogo_och_bus_station_bottom_dash"
|
||||
android:layout_width="1px"
|
||||
android:layout_height="30px"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
|
||||
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name"
|
||||
android:layout_marginTop="15px"/>
|
||||
|
||||
<com.mogo.och.bus.view.VerticalDashLineView
|
||||
android:id="@+id/module_mogo_och_bus_station_top_dash"
|
||||
android:layout_width="1px"
|
||||
android:layout_height="30px"
|
||||
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
|
||||
android:layout_marginBottom="15px"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
|
||||
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon" />
|
||||
<ImageView
|
||||
android:id="@+id/module_mogo_och_bus_station_icon"
|
||||
android:layout_width="20px"
|
||||
android:layout_height="20px"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/module_mogo_och_icon_arrived_station"
|
||||
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_bus_station_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_mogo_och_bus_station_name_margin_left"
|
||||
android:text="后鲁站"
|
||||
android:textColor="@color/module_mogo_och_bus_arrived_station_name_text_color"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_bus_station_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_bus_station_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="起点"
|
||||
android:textColor="@color/module_mogo_och_bus_station_notice_text_color"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
|
||||
android:layout_marginEnd="10px"
|
||||
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,184 +0,0 @@
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"detailMsg": "",
|
||||
"result": {
|
||||
"info": [
|
||||
{
|
||||
"_id": "cee57b3ae07c4486b0357319368487d7",
|
||||
"orderNo": "XB20210422000002",
|
||||
"orderType": 10,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 1,
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"endStationId": 2,
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"orderDispatchType": 7,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "2021-04-22 16:31:58",
|
||||
"orderEndTime": "2021-04-26 10:38:13",
|
||||
"arrivedStartStationTime": null,
|
||||
"arrivedEndStationTime": null,
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "2021-04-22 16:31:58",
|
||||
"updateTime": "2021-04-26 10:38:13",
|
||||
"personNum": 1,
|
||||
"travelDistance": 1.2,
|
||||
"vehicleColour": null,
|
||||
"lastBrandName": null,
|
||||
"headImgUrl": null
|
||||
},
|
||||
{
|
||||
"_id": "ce69b1bcfb9840c6a4563bc6ef947caf",
|
||||
"orderNo": "XB20210426000000",
|
||||
"orderType": 10,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 1,
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"endStationId": 2,
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"orderDispatchType": 7,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "2021-04-26 10:38:48",
|
||||
"orderEndTime": "2021-04-26 10:46:16",
|
||||
"arrivedStartStationTime": null,
|
||||
"arrivedEndStationTime": null,
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "2021-04-26 10:38:48",
|
||||
"updateTime": "2021-04-26 10:46:16",
|
||||
"personNum": 1,
|
||||
"travelDistance": 1.2,
|
||||
"vehicleColour": null,
|
||||
"lastBrandName": null,
|
||||
"headImgUrl": null
|
||||
},
|
||||
{
|
||||
"_id": "cae07b56f41c4e0fa60ab3543ffc258e",
|
||||
"orderNo": "XB20210426000001",
|
||||
"orderType": 10,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 1,
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"endStationId": 2,
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"orderDispatchType": 7,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "2021-04-26 10:47:05",
|
||||
"orderEndTime": "2021-04-26 10:48:07",
|
||||
"arrivedStartStationTime": null,
|
||||
"arrivedEndStationTime": null,
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "2021-04-26 10:47:05",
|
||||
"updateTime": "2021-04-26 10:48:07",
|
||||
"personNum": 1,
|
||||
"travelDistance": 1.2,
|
||||
"vehicleColour": null,
|
||||
"lastBrandName": null,
|
||||
"headImgUrl": null
|
||||
},
|
||||
{
|
||||
"_id": "62bc84afbc434d01b644c74ee406e772",
|
||||
"orderNo": "XB20210426000002",
|
||||
"orderType": 10,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 1,
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"endStationId": 2,
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"orderDispatchType": 7,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "2021-04-26 10:48:22",
|
||||
"orderEndTime": "2021-04-26 10:50:32",
|
||||
"arrivedStartStationTime": null,
|
||||
"arrivedEndStationTime": null,
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "2021-04-26 10:48:22",
|
||||
"updateTime": "2021-04-26 10:50:32",
|
||||
"personNum": 1,
|
||||
"travelDistance": 1.2,
|
||||
"vehicleColour": null,
|
||||
"lastBrandName": null,
|
||||
"headImgUrl": null
|
||||
},
|
||||
{
|
||||
"_id": "fa3214c7a6ec411bb3d6edbc98907423",
|
||||
"orderNo": "XB20210426000009",
|
||||
"orderType": 10,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 1,
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"endStationId": 2,
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"orderDispatchType": 7,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "2021-04-26 19:26:05",
|
||||
"orderEndTime": "2021-04-27 14:35:50",
|
||||
"arrivedStartStationTime": null,
|
||||
"arrivedEndStationTime": null,
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "2021-04-26 19:26:05",
|
||||
"updateTime": "2021-04-27 14:35:50",
|
||||
"personNum": 1,
|
||||
"travelDistance": 1.2,
|
||||
"vehicleColour": null,
|
||||
"lastBrandName": null,
|
||||
"headImgUrl": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"_id": "62bc84afbc434d01b644c74ee406e772",
|
||||
"areaCode": "1001",
|
||||
"carNum": "京NB010",
|
||||
"cityCode": "010",
|
||||
"createTime": "Apr 26, 2021 10:48:22 AM",
|
||||
"endStation": "顺密路口站",
|
||||
"endStationCoordinate": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"endStationId": 2,
|
||||
"orderDispatchType": 1,
|
||||
"orderNo": "XB20210426000002",
|
||||
"orderStartTime": "Apr 26, 2021 10:48:22 AM",
|
||||
"orderType": 10,
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"startStation": "万集东门站",
|
||||
"startStationCoordinate": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"startStationId": 1,
|
||||
"travelDistance": 1.2,
|
||||
"updateTime": "Apr 26, 2021 10:48:23 AM",
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018"
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"detailMsg": "",
|
||||
"result": {
|
||||
"site": [
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 1.0,
|
||||
"siteName": "万集东门站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"lon": 116.7354579447,
|
||||
"lat": 40.1974932972,
|
||||
"siteDesc": "万集东门站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 1.0,
|
||||
"siteColor": 1.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
},
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 2.0,
|
||||
"siteName": "市政府前街18号",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.729134342,
|
||||
40.1953113732
|
||||
],
|
||||
"lon": 116.729134342,
|
||||
"lat": 40.1953113732,
|
||||
"siteDesc": "市政府前街18号",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 3.0,
|
||||
"siteColor": 2.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 0.0
|
||||
},
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 3.0,
|
||||
"siteName": "顺密路口站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"lon": 116.721520973,
|
||||
"lat": 40.1940181096,
|
||||
"siteDesc": "顺密路口站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 0.0,
|
||||
"siteColor": 0.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"detailMsg": "",
|
||||
"result": {
|
||||
"site": [
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 1.0,
|
||||
"siteName": "万集东门站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.7354579447,
|
||||
40.1974932972
|
||||
],
|
||||
"lon": 116.7354579447,
|
||||
"lat": 40.1974932972,
|
||||
"siteDesc": "万集东门站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 0.0,
|
||||
"siteColor": 0.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
},
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 1.0,
|
||||
"siteName": "万集东门站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.7374429112,
|
||||
40.2023987087
|
||||
],
|
||||
"lon": 116.7374429112,
|
||||
"lat": 40.2023987087,
|
||||
"siteDesc": "万集东门站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 0.0,
|
||||
"siteColor": 0.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
},
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 2.0,
|
||||
"siteName": "顺密路口站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.721520973,
|
||||
40.1940181096
|
||||
],
|
||||
"lon": 116.721520973,
|
||||
"lat": 40.1940181096,
|
||||
"siteDesc": "顺密路口站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 1.0,
|
||||
"siteColor": 1.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
},
|
||||
{
|
||||
"lineId": 1.0,
|
||||
"siteId": 2.0,
|
||||
"siteName": "顺密路口站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.723146,
|
||||
40.179637
|
||||
],
|
||||
"lon": 116.723146,
|
||||
"lat": 40.179637,
|
||||
"siteDesc": "顺密路口站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 1.0,
|
||||
"siteColor": 1.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
},
|
||||
{
|
||||
"lineId": 2.0,
|
||||
"siteId": 2.0,
|
||||
"siteName": "顺密路口站",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"areaName": "顺义区",
|
||||
"currentLocation": [
|
||||
116.738835502,
|
||||
40.2023958306
|
||||
],
|
||||
"lon": 116.738835502,
|
||||
"lat": 40.2023958306,
|
||||
"siteDesc": "顺密路口站",
|
||||
"siteState": 1.0,
|
||||
"isCurrentSite": 1.0,
|
||||
"siteColor": 1.0,
|
||||
"peoples": "0",
|
||||
"ifStop": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 本套资源适配分体机xhdpi -->
|
||||
<dimen name="module_mogo_och_bus_station_panel_width">300px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
|
||||
<dimen name="module_mogo_och_bus_two_station_panel_height">211px</dimen>
|
||||
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_list_height">220px</dimen>
|
||||
<dimen name="module_mogo_och_bus_two_station_list_height">98px</dimen>
|
||||
<dimen name="module_mogo_och_bus_three_station_list_height">159px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
|
||||
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_top">20px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_left">36px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_bottom">28px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_right">36px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_left">3px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_right">3px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_top">17px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_bottom">17px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_och_bus_panel_width">300px</dimen>
|
||||
<dimen name="module_och_bus_panel_height">270px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginTop">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_textSize">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_height">146px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingLeft">20px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
|
||||
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_mogo_och_bus_current_station_name_text_color">#FF1FA7FF</color>
|
||||
<color name="module_mogo_och_bus_current_station_notice_text_color">#FFFFFFFF</color>
|
||||
<color name="module_mogo_och_bus_arrived_station_name_text_color">#FFFFFFFF</color>
|
||||
<color name="module_mogo_och_bus_not_arrive_station_name_text_color">#FF51649D</color>
|
||||
<color name="module_mogo_och_bus_station_notice_text_color">#7F8299EB</color>
|
||||
|
||||
<color name="module_mogo_och_bus_not_arrive_dash_color">#51649D</color>
|
||||
<color name="module_mogo_och_bus_arriving_start_dash_color">#427d8e</color>
|
||||
<color name="module_mogo_och_bus_arriving_end_dash_color">#1FA7FF</color>
|
||||
<color name="module_mogo_och_bus_leaving_start_dash_color">#3FC281</color>
|
||||
<color name="module_mogo_och_bus_leaving_end_dash_color">#427d8e</color>
|
||||
<color name="module_mogo_och_bus_arrived_dash_color">#3FC281</color>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 本套资源适配分体机xhdpi -->
|
||||
<dimen name="module_mogo_och_bus_station_panel_width">300px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
|
||||
<dimen name="module_mogo_och_bus_two_station_panel_height">211px</dimen>
|
||||
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_list_height">220px</dimen>
|
||||
<dimen name="module_mogo_och_bus_two_station_list_height">98px</dimen>
|
||||
<dimen name="module_mogo_och_bus_three_station_list_height">159px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
|
||||
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_name_text_size">26px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_notice_text_size">20px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_top">20px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_left">36px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_bottom">28px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_padding_right">36px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_left">3px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_right">3px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_top">17px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_bottom">17px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_och_bus_panel_width">300px</dimen>
|
||||
<dimen name="module_och_bus_panel_height">270px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginTop">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_textSize">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_height">146px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingLeft">20px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_marginTop">27px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_height">16px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_m_t">16px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_m_r">16px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
|
||||
|
||||
|
||||
</resources>
|
||||
1
OCH/mogo-och-noop/.gitignore
vendored
1
OCH/mogo-och-noop/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,61 +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")
|
||||
|
||||
|
||||
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 {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogooch
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
|
||||
} else {
|
||||
implementation project(":OCH:mogo-och")
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-noop
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och-noop/proguard-rules.pro
vendored
21
OCH/mogo-och-noop/proguard-rules.pro
vendored
@@ -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
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.bus">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mogo.och.bus;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.och.OCHConstants;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route(path = OCHConstants.PATH)
|
||||
public class MogoOCHNoop implements IMoGoFunctionProvider {
|
||||
|
||||
private static final String TAG = "MogoOCHNoop";
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "noop-");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) {
|
||||
Logger.d(TAG, "noop-");
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
OCH/mogo-och-taxi/.gitignore
vendored
1
OCH/mogo-och-taxi/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,66 +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")
|
||||
|
||||
|
||||
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 {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogooch
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_api
|
||||
} else {
|
||||
implementation project(":OCH:mogo-och")
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":modules:mogo-module-common")
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-function-api')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-taxi
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och-taxi/proguard-rules.pro
vendored
21
OCH/mogo-och-taxi/proguard-rules.pro
vendored
@@ -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
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.taxi">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/26
|
||||
*
|
||||
* adas 可自动驾驶状态切换逻辑
|
||||
*/
|
||||
interface IMogoADASAutoPilotStatusChangedListener {
|
||||
|
||||
void onAutoPilotStatusChanged( int status, String reason );
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 网约车-出租车到站回调
|
||||
*/
|
||||
interface IMogoOCHTaxiArriveCallback {
|
||||
|
||||
void onTheWay2StartStation();
|
||||
|
||||
/**
|
||||
* 到达起始站
|
||||
*/
|
||||
void onArriveAtStartStation();
|
||||
|
||||
/**
|
||||
* 到达终点站
|
||||
*/
|
||||
void onArriveAtEndStation();
|
||||
|
||||
/**
|
||||
* 去往目的地的路上
|
||||
*/
|
||||
void onTheWay2EndStation();
|
||||
|
||||
/**
|
||||
* 乘客已到达站点
|
||||
*/
|
||||
void onUserArriveAtStartStation();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public interface IOperationChangedListener {
|
||||
void onOperationChanged(boolean launch);
|
||||
void onOrderStatusChanged(int status);
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.OCHConstants;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiFragment;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiUiController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
* <p>
|
||||
* 网约车-出租车
|
||||
*/
|
||||
@Route(path = OCHConstants.PATH)
|
||||
public class MogoOCHTaxi implements IMoGoFunctionProvider, IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "MogoOCHTaxi";
|
||||
private OCHTaxiFragment ochTaxiFragment;
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "init");
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE, this);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("ochTaxi", StatusDescriptor.TOP_VIEW, this);
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (ochTaxiFragment == null) {
|
||||
Logger.d(TAG, "准备add fragment======");
|
||||
ochTaxiFragment = new OCHTaxiFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, ochTaxiFragment).commitAllowingStateLoss();
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(ochTaxiFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment() {
|
||||
if (ochTaxiFragment != null) {
|
||||
mActivity.getSupportFragmentManager().beginTransaction().hide(ochTaxiFragment).commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue) {
|
||||
showFragment();
|
||||
MogoOCHTaxiModel.getInstance().init(mActivity.getApplicationContext());
|
||||
} else {
|
||||
hideFragment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) {
|
||||
this.mActivity = activity;
|
||||
this.mContainerId = containerId;
|
||||
// MogoOCHTaxiModel.getInstance().init( activity.getApplicationContext() );
|
||||
OCHTaxiUiController.getInstance().init(activity, containerId);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
OCHTaxiUiController.getInstance().stepIntoVrMode();
|
||||
}, 5_000L);
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,915 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.taxi.ui.OCHTaxiUiController;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 网约车 - 出租车业务逻辑处理
|
||||
*/
|
||||
class MogoOCHTaxiModel {
|
||||
|
||||
private static final String TAG = "MogoOCHTaxiModel";
|
||||
|
||||
/**
|
||||
* 到达起始点围栏
|
||||
*/
|
||||
public static final int ARRIVE_AT_START_STATION_DISTANCE = 20;
|
||||
|
||||
private static volatile MogoOCHTaxiModel sInstance;
|
||||
|
||||
private MogoOCHTaxiModel() {
|
||||
}
|
||||
|
||||
public static MogoOCHTaxiModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoOCHTaxiModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoOCHTaxiModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*/
|
||||
public static final String SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER";
|
||||
|
||||
private OrderMsgListener mOrderMsgListener;
|
||||
private OrderStatusMsgListener mOrderStatusMsgListener;
|
||||
private OCHTaxiServiceApi mOCHTaxiServiceApi;
|
||||
private Context mContext;
|
||||
private OCHTaxiOrderResponse mCurrentOCHOrder;
|
||||
private OCHArriveNotifyCallback mNotifyCallback;
|
||||
private OCHSocketLifeCycleLisnter mSocketLifeCycleLisnter;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener2;
|
||||
/**
|
||||
* 是否达到起始站点
|
||||
*/
|
||||
private boolean mIsArriveAtStartStation = false;
|
||||
|
||||
/**
|
||||
* 是否在去往终点站的路上
|
||||
*/
|
||||
private boolean mIsOnTheWay2EndStation = false;
|
||||
|
||||
/**
|
||||
* 是否达到终点
|
||||
*/
|
||||
private boolean mIsArriveAtEndStation = false;
|
||||
|
||||
// /**
|
||||
// * 乘客已到达上车站点
|
||||
// */
|
||||
// private boolean mIsUserArriveAtStartStation = false;
|
||||
|
||||
/**
|
||||
* 查询订单信息重试次数
|
||||
*/
|
||||
private int mRetryCounter = 0;
|
||||
|
||||
private int mOCHRHCarstatus = -1;
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
|
||||
if (mOCHTaxiServiceApi == null){
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create(OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN);
|
||||
}
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi( context )
|
||||
.registerOnMessageListener( 401016, mOrderMsgListener = new OrderMsgListener() );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi( context )
|
||||
.registerOnMessageListener( 401019, mOrderStatusMsgListener = new OrderStatusMsgListener() );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(context)
|
||||
.registerLifecycleListener(10010,mSocketLifeCycleLisnter = new OCHSocketLifeCycleLisnter());
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.addAdasOCHCallback( mNotifyCallback = new OCHArriveNotifyCallback() );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getIntentManagerApi()
|
||||
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// restoreOrderInfo();
|
||||
// }
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
querryCarStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public void querryCarStatus() {
|
||||
mOCHTaxiServiceApi.queryCarStatus( new OCHCarStatus (MoGoAiCloudClientConfig.getInstance().getSn(),0))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(OCHCarStatusResponse data) {
|
||||
super.onSuccess(data);
|
||||
Logger.e(TAG,"querryCarStatus:"+data.data.status);
|
||||
|
||||
mOCHRHCarstatus = data.data.status == 1 ? 1:0;
|
||||
|
||||
//更新view
|
||||
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus==1);
|
||||
//刷新数据
|
||||
updateData(mOCHRHCarstatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG,"querryCarStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message,code);
|
||||
Logger.e(TAG,"querryCarStatus:"+message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateData(int status){
|
||||
if (status == 1){
|
||||
//查询订单
|
||||
restoreOrderInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新恢复订单状态
|
||||
*/
|
||||
private void restoreOrderInfo() {
|
||||
Logger.d( TAG, "重新查询订单状态" );
|
||||
mRetryCounter = 0;
|
||||
query2RestoreOrderStatus(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态,来恢复旧订单(因crash导致应用重启、断网没收到推送等)状态
|
||||
* <p>
|
||||
* 已结束、已取消:清除订单状态
|
||||
* 已到达目的地:更新UI,显示到达目的地状态
|
||||
* 车辆已到达起始地:等待乘客上车,并确认上车
|
||||
* 乘客已上车:更新UI,显示已到达起始站,等待安全员确认开启自动驾驶
|
||||
* 在去往目的地的路上:显示去往目的地的路上
|
||||
* 在去往起始地的路上、未获取具体状态:以新接收订单开始处理
|
||||
*
|
||||
* @param orderNo
|
||||
*/
|
||||
private void query2RestoreOrderStatus( String orderNo ) {
|
||||
Logger.e(TAG,"query2RestoreOrderStatus:"+orderNo);
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
Logger.d( TAG, "query2RestoreOrderStatus:"+ data.toString());
|
||||
if ( data == null || data.data == null) {
|
||||
Logger.d( TAG, "订单已取消或已完成" );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
|
||||
return;
|
||||
}
|
||||
convertCurrentOrder( data );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
switch ( status ) {
|
||||
case JourneyCompleted:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
|
||||
clearCurrentOCHOrder();
|
||||
// OCHTaxiUiController.getInstance().removeFragment();
|
||||
break;
|
||||
case Cancel:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
|
||||
clearCurrentOCHOrder();
|
||||
// OCHTaxiUiController.getInstance().removeFragment();
|
||||
break;
|
||||
case ArriveAtEndStation:
|
||||
case UserState:
|
||||
mIsArriveAtEndStation = true;
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case ArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case UserArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
// mIsUserArriveAtStartStation = true;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToEndStation:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = true;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
// OCHTaxiUiController.getInstance().addFragment();
|
||||
break;
|
||||
case OnTheWayToStartStation:
|
||||
default:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if ( mRetryCounter++ > 3 ) {
|
||||
return;
|
||||
}
|
||||
query2RestoreOrderStatus( orderNo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.w( TAG, "查询订单失败" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于长连接
|
||||
* @param orderNo
|
||||
*/
|
||||
private void querryOrderStatusForMakeUp( String orderNo ) {
|
||||
Logger.e(TAG,"querryOrderStatusForMakeUp:"+orderNo);
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
if ( data == null || data.data == null) {
|
||||
Logger.d( TAG, "订单已取消或已完成" );
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.None.getCode());
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "querryOrderStatusForMakeUp:"+ data.data.orderDispatchType);
|
||||
convertCurrentOrder( data );
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( data.data.orderDispatchType );
|
||||
switch ( status ) {
|
||||
case JourneyCompleted:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_completed ) );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
clearCurrentOCHOrder();
|
||||
break;
|
||||
case Cancel:
|
||||
TipToast.shortTip( mContext.getString( R.string.module_och_taxi_order_cancel ) );
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
clearCurrentOCHOrder();
|
||||
break;
|
||||
case OnTheWayToStartStation:
|
||||
// default:
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(data.data.orderDispatchType);
|
||||
mOrderMsgListener.onMsgReceived( mCurrentOCHOrder );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.w( TAG, "查询订单失败" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 将查询到的订单转换成推送的订单数据,目前两者数据结构不一样
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
private void convertCurrentOrder( OCHTaxiOrderResponse2 data ) {
|
||||
if (data.data == null){
|
||||
return;
|
||||
}
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
mCurrentOCHOrder = new OCHTaxiOrderResponse();
|
||||
}
|
||||
mCurrentOCHOrder.orderNo = data.data.orderNo;
|
||||
mCurrentOCHOrder.orderDispatchType = data.data.orderDispatchType;
|
||||
mCurrentOCHOrder.endStation = data.data.endStation;
|
||||
mCurrentOCHOrder.startStation = data.data.startStation;
|
||||
mCurrentOCHOrder.travelDistance = data.data.travelDistance;
|
||||
mCurrentOCHOrder.orderType = data.data.orderType;
|
||||
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
|
||||
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
List< Double > startStationCoordinate = data.data.startStationCoordinate;
|
||||
List< Double > startGcjStationCoordinate = data.data.startGcjStationCoordinate;
|
||||
if (startStationCoordinate != null && startStationCoordinate.size()>1 &&
|
||||
startGcjStationCoordinate!= null && startGcjStationCoordinate.size() > 1){
|
||||
startStation.lon = startGcjStationCoordinate.get( 0 );
|
||||
startStation.lat = startGcjStationCoordinate.get( 1 );
|
||||
startStation.wgsLon = startStationCoordinate.get(0);
|
||||
startStation.wgsLat = startStationCoordinate.get(1);
|
||||
startStation.siteId = data.data.startStationId;
|
||||
startStation.siteName = data.data.startStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( startStation );
|
||||
}
|
||||
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
List< Double > endStationCoordinate = data.data.endStationCoordinate;
|
||||
List< Double > endGcjStationCoordinate = data.data.endGcjStationCoordinate;
|
||||
if (endStationCoordinate != null && endStationCoordinate.size()>1 &&
|
||||
endGcjStationCoordinate!=null && endGcjStationCoordinate.size() > 1){
|
||||
endStation.lon = endGcjStationCoordinate.get( 0 );
|
||||
endStation.lat = endGcjStationCoordinate.get( 1 );
|
||||
endStation.wgsLon = endStationCoordinate.get( 0 );
|
||||
endStation.wgsLat = endStationCoordinate.get( 1 );
|
||||
endStation.siteId = data.data.endStationId;
|
||||
endStation.siteName = data.data.endStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
||||
}
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
*/
|
||||
private IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
Logger.d( TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// restoreOrderInfo();
|
||||
querryCarStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void changedOperationStatus() {
|
||||
if ( mOCHRHCarstatus == -1){
|
||||
querryCarStatus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkCurrentOCHOrder()){
|
||||
TipToast.shortTip( "订单未完成,无法下线收车" );
|
||||
return;
|
||||
}
|
||||
|
||||
int status = mOCHRHCarstatus == 1 ? 0 : 1;
|
||||
mOCHTaxiServiceApi.updateCarStatus(new OCHCarStatus(MoGoAiCloudClientConfig.getInstance().getSn(),status))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHCarStatusResponse >(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(OCHCarStatusResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"OCHCarStatusResponse:"+o.data.status);
|
||||
mOCHRHCarstatus = o.data.status;
|
||||
OCHTaxiUiController.getInstance().onOperationChanged(mOCHRHCarstatus == 1);
|
||||
updateData(mOCHRHCarstatus);
|
||||
Logger.d(TAG,"changeCarStatus:"+status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG,"changeCarStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG,"changeCarStatus:"+message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 自车定位
|
||||
*/
|
||||
private class LocationListener implements IMogoCarLocationChangedListener2 {
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
// Logger.d( TAG, "定位已判断是否达到上车站点: 起点(%s, %s), 当前位置(%s, %s)",
|
||||
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lon,
|
||||
// mCurrentOCHOrder.drivingRoutes.get( 0 ).lat,
|
||||
// location.getLongitude(),
|
||||
// location.getLatitude()
|
||||
// );
|
||||
onLocationChanged( location );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置变化时,通过围栏({@link #ARRIVE_AT_START_STATION_DISTANCE}M)判断,是否到达x点
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
private void onLocationChanged( Location location ) {
|
||||
if ( location == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !checkCurrentOCHOrder() ) {
|
||||
return;
|
||||
}
|
||||
if ( mIsArriveAtStartStation ) {
|
||||
return;
|
||||
}
|
||||
// if ( mIsUserArriveAtStartStation ) {
|
||||
// return;
|
||||
// }
|
||||
judgeStartStation( location );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据围栏判断,是否到达起点
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
private void judgeStartStation( Location location ) {
|
||||
OCHTaxiOrderResponse.OCHTaxiStation station = mCurrentOCHOrder.drivingRoutes.get( 0 );//起点
|
||||
double distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat, location.getLongitude(), location.getLatitude() );
|
||||
if ( distance > ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
distance = CoordinateUtils.calculateLineDistance( station.lon, station.lat,
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat() );
|
||||
}
|
||||
if ( distance <= ARRIVE_AT_START_STATION_DISTANCE ) {
|
||||
mIsArriveAtStartStation = true;
|
||||
OCHTaxiUiController.getInstance().onArriveAtStartStation();
|
||||
updateOCHOrderStatus( OCHOrderStatus.ArriveAtStartStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(OCHOrderStatus.ArriveAtStartStation.getCode());
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
return;
|
||||
}
|
||||
// Logger.d( TAG, "distance = %s", distance );
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已到达起始站
|
||||
*/
|
||||
public boolean isArriveAtStartStation() {
|
||||
return mIsArriveAtStartStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已到达终点站
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isArriveAtEndStation() {
|
||||
return mIsArriveAtEndStation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置去往终点状态
|
||||
*
|
||||
* @param isOnTheWay2EndStation
|
||||
*/
|
||||
public void setOnTheWay2EndStation( boolean isOnTheWay2EndStation ) {
|
||||
this.mIsOnTheWay2EndStation = isOnTheWay2EndStation;
|
||||
OCHTaxiUiController.getInstance().onTheWay2EndStation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在去往目的地的路上
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isOnTheWay2EndStation() {
|
||||
return mIsOnTheWay2EndStation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端长链推送通知新订单
|
||||
*/
|
||||
private class OrderMsgListener implements IMogoOnMessageListener< OCHTaxiOrderResponse > {
|
||||
@Override
|
||||
public Class< OCHTaxiOrderResponse > target() {
|
||||
return OCHTaxiOrderResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OCHTaxiOrderResponse obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
if (mOCHRHCarstatus != 1){
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
|
||||
|
||||
mCurrentOCHOrder = obj;
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
Location location = MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getNavi( mContext )
|
||||
.getCarLocation2();
|
||||
onLocationChanged( location );
|
||||
if ( !isArriveAtStartStation() ) {
|
||||
registerCarLocationListener();
|
||||
}
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(mCurrentOCHOrder.orderDispatchType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存订单到本地,避免车机重启丢失数据
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
private void cacheOrderInfo2Native( OCHTaxiOrderResponse obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
SharedPrefsMgr.getInstance( mContext ).putString( SP_KEY_OCH_TAXI_ORDER, GsonUtil.jsonFromObject( obj ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 达到起始站围栏监听
|
||||
*/
|
||||
private void registerCarLocationListener() {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG,
|
||||
mCarLocationChangedListener2 == null ? mCarLocationChangedListener2 = new LocationListener() : mCarLocationChangedListener2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销到达起始站围栏监听
|
||||
*/
|
||||
public void unregisterCarLocationListener() {
|
||||
if ( mCarLocationChangedListener2 == null ) {
|
||||
return;
|
||||
}
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener( TAG, mCarLocationChangedListener2 );
|
||||
}
|
||||
|
||||
public void unregisterSocketListener(){
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getSocketManagerApi(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端长链推送通知订单状态被改变
|
||||
*/
|
||||
private class OrderStatusMsgListener implements IMogoOnMessageListener< OCHTaxiOrderStatusResponse > {
|
||||
|
||||
@Override
|
||||
public Class target() {
|
||||
return OCHTaxiOrderStatusResponse.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OCHTaxiOrderStatusResponse obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
if (mOCHRHCarstatus != 1){
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d(TAG, "订单状态被改变:" + GsonUtil.jsonFromObject(obj));
|
||||
OCHOrderStatus status = OCHOrderStatus.valueOf( obj.orderDispatchType );
|
||||
switch ( status ) {
|
||||
case Cancel:
|
||||
clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(status.getCode());
|
||||
break;
|
||||
case UserArriveAtStartStation:
|
||||
mIsArriveAtStartStation = true;
|
||||
OCHTaxiUiController.getInstance().onUserArriveAtStartStation();
|
||||
break;
|
||||
default:
|
||||
Logger.d( TAG, "current order status: %s", status );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class OCHSocketLifeCycleLisnter implements IMogoLifecycleListener {
|
||||
|
||||
@Override
|
||||
public void onConnectFailure() {
|
||||
Logger.e(TAG,"socket onConnectFailure");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
Logger.e(TAG,"socket onConnectSuccess");
|
||||
stopSocketMakeUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectLost() {
|
||||
Logger.e(TAG,"socket onConnectLost");
|
||||
startSocketMakeUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void startSocketMakeUp(){
|
||||
if (mOCHRHCarstatus == 1){
|
||||
timeLoop();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopSocketMakeUp(){
|
||||
if (mDisposable != null){
|
||||
mDisposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶本地通知订单到站
|
||||
*/
|
||||
private class OCHArriveNotifyCallback implements IMogoAdasOCHCallback {
|
||||
@Override
|
||||
public void onArriveAt( AutopilotStationInfo data ) {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mIsArriveAtEndStation ) {
|
||||
return;
|
||||
}
|
||||
if ( !checkCurrentOCHOrder() ) {
|
||||
return;
|
||||
}
|
||||
mIsArriveAtEndStation = true;
|
||||
OCHTaxiUiController.getInstance().onArriveAtEndStation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged( int state, String reason ) {
|
||||
// Logger.d( TAG, "state = %s", state );
|
||||
OCHTaxiUiController.getInstance().onAutoPilotStatusChanged( state, reason );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
*
|
||||
* @param orderStatus 订单状态
|
||||
*/
|
||||
public void updateOCHOrderStatus( OCHOrderStatus orderStatus, OCHOrderStatusCallback callback ) {
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
return;
|
||||
}
|
||||
if ( mOCHTaxiServiceApi == null ) {
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create( OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN );
|
||||
}
|
||||
mOCHTaxiServiceApi.updateOrderStatus( new OCHTaxiOrderStatus( MoGoAiCloudClientConfig.getInstance().getSn(), mCurrentOCHOrder.orderNo, orderStatus.getCode() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( o );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
if ( callback != null ) {
|
||||
callback.onError();
|
||||
}
|
||||
Logger.e(TAG,"updateOCHOrderStatus:"+e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e(TAG,"updateOCHOrderStatus:"+message);
|
||||
if ( callback != null ) {
|
||||
callback.onFail();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @param orderNo 订单号
|
||||
*/
|
||||
public void queryOCHOrderStatus( String orderNo, OCHOrderStatusCallback< OCHTaxiOrderResponse2 > callback ) {
|
||||
if ( mOCHTaxiServiceApi == null ) {
|
||||
mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi().create( OCHTaxiServiceApi.class, HostConst.OCH_DOMAIN );
|
||||
}
|
||||
mOCHTaxiServiceApi.queryOrder( new OCHTaxiOrderStatus( MoGoAiCloudClientConfig.getInstance().getSn(), orderNo, OCHOrderStatus.None.getCode() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OCHTaxiOrderResponse2 >( RequestOptions.create( mContext ) ) {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 o ) {
|
||||
super.onSuccess( o );
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( o );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
if ( callback != null ) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e("MogoOCHTaxi","queryOCHOrderStatus:"+message);
|
||||
if ( callback != null ) {
|
||||
callback.onFail();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除订单信息
|
||||
*/
|
||||
public void clearCurrentOCHOrder() {
|
||||
mCurrentOCHOrder = null;
|
||||
mIsArriveAtStartStation = false;
|
||||
mIsArriveAtEndStation = false;
|
||||
mIsOnTheWay2EndStation = false;
|
||||
// mIsUserArriveAtStartStation = false;
|
||||
SharedPrefsMgr.getInstance( mContext ).remove( SP_KEY_OCH_TAXI_ORDER );
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测当前订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean checkCurrentOCHOrder() {
|
||||
if ( mCurrentOCHOrder != null
|
||||
&& mCurrentOCHOrder.drivingRoutes != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以当前订单为基础,开启自动驾驶
|
||||
*/
|
||||
public void startAutoPilot() {
|
||||
if ( !checkCurrentOCHOrder() ) {
|
||||
Logger.e( TAG, "no order or order is empty." );
|
||||
return;
|
||||
}
|
||||
|
||||
AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
parameters.vehicleType = mCurrentOCHOrder.orderType;
|
||||
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon );
|
||||
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.aiCloudToAdasData( parameters );
|
||||
Logger.d( TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject( parameters ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public OCHTaxiOrderResponse getCurrentOCHOrder() {
|
||||
return mCurrentOCHOrder;
|
||||
}
|
||||
|
||||
public void calculateTravelDistance(Location carLocation){
|
||||
if (mCurrentOCHOrder.drivingRoutes != null && mCurrentOCHOrder.drivingRoutes.size()>0){
|
||||
OCHTaxiOrderResponse.OCHTaxiStation endStationOCHLocation = mCurrentOCHOrder.drivingRoutes.get(1);
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
endStationOCHLocation.lon, endStationOCHLocation.lat,
|
||||
carLocation.getLongitude(), carLocation.getLatitude());
|
||||
mCurrentOCHOrder.decreaseTravelDistance(distance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
public void cancelAutopilot() {
|
||||
try {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.cancelAutopilot();
|
||||
Logger.d( TAG, "结束自动驾驶" );
|
||||
unregisterCarLocationListener();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final int PERIOD = 1 * 1000;
|
||||
private static final int DELAY = 100;
|
||||
private Disposable mDisposable;
|
||||
/**
|
||||
* 定时循环任务
|
||||
*/
|
||||
private void timeLoop() {
|
||||
mDisposable = Observable.interval(DELAY, PERIOD, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> querryOrderStatusForMakeUp(null));
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
*
|
||||
* 修改/查询网约车-出租车订单状态的数据结构
|
||||
*/
|
||||
class OCHCarStatus extends BaseData {
|
||||
|
||||
public String sn;// 不排除本地没有缓存订单号的情况
|
||||
public int status; //0 收车 1出车
|
||||
|
||||
public OCHCarStatus(String sn,
|
||||
int status ) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
*
|
||||
* 修改/查询网约车-出租车订单状态的数据结构
|
||||
*/
|
||||
class OCHCarStatusResponse extends BaseData {
|
||||
|
||||
public String sn;// 不排除本地没有缓存订单号的情况
|
||||
public int status; //0 收车 1出车
|
||||
public Result data;
|
||||
|
||||
public OCHCarStatusResponse(String sn,
|
||||
int status ) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
}
|
||||
public static class Result{
|
||||
public int id;
|
||||
public String sn;
|
||||
public String areaCode;
|
||||
public String plateNumber;
|
||||
public int status;
|
||||
// String remark;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 未派单 0
|
||||
* 去往上车站点 1
|
||||
* 车辆已到达上车站点 2
|
||||
* 乘客已到达上车站点 3
|
||||
* 去往下车站点 4
|
||||
* 到达下车站点 5
|
||||
* 已完成 6
|
||||
* 已取消 7
|
||||
*/
|
||||
enum OCHOrderStatus {
|
||||
|
||||
None( 0 ),
|
||||
OnTheWayToStartStation( 1 ),
|
||||
ArriveAtStartStation( 2 ),
|
||||
UserArriveAtStartStation( 3 ),
|
||||
OnTheWayToEndStation( 4 ),
|
||||
ArriveAtEndStation( 5 ),
|
||||
UserState( 6 ),//小程序用的状态 车机不处理
|
||||
Cancel( 7 ),
|
||||
JourneyCompleted(8);//行程完成
|
||||
|
||||
private int code;
|
||||
|
||||
OCHOrderStatus( int code ) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static OCHOrderStatus valueOf( int code ) {
|
||||
for ( OCHOrderStatus value : OCHOrderStatus.values() ) {
|
||||
if ( value.code == code ) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 修改订单状态回调接口
|
||||
*/
|
||||
interface OCHOrderStatusCallback< T > {
|
||||
|
||||
void onSuccess( T data );
|
||||
|
||||
void onFail();
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiOrderResponse implements Parcelable {
|
||||
|
||||
// 订单号
|
||||
public String orderNo;
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
public int orderType;
|
||||
// 起始站名称
|
||||
public String startStation;
|
||||
// 目的站名称
|
||||
public String endStation;
|
||||
// 当前订单状态
|
||||
public int orderDispatchType;
|
||||
// 起始站目的站距离km
|
||||
public double travelDistance;
|
||||
// 站点
|
||||
public List< OCHTaxiStation > drivingRoutes;
|
||||
|
||||
/**
|
||||
* @param distance
|
||||
*/
|
||||
public void decreaseTravelDistance( double distance ) {
|
||||
travelDistance = ( ( float ) distance / 1000f );
|
||||
if ( travelDistance < 0 ) {
|
||||
travelDistance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OCHTaxiStation implements Parcelable {
|
||||
public String siteId;
|
||||
public String siteName;
|
||||
public double lon;// 用于计算距离
|
||||
public double lat;
|
||||
public double wgsLon;//用于自动驾驶
|
||||
public double wgsLat;
|
||||
public OCHTaxiStation() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeString( this.siteId );
|
||||
dest.writeString( this.siteName );
|
||||
dest.writeDouble( this.lon );
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.wgsLon );
|
||||
dest.writeDouble( this.wgsLat );
|
||||
}
|
||||
|
||||
protected OCHTaxiStation( Parcel in ) {
|
||||
this.siteId = in.readString();
|
||||
this.siteName = in.readString();
|
||||
this.lon = in.readDouble();
|
||||
this.lat = in.readDouble();
|
||||
this.wgsLon = in.readDouble();
|
||||
this.wgsLat = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator< OCHTaxiStation > CREATOR = new Creator< OCHTaxiStation >() {
|
||||
@Override
|
||||
public OCHTaxiStation createFromParcel( Parcel source ) {
|
||||
return new OCHTaxiStation( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public OCHTaxiStation[] newArray( int size ) {
|
||||
return new OCHTaxiStation[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public OCHTaxiOrderResponse() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeString( this.orderNo );
|
||||
dest.writeInt( this.orderType );
|
||||
dest.writeString( this.startStation );
|
||||
dest.writeString( this.endStation );
|
||||
dest.writeInt( this.orderDispatchType );
|
||||
dest.writeDouble( this.travelDistance );
|
||||
dest.writeTypedList( this.drivingRoutes );
|
||||
}
|
||||
|
||||
protected OCHTaxiOrderResponse( Parcel in ) {
|
||||
this.orderNo = in.readString();
|
||||
this.orderType = in.readInt();
|
||||
this.startStation = in.readString();
|
||||
this.endStation = in.readString();
|
||||
this.orderDispatchType = in.readInt();
|
||||
this.travelDistance = in.readDouble();
|
||||
this.drivingRoutes = in.createTypedArrayList( OCHTaxiStation.CREATOR );
|
||||
}
|
||||
|
||||
public static final Creator< OCHTaxiOrderResponse > CREATOR = new Creator< OCHTaxiOrderResponse >() {
|
||||
@Override
|
||||
public OCHTaxiOrderResponse createFromParcel( Parcel source ) {
|
||||
return new OCHTaxiOrderResponse( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public OCHTaxiOrderResponse[] newArray( int size ) {
|
||||
return new OCHTaxiOrderResponse[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OCHTaxiResponse{" +
|
||||
"orderNo='" + orderNo + '\'' +
|
||||
", orderType=" + orderType +
|
||||
", startStation='" + startStation + '\'' +
|
||||
", endStation='" + endStation + '\'' +
|
||||
", orderDispatchType=" + orderDispatchType +
|
||||
", travelDistance=" + travelDistance +
|
||||
", drivingRoutes=" + drivingRoutes +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiOrderResponse2 extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public String _id;
|
||||
// 订单号
|
||||
public String orderNo;
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
public int orderType;
|
||||
|
||||
// 当前订单状态
|
||||
public int orderDispatchType;
|
||||
// 起始站目的站距离km
|
||||
public double travelDistance;
|
||||
|
||||
public String userName;
|
||||
public String userPhone;
|
||||
|
||||
// 起始站名称
|
||||
public String startStation;
|
||||
// 起始站ID
|
||||
public String startStationId;
|
||||
// 起点站点
|
||||
public List< Double > startStationCoordinate;
|
||||
public List< Double > startGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||
|
||||
// 目的站名称
|
||||
public String endStation;
|
||||
// 目的站ID
|
||||
public String endStationId;
|
||||
// 终点站点
|
||||
public List< Double > endStationCoordinate;
|
||||
public List< Double > endGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||
|
||||
public String orderStartTime;
|
||||
public String cityCode;
|
||||
public String areaCode;
|
||||
public String createTime;
|
||||
public String updateTime;
|
||||
public int personNum;
|
||||
public String headImgUrl;
|
||||
public String lastBrandName;
|
||||
|
||||
public String arrivedStartStationTime;
|
||||
public String arrivedEndStationTime;
|
||||
|
||||
public String sn;
|
||||
public String carNum;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 修改/查询网约车-出租车订单状态的数据结构
|
||||
*/
|
||||
class OCHTaxiOrderStatus {
|
||||
|
||||
public String sn;// 不排除本地没有缓存订单号的情况
|
||||
public String orderNo;
|
||||
public int orderDispatchType;
|
||||
|
||||
|
||||
public OCHTaxiOrderStatus( String sn,
|
||||
String orderNo,
|
||||
int orderDispatchType ) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
this.orderDispatchType = orderDispatchType;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiOrderStatusResponse {
|
||||
|
||||
// 订单号
|
||||
public String orderNo;
|
||||
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
public int orderType;
|
||||
|
||||
// 起始站名称
|
||||
public String startStation;
|
||||
public String startStationId;
|
||||
|
||||
// 目的站名称
|
||||
public String endStation;
|
||||
public String endStationId;
|
||||
|
||||
// 当前订单状态
|
||||
/**
|
||||
* 未派单 0
|
||||
* 去往上车站点 1
|
||||
* 已到达上车站点 2
|
||||
* 去往下车站点 3
|
||||
* 到达下车站点 4
|
||||
* 已完成 5
|
||||
* 已取消 6
|
||||
*/
|
||||
public int orderDispatchType;
|
||||
|
||||
// 起始站目的站距离km
|
||||
public double travelDistance;
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
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 com.mogo.module.common.utils.LocationUtils;
|
||||
import com.mogo.utils.ColorUtils;
|
||||
|
||||
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 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getOverlayManager(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制最优路线
|
||||
*
|
||||
* @param routelist 要绘制的经纬度度集合
|
||||
*/
|
||||
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> routelist) {
|
||||
clearMogoRouteOverlay();
|
||||
if (routelist != null) {
|
||||
|
||||
// 将当前车辆位置放进去
|
||||
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
// 过滤后台推送的推荐路线集合
|
||||
for (MogoLatLng polyline : routelist) {
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
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;
|
||||
}
|
||||
|
||||
public void clearMogoRouteOverlay(){
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 网约车-出租车接口
|
||||
*/
|
||||
interface OCHTaxiServiceApi {
|
||||
|
||||
/**
|
||||
* 更新订单状态
|
||||
*
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/updateOCHOrderState/v1" )
|
||||
Observable< BaseData > updateOrderStatus( @Body OCHTaxiOrderStatus status );
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/order/queryOrderForCar/v1" )
|
||||
Observable< OCHTaxiOrderResponse2 > queryOrder( @Body OCHTaxiOrderStatus status );
|
||||
/**
|
||||
* 查询网约车状态
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/queryTaxiCarStatus/v1")
|
||||
Observable<OCHCarStatusResponse> queryCarStatus(@Body OCHCarStatus sn );
|
||||
|
||||
|
||||
/**
|
||||
* 更新网约车状态
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/order/updateTaxiCarStatus/v1")
|
||||
Observable<OCHCarStatusResponse> updateCarStatus(@Body OCHCarStatus status );
|
||||
}
|
||||
@@ -1,511 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.utils.LocationUtils;
|
||||
import com.mogo.och.BaseOchFragment;
|
||||
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.IOperationChangedListener;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.och.taxi.OCHOrderStatus;
|
||||
import com.mogo.och.taxi.OCHOrderStatusCallback;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 网约车-出租车UI
|
||||
*/
|
||||
class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > implements OCHTaxiView,
|
||||
IMogoStatusChangedListener,
|
||||
IMogoOCHTaxiArriveCallback,
|
||||
IMogoADASAutoPilotStatusChangedListener,
|
||||
IOperationChangedListener,
|
||||
IMogoAdasOCHCallback,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
|
||||
public static final String TAG = "OCHTaxiFragment";
|
||||
|
||||
public static OCHTaxiFragment newInstance() {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
|
||||
OCHTaxiFragment fragment = new OCHTaxiFragment();
|
||||
fragment.setArguments( args );
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private TextView mOrderStatus;
|
||||
private TextView mStartStationName;
|
||||
private TextView mEndStationName;
|
||||
private TextView mDistance;
|
||||
|
||||
private MogoPolylineOptions mogoPolylineOptions;
|
||||
private volatile int saveOrderState = -1;
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.module_och_taxi_panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
// 在自动驾驶中,才会有重新开启自动驾驶的操作
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "restartAutopilot" );
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
mOrderStatus = findViewById( R.id.module_och_taxi_order_status );
|
||||
mStartStationName = findViewById( R.id.module_och_taxi_order_start_station );
|
||||
mEndStationName = findViewById( R.id.module_och_taxi_order_end_station );
|
||||
mDistance = findViewById( R.id.module_och_taxi_order_distance );
|
||||
|
||||
// showPanel();
|
||||
hidPanel();
|
||||
initListeners();
|
||||
// updateOrderStatus();
|
||||
if ( MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.isVrMode() ) {
|
||||
vrMode();
|
||||
} else {
|
||||
flatMode();
|
||||
}
|
||||
|
||||
tvOperationStatus.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( this );
|
||||
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( this );
|
||||
OCHTaxiUiController.getInstance().setOperationChangeListener(this);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG, this );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected OCHTaxiPresenter createPresenter() {
|
||||
return new OCHTaxiPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( isTrue ) {
|
||||
vrMode();
|
||||
} else {
|
||||
flatMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus();
|
||||
MogoOCHTaxiModel.getInstance().changedOperationStatus();
|
||||
}
|
||||
|
||||
private void vrMode() {
|
||||
if ( mRootView != null ) {
|
||||
mRootView.setVisibility(
|
||||
View.VISIBLE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void flatMode() {
|
||||
if ( mRootView != null ) {
|
||||
mRootView.setVisibility(
|
||||
View.GONE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSpeakedEndingNotice = false;
|
||||
/**
|
||||
* 初始化订单信息
|
||||
*/
|
||||
private void updateOrderStatus() {
|
||||
updateOrderBaseStatusInfo();
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
Logger.d( TAG, "已经达到终点" );
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_arrive_at_end_station2 );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "已经去往终点" );
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_on_the_way_2_end_station );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "已经达到起点" );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_waiting );
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
Logger.d( TAG, "去往上车站点" );
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_new_order );
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void SpeakNoticeOnce(){
|
||||
if (!isSpeakedEndingNotice){
|
||||
isSpeakedEndingNotice = true;
|
||||
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单基本信息
|
||||
*/
|
||||
private void updateOrderBaseStatusInfo() {
|
||||
if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
mStartStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().startStation );
|
||||
mEndStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().endStation );
|
||||
double distance = MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().travelDistance;
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
distance = 0;
|
||||
}
|
||||
if ( distance * 1000 >= 1000 ) {
|
||||
mDistance.setText( String.format( "%.1f km", distance ) );
|
||||
} else {
|
||||
mDistance.setText( ( ( int ) ( distance * 1000 ) ) + " m" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
Logger.d( TAG, "通知达到起点" );
|
||||
updateOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2StartStation() {
|
||||
Logger.d( TAG, "去往上车站点" );
|
||||
updateOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtEndStation() {
|
||||
Logger.d( TAG, "通知达到终点" );
|
||||
updateOrderStatus();
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.ArriveAtEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
onOrderStatusChanged(OCHOrderStatus.ArriveAtEndStation.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
// MogoApisHandler.getInstance()
|
||||
// .getApis()
|
||||
// .getRegisterCenterApi()
|
||||
// .unregisterCarLocationChangedListener( TAG, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2EndStation() {
|
||||
Logger.d( TAG, "通知去往终点" );
|
||||
updateOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserArriveAtStartStation() {
|
||||
Logger.d( TAG, "通知乘客已上车" );
|
||||
updateOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.unregisterStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( null );
|
||||
OCHTaxiUiController.getInstance().setAutoPilotStatusChangedListener( null );
|
||||
OCHTaxiUiController.getInstance().setOperationChangeListener(null);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener( TAG, this );
|
||||
MogoOCHTaxiModel.getInstance().unregisterCarLocationListener();
|
||||
MogoOCHTaxiModel.getInstance().unregisterSocketListener();
|
||||
mLocation = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return this::onSlidePanelMoveToEnd;
|
||||
}
|
||||
|
||||
private void onSlidePanelMoveToEnd() {
|
||||
// 已到达终点,需要结束订单
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.JourneyCompleted, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
MogoOCHTaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
MogoOCHTaxiModel.getInstance().cancelAutopilot();
|
||||
OCHTaxiUiController.getInstance().onOrderStatusChanged(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
return;
|
||||
// 乘客已确认到达起点,前往下一站并开启自动驾驶
|
||||
} else if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutoPilotStatusChanged( int status, String reason ) {
|
||||
Logger.d( TAG, "status = %s, reason = %s", status, reason );
|
||||
onAutopilotStatusChanged( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING );
|
||||
if ( status == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING && !MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
|
||||
resetOCHTaxiOrderAutopilotStatus();
|
||||
} else {
|
||||
updateOrderStatus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收到自动驾驶通知的成功状态之后,设置本地状态及服务端状态
|
||||
*/
|
||||
private void resetOCHTaxiOrderAutopilotStatus() {
|
||||
MogoOCHTaxiModel.getInstance().setOnTheWay2EndStation( true );
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.OnTheWayToEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
onOrderStatusChanged(OCHOrderStatus.OnTheWayToEndStation.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
}
|
||||
|
||||
private Location mLocation;
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
|
||||
calculateTravelDistance( location );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位置信息计算当前剩余距离
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
private void calculateTravelDistance( Location location ) {
|
||||
if ( location == null ) {
|
||||
return;
|
||||
}
|
||||
// if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
// return;
|
||||
// }
|
||||
if ( mLocation == null ) {
|
||||
mLocation = location;
|
||||
}
|
||||
// double distance = CoordinateUtils.calculateLineDistance(
|
||||
// location.getLongitude(), location.getLatitude(),
|
||||
// mLocation.getLongitude(), mLocation.getLatitude()
|
||||
// );
|
||||
// Logger.e("lianglihui","calculateTravelDistance:"+distance);
|
||||
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() &&
|
||||
MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() &&
|
||||
!MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
|
||||
MogoOCHTaxiModel.getInstance().calculateTravelDistance(location);
|
||||
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
updateOrderBaseStatusInfo();
|
||||
}
|
||||
mLocation = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOperationChanged(boolean launch) {
|
||||
Logger.e(TAG,"onOperationChanged:"+ launch);
|
||||
isOperationStatus = launch;
|
||||
if ( launch ) {
|
||||
tvOperationStatus.setText( "收车" );
|
||||
// showSlidePanle("滑动出发");
|
||||
// showPanel();
|
||||
} else {
|
||||
// AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
tvOperationStatus.setText("出车");
|
||||
hideSlidePanel();
|
||||
// hidPanel();
|
||||
}
|
||||
// changeLayoutViewStatus(launch);
|
||||
}
|
||||
|
||||
private void changeLayoutViewStatus(boolean launch) {
|
||||
getPanelView().setVisibility(launch ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderStatusChanged(int status) {
|
||||
|
||||
// int orderState = MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().orderDispatchType;
|
||||
// if (orderState == status){
|
||||
// return;
|
||||
// }
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (status == OCHOrderStatus.None.getCode() || status == OCHOrderStatus.Cancel.getCode() || status == OCHOrderStatus.JourneyCompleted.getCode() ){
|
||||
getPanelView().setVisibility(View.INVISIBLE);
|
||||
hideSlidePanel();
|
||||
changeOperationViewVisible(View.VISIBLE);
|
||||
isSpeakedEndingNotice = false;
|
||||
} else {
|
||||
getPanelView().setVisibility(View.VISIBLE);
|
||||
changeOperationViewVisible(View.INVISIBLE);
|
||||
}
|
||||
|
||||
if(status != saveOrderState){
|
||||
OCHOrderStatus ochStatus = OCHOrderStatus.valueOf( status );
|
||||
switch (ochStatus){
|
||||
case OnTheWayToStartStation:
|
||||
showNotice(getString( R.string.module_och_taxi_new_order));
|
||||
break;
|
||||
case Cancel:
|
||||
showNotice(getString( R.string.module_och_taxi_order_cancel));
|
||||
break;
|
||||
case ArriveAtStartStation:
|
||||
showNotice( getString( R.string.module_och_taxi_order_status_ph_text) );
|
||||
break;
|
||||
case OnTheWayToEndStation:
|
||||
// showNotice("欢迎使用蘑菇智行");
|
||||
break;
|
||||
case ArriveAtEndStation:
|
||||
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
|
||||
break;
|
||||
case JourneyCompleted:
|
||||
showNotice( "感谢您使用蘑菇智行,再见~" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveOrderState = status;
|
||||
updateOrderStatus();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public double calculateTravelDistance(MogoLocation carLocation,List<MogoLatLng> routeList){
|
||||
List<MogoLatLng> mPolylinePointList = new ArrayList<>();
|
||||
mPolylinePointList.add(new MogoLatLng(carLocation.getLatitude(), carLocation.getLongitude()));
|
||||
MogoLatLng routeLatLng;
|
||||
for (int i = 0 ; i< routeList.size() ; i++) {
|
||||
routeLatLng =routeList.get(i);
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中点是否在当前车w辆行驶方向前面如果不在则抛弃
|
||||
if (LocationUtils.isPointOnCarFront(carLocation, routeLatLng)) {
|
||||
mPolylinePointList.add(routeLatLng);
|
||||
}
|
||||
}
|
||||
MogoLatLng routeLatLng1,routeLatLng2;
|
||||
double distance = 0;
|
||||
for (int i = 0; i < mPolylinePointList.size() ; i ++){
|
||||
if (i < mPolylinePointList.size() -1 ){
|
||||
routeLatLng1 = mPolylinePointList.get(i);
|
||||
routeLatLng2 = mPolylinePointList.get(i+1);
|
||||
distance += CoordinateUtils.calculateLineDistance(
|
||||
routeLatLng1.getLon(), routeLatLng1.getLat(),
|
||||
routeLatLng2.getLon(), routeLatLng2.getLat()
|
||||
);
|
||||
}
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AutopilotStationInfo data) {
|
||||
Logger.d( TAG, "行程结束");
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
Logger.d( TAG, "onStateChange: " + state );
|
||||
switch ( state ) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
hideSlidePanel();
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class OCHTaxiPresenter extends Presenter< OCHTaxiView > {
|
||||
|
||||
private static final String TAG = "OCHTaxiPresenter";
|
||||
|
||||
public OCHTaxiPresenter( OCHTaxiView view ) {
|
||||
super( view );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
Logger.d( TAG, "网约车-出租车拿到订单" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
}
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.IMogoADASAutoPilotStatusChangedListener;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.IOperationChangedListener;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 控制UI显示
|
||||
*/
|
||||
class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback, IMogoADASAutoPilotStatusChangedListener {
|
||||
|
||||
private static final String TAG = "OCHTaxiUiController";
|
||||
|
||||
private static volatile OCHTaxiUiController sInstance;
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
|
||||
private IMogoOCHTaxiArriveCallback mOCHTaxiArriveCallback;
|
||||
private IMogoADASAutoPilotStatusChangedListener mAutoPilotStatusChangedListener;
|
||||
private IOperationChangedListener mOperationChangedLisnter;
|
||||
|
||||
private OCHTaxiUiController() {
|
||||
}
|
||||
|
||||
public static OCHTaxiUiController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OCHTaxiUiController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OCHTaxiUiController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void init( FragmentActivity activity, int containerId ) {
|
||||
mActivity = activity;
|
||||
mContainerId = containerId;
|
||||
}
|
||||
|
||||
public void addFragment() {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
runOnUIThread( this::addFragmentImpl );
|
||||
}
|
||||
|
||||
private void addFragmentImpl() {
|
||||
if ( !MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
return;
|
||||
}
|
||||
Fragment fragment = null;
|
||||
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
|
||||
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
|
||||
if ( fragment == null ) {
|
||||
fragment = OCHTaxiFragment.newInstance();
|
||||
}
|
||||
mActivity.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace( mContainerId, fragment, OCHTaxiFragment.TAG )
|
||||
.commitNowAllowingStateLoss();
|
||||
|
||||
Logger.d( TAG, "add fragment" );
|
||||
}
|
||||
|
||||
public void removeFragment() {
|
||||
runOnUIThread( () -> {
|
||||
Fragment fragment = null;
|
||||
FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
|
||||
fragment = fragmentManager.findFragmentByTag( OCHTaxiFragment.TAG );
|
||||
if ( fragment == null ) {
|
||||
return;
|
||||
}
|
||||
fragmentManager.beginTransaction()
|
||||
.remove( fragment )
|
||||
.commitNowAllowingStateLoss();
|
||||
} );
|
||||
}
|
||||
|
||||
public void setOCHTaxiArriveCallback( IMogoOCHTaxiArriveCallback OCHTaxiArriveCallback ) {
|
||||
this.mOCHTaxiArriveCallback = OCHTaxiArriveCallback;
|
||||
}
|
||||
|
||||
public void setAutoPilotStatusChangedListener( IMogoADASAutoPilotStatusChangedListener autoPilotStatusChangedListener ) {
|
||||
this.mAutoPilotStatusChangedListener = autoPilotStatusChangedListener;
|
||||
}
|
||||
|
||||
public void setOperationChangeListener(IOperationChangedListener listener){
|
||||
this.mOperationChangedLisnter = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2StartStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onTheWay2StartStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtStartStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2EndStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onTheWay2EndStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtEndStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onArriveAtEndStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserArriveAtStartStation() {
|
||||
runOnUIThread( () -> {
|
||||
if ( mOCHTaxiArriveCallback != null ) {
|
||||
mOCHTaxiArriveCallback.onUserArriveAtStartStation();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutoPilotStatusChanged( int status, String reason ) {
|
||||
runOnUIThread( () -> {
|
||||
if ( mAutoPilotStatusChangedListener != null ) {
|
||||
mAutoPilotStatusChangedListener.onAutoPilotStatusChanged( status, reason );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
public void stepIntoVrMode() {
|
||||
Logger.d( TAG, "进入vr模式" );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
.openVrMode( false );
|
||||
}
|
||||
|
||||
public void onOperationChanged(boolean b) {
|
||||
runOnUIThread( () -> {
|
||||
if (mOperationChangedLisnter != null){
|
||||
mOperationChangedLisnter.onOperationChanged(b);
|
||||
}
|
||||
} );
|
||||
}
|
||||
public void onOrderStatusChanged(int status){
|
||||
runOnUIThread( () -> {
|
||||
if (mOperationChangedLisnter != null){
|
||||
mOperationChangedLisnter.onOrderStatusChanged(status);
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface OCHTaxiView extends IView {
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
android:bottom="3px"
|
||||
android:left="3px"
|
||||
android:right="3px"
|
||||
android:top="3px">
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:centerColor="#80222A4E"
|
||||
android:endColor="#80222A4E"
|
||||
android:startColor="#80222A4E" />
|
||||
<corners
|
||||
android:bottomLeftRadius="17px"
|
||||
android:bottomRightRadius="17px"
|
||||
android:topLeftRadius="0px"
|
||||
android:topRightRadius="0px" />
|
||||
</shape>
|
||||
@@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/module_och_taxi_layoutview"
|
||||
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_status"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_status_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_och_taxi_order_status_marginTop"
|
||||
android:text="@string/module_och_taxi_order_status_ph_text"
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_status_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/module_och_taxi_order_status_divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/module_och_taxi_order_status_divider_height"
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_status_divider_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_och_taxi_order_status_divider_marginTop"
|
||||
android:layout_marginRight="@dimen/module_och_taxi_order_status_divider_marginRight"
|
||||
android:background="@color/module_och_taxi_order_status_divider_bkgColor"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_status" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/module_och_taxi_order_status_stationInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:paddingLeft="@dimen/module_och_taxi_order_status_stationInfo_paddingLeft"
|
||||
android:paddingTop="@dimen/module_och_taxi_order_status_stationInfo_paddingTop"
|
||||
android:paddingRight="@dimen/module_och_taxi_order_status_stationInfo_paddingRight"
|
||||
android:paddingBottom="@dimen/module_och_taxi_order_status_stationInfo_paddingBottom"
|
||||
app:layout_constraintBottom_toTopOf="@+id/module_och_taxi_order_distance_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_taxi_order_status_divider">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/greenDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_mogo_och_icon_arriving_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_start_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_start_station_marginLeft"
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="后路站" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_start_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="上车"
|
||||
android:textColor="@color/module_och_taxi_order_start_station_anchor_textColor"
|
||||
android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"
|
||||
android:textSize="@dimen/module_och_taxi_order_start_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dotLine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/module_och_dot_line"
|
||||
app:layout_constraintBottom_toTopOf="@+id/blueDot"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintRight_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/blueDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_mogo_och_icon_arrived_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_start_station_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_start_station"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
tools:text="后路站1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_end_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="下车"
|
||||
android:layout_marginRight="@dimen/module_och_taxi_order_text_marginRight"
|
||||
android:textColor="@color/module_och_taxi_order_end_station_anchor_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_end_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_och_taxi_order_distance_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_och_taxi_order_distance_container_height"
|
||||
android:background="@drawable/module_och_taxi_panel_distance_bkg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_distance_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_distance_anchor_marginLeft"
|
||||
android:text="@string/module_och_taxi_order_distance_anchor_text"
|
||||
android:textColor="@color/module_och_taxi_order_distance_anchor_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_distance_anchor_textSize"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_taxi_order_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:layout_marginRight="@dimen/module_och_taxi_order_distance_marginRight"
|
||||
android:text="@string/module_och_taxi_order_distance_text_ph"
|
||||
android:textColor="@color/module_och_taxi_order_distance_textColor"
|
||||
android:textSize="@dimen/module_och_taxi_order_distance_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
|
||||
</FrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"drivingRoutes": [
|
||||
{
|
||||
"lat": 40.197234,
|
||||
"lon": 116.74143,
|
||||
"siteId": "1.0",
|
||||
"siteName": "万集东门站"
|
||||
},
|
||||
{
|
||||
"lat": 40.1953113732,
|
||||
"lon": 116.729134342,
|
||||
"siteId": "2.0",
|
||||
"siteName": "市政府前街18号"
|
||||
}
|
||||
],
|
||||
"endStation": "市政府前街18号",
|
||||
"orderDispatchType": 1,
|
||||
"orderNo": "CZ20210430000005",
|
||||
"orderType": 9,
|
||||
"startStation": "万集东门站",
|
||||
"travelDistance": 0.6
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"detailMsg": "",
|
||||
"result": {
|
||||
"_id": "5352c1d2c9d84ab3ab9ecf1e47e13bdd",
|
||||
"orderNo": "CZ20210427000016",
|
||||
"orderType": 9,
|
||||
"userName": "董QAD",
|
||||
"userPhone": "15631204018",
|
||||
"startStationId": 10000,
|
||||
"startStation": "0409第一站",
|
||||
"startStationCoordinate": [
|
||||
116.7389159039,
|
||||
40.1992312592
|
||||
],
|
||||
"endStationId": 21,
|
||||
"endStation": "第二十一站",
|
||||
"endStationCoordinate": [
|
||||
116.737866,
|
||||
40.19646
|
||||
],
|
||||
"orderDispatchType": 1,
|
||||
"carNum": "京NB010",
|
||||
"sn": "F803EB2046PZD00149",
|
||||
"orderStartTime": "Apr 27, 2021 8:55:44 PM",
|
||||
"arrivedStartStationTime": "",
|
||||
"arrivedEndStationTime": "",
|
||||
"cityCode": "010",
|
||||
"areaCode": "1001",
|
||||
"createTime": "Apr 27, 2021 8:55:44 PM",
|
||||
"updateTime": "Apr 27, 2021 8:55:56 PM",
|
||||
"personNum": 1,
|
||||
"travelDistance": 0.3,
|
||||
"vehicleColour": "黑色",
|
||||
"lastBrandName": "",
|
||||
"headImgUrl": "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83ep4YkeZqjiazTK87NQtYp6KMYvAdJcxNpxyJ2gibeNNheH1HFaJdX4hB15eIR3zZdGMWNanKzIn460w/132"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"endStation": "市政府前街18号",
|
||||
"endStationId": "2.0",
|
||||
"orderDispatchType": 7,
|
||||
"orderNo": "CZ20210430000005",
|
||||
"orderType": 9,
|
||||
"startStation": "万集东门站",
|
||||
"startStationId": "1.0",
|
||||
"travelDistance": 0.6
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_och_taxi_panel_width">464px</dimen>
|
||||
<dimen name="module_och_taxi_panel_height">310px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_marginLeft">15px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginLeft">25px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginTop">25px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">41px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">41px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_textSize">42px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_anchor_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_end_station_anchor_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_container_height">84px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_anchor_textSize">32px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_textSize">36px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_text_marginRight">31.5px</dimen>
|
||||
</resources>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_och_order_status_textColor">#FFFFFF</color>
|
||||
<color name="module_och_taxi_order_status_divider_bkgColor">#707DBE</color>
|
||||
<color name="module_och_taxi_order_start_station_anchor_textColor">#8198E8</color>
|
||||
<color name="module_och_taxi_order_end_station_anchor_textColor">#8198E8</color>
|
||||
<color name="module_och_taxi_order_distance_anchor_textColor">#8198E8</color>
|
||||
<color name="module_och_taxi_order_distance_textColor">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_och_taxi_panel_width">464px</dimen>
|
||||
<dimen name="module_och_taxi_panel_height">310px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_marginLeft">5px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_marginTop">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginTop">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_divider_marginRight">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_height">140px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingTop">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_status_stationInfo_paddingBottom">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_textSize">26px</dimen>
|
||||
<dimen name="module_och_taxi_order_start_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_end_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_container_height">64px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_container_marginLeft">3px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_anchor_marginLeft">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_textSize">24px</dimen>
|
||||
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
|
||||
<dimen name="module_och_taxi_order_text_marginRight">22.5px</dimen>
|
||||
</resources>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_och_taxi_arrive_at_start_station">确认上车,行程开始</string>
|
||||
<string name="module_och_taxi_arrive_at_end_station">到达站点,乘客已下车</string>
|
||||
<string name="module_och_taxi_order_status_ph_text">已到达上车站点,等待乘客上车</string>
|
||||
<string name="module_och_taxi_order_distance_anchor_text">预计里程</string>
|
||||
<string name="module_och_taxi_order_distance_text_ph">3.2 km</string>
|
||||
<string name="module_och_taxi_order_complete">请携带好随身物品,注意侧后\n方来车,感谢体验’蘑菇车联‘自\n动驾驶车!</string>
|
||||
<string name="module_och_taxi_order_complete_1">即将到达目的地,请您携带好随身物品,安全下车。</string>
|
||||
<string name="module_och_taxi_on_the_way_2_end_station">去往下车地点</string>
|
||||
<string name="module_och_taxi_waiting">已到达,等待乘客上车</string>
|
||||
<string name="module_och_taxi_new_order">收到新订单,前往上车地点</string>
|
||||
<string name="module_och_taxi_arrive_at_end_station2">已到达下车地点</string>
|
||||
<string name="module_och_taxi_order_completed">订单已完成</string>
|
||||
<string name="module_och_taxi_order_cancel">订单已取消</string>
|
||||
</resources>
|
||||
1
OCH/mogo-och/.gitignore
vendored
1
OCH/mogo-och/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,61 +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")
|
||||
|
||||
|
||||
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 {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
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
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":modules:mogo-module-common")
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och/proguard-rules.pro
vendored
21
OCH/mogo-och/proguard-rules.pro
vendored
@@ -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
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -1,273 +0,0 @@
|
||||
package com.mogo.och;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
* <p>
|
||||
* 部分业务放在了此处处理
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> {
|
||||
|
||||
private static final String TAG = "BaseOchFragment";
|
||||
|
||||
protected SlidePanelView slidePanelView;
|
||||
private CheckedTextView ctvAutopilotStatus;
|
||||
protected TextView tvOperationStatus;
|
||||
public boolean isOperationStatus;//false-收车,true-出车
|
||||
private FrameLayout flStationPanelContainer;
|
||||
private Group groupTestPanel;
|
||||
|
||||
|
||||
/**
|
||||
* 滑动按钮触发的事件
|
||||
*/
|
||||
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
|
||||
// 此处做一个代理,处理一下共有情况
|
||||
if (getSlidePanelOnEndListener() != null) {
|
||||
getSlidePanelOnEndListener().moveToEnd();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_mogo_och_base_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
private View panelView;
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel);
|
||||
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
|
||||
|
||||
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
|
||||
|
||||
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
|
||||
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
|
||||
|
||||
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
restartAutopilot();
|
||||
}
|
||||
});
|
||||
|
||||
// debug下调用测试面板
|
||||
if (DebugConfig.isDebug()) {
|
||||
ctvAutopilotStatus.setOnLongClickListener(v -> {
|
||||
if (groupTestPanel.getVisibility() == View.VISIBLE) {
|
||||
groupTestPanel.setVisibility(View.GONE);
|
||||
} else {
|
||||
groupTestPanel.setVisibility(View.VISIBLE);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
onAutopilotStatusChanged(MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING);
|
||||
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
|
||||
{
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getAdasControllerApi()
|
||||
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE, "不能使用");
|
||||
// Logger.d("lianglihui","模拟 不可自动驾驶");
|
||||
}
|
||||
);
|
||||
|
||||
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
|
||||
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
|
||||
{
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getAdasControllerApi()
|
||||
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE, "能使用");
|
||||
|
||||
// Logger.d("lianglihui","模拟 可自动驾驶");
|
||||
}
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
|
||||
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
|
||||
{
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getAdasControllerApi()
|
||||
.mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "Running");
|
||||
// Logger.d("lianglihui","模拟 自动驾驶能力");
|
||||
}
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶站
|
||||
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
|
||||
{
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getAdasControllerApi().mockOchStatus(-1, "Arrived");
|
||||
|
||||
// Logger.d("lianglihui","模拟 自动驾驶站");
|
||||
}
|
||||
);
|
||||
|
||||
// 模拟 站点下发工控
|
||||
findViewById(R.id.btnAutopilotControl).setOnClickListener(view ->
|
||||
{
|
||||
// Logger.d("lianglihui","模拟 站点下发工控");
|
||||
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
|
||||
currentAutopilot.isSpeakVoice = true;
|
||||
// 万集东门站
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409);
|
||||
// 市政府前街18号
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(40.1939540844,116.720067);
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
currentAutopilot.vehicleType = 10;
|
||||
Logger.d(TAG, "模拟 订单站点下发:" + currentAutopilot);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
}
|
||||
);
|
||||
|
||||
tvOperationStatus.setOnClickListener(view -> {
|
||||
onChangeOperationStatus();
|
||||
});
|
||||
}
|
||||
|
||||
protected void onChangeOperationStatus() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 展示滑动按钮
|
||||
*
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
public void showSlidePanle(String text) {
|
||||
if (isOperationStatus) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
public void hideSlidePanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(boolean isInAutopilot) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
ctvAutopilotStatus.setChecked(isInAutopilot);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
public void hideAutopilotBiz() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setVisibility(View.GONE);
|
||||
// slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
public void showAutopilotBiz() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
ctvAutopilotStatus.setVisibility(View.VISIBLE);
|
||||
if (isOperationStatus) {
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void hidPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
flStationPanelContainer.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
public void showPanel() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
flStationPanelContainer.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
|
||||
public View getPanelView() {
|
||||
return panelView;
|
||||
}
|
||||
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点面板view,在{@link #initViews()}时候添加到container中
|
||||
*
|
||||
* @return 站点面板view
|
||||
*/
|
||||
public abstract int getStationPanelViewId();
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
public abstract void restartAutopilot();
|
||||
|
||||
|
||||
public void changeOperationViewVisible(int visible){
|
||||
getActivity().runOnUiThread(() -> {
|
||||
tvOperationStatus.setVisibility(visible);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 网约车部分常量字段
|
||||
*/
|
||||
class OCHConstants {
|
||||
|
||||
/**
|
||||
* arouter 路由地址
|
||||
*/
|
||||
public static final String PATH = "/och/api";
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.och.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* 帧动画ImageView封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class FrameAnimImageView extends androidx.appcompat.widget.AppCompatImageView implements Handler.Callback {
|
||||
public static final long FRAME_INTERVAL = 50L;
|
||||
private final static int MSG_LOOP = 3003;
|
||||
|
||||
public FrameAnimImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FrameAnimImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public FrameAnimImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
private int[] animRes;
|
||||
private int animPos;
|
||||
private boolean isInAnim = false;
|
||||
|
||||
private final Handler animHandler = new Handler(this);
|
||||
|
||||
public void setAnimRes(int[] animRes) {
|
||||
this.animRes = animRes;
|
||||
}
|
||||
|
||||
public void startAnim() {
|
||||
isInAnim = true;
|
||||
animHandler.sendEmptyMessage(MSG_LOOP);
|
||||
}
|
||||
|
||||
public void stopAnim() {
|
||||
isInAnim = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
stopAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (isInAnim && animRes != null) {
|
||||
if (animPos >= animRes.length) {
|
||||
animPos = 0;
|
||||
}
|
||||
setImageResource(animRes[animPos++]);
|
||||
animHandler.sendEmptyMessageDelayed(MSG_LOOP, FRAME_INTERVAL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
package com.mogo.och.view;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.och.R;
|
||||
|
||||
|
||||
/**
|
||||
* 滑块滑动面板
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class SlidePanelView extends View {
|
||||
private static final String TAG = "SlidePanelView";
|
||||
|
||||
public SlidePanelView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public SlidePanelView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public SlidePanelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.SlidePanelView);
|
||||
textSize = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_textSize, textSize);
|
||||
BLOCK_START_X = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_BLOCK_START_X, BLOCK_START_X);
|
||||
BLOCK_START_Y = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_BLOCK_START_Y, BLOCK_START_Y);
|
||||
NORMAL_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_LEFT, NORMAL_TEXT_MARGIN_LEFT);
|
||||
NORMAL_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_NORMAL_TEXT_MARGIN_RIGHT, NORMAL_TEXT_MARGIN_RIGHT);
|
||||
SHORT_TEXT_MARGIN_LEFT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_LEFT, SHORT_TEXT_MARGIN_LEFT);
|
||||
SHORT_TEXT_MARGIN_RIGHT = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SHORT_TEXT_MARGIN_RIGHT, SHORT_TEXT_MARGIN_RIGHT);
|
||||
SLIDEPANELVIEW_VIEW_HIGH = (int) mTypedArray.getDimension(R.styleable.SlidePanelView_SLIDEPANELVIEW_VIEW_HIGH, SLIDEPANELVIEW_VIEW_HIGH);
|
||||
init();
|
||||
}
|
||||
|
||||
private final Paint bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint blockPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
private static int textSize = 67;
|
||||
private static int BLOCK_START_X = 15;
|
||||
private static int BLOCK_START_Y = 15;
|
||||
private static int NORMAL_TEXT_MARGIN_LEFT = 40;
|
||||
private static int NORMAL_TEXT_MARGIN_RIGHT = 60;
|
||||
private static int SHORT_TEXT_MARGIN_LEFT = 60;
|
||||
private static int SHORT_TEXT_MARGIN_RIGHT = 70;
|
||||
private static int SLIDEPANELVIEW_VIEW_HIGH = 160;
|
||||
|
||||
private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
|
||||
private OnSlidePanelMoveToEndListener moveToEndListener;
|
||||
|
||||
private int blockWidth = 0;
|
||||
private int blockOffset = 0;
|
||||
|
||||
private float lastX;
|
||||
private boolean isToEnd = false;
|
||||
|
||||
private static final String STRING_SLIDE_TO_RIGHT = "向右滑动";
|
||||
private RectF bgRectF;
|
||||
private Bitmap bmBlock;
|
||||
|
||||
private final Matrix gradientMatrix = new Matrix();
|
||||
private float matrixTranslate;
|
||||
private final Rect textRect = new Rect();
|
||||
private LinearGradient textGradient;
|
||||
|
||||
private ObjectAnimator matrixAnim;
|
||||
|
||||
private String blockText = STRING_SLIDE_TO_RIGHT;
|
||||
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
|
||||
private static final int GRADIENT_OFFSET = 200;
|
||||
|
||||
public void setOnSlidePanelMoveToEndListener(OnSlidePanelMoveToEndListener moveToEndListener) {
|
||||
this.moveToEndListener = moveToEndListener;
|
||||
}
|
||||
|
||||
private void setBlockOffset(int blockOffset) {
|
||||
this.blockOffset = blockOffset;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void setMatrixTranslate(float matrixTranslate) {
|
||||
this.matrixTranslate = matrixTranslate;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.blockText = text;
|
||||
requestLayout();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
bgPaint.setColor(Color.parseColor("#CC0F1325"));
|
||||
bgPaint.setStyle(Paint.Style.FILL);
|
||||
|
||||
textPaint.setStyle(Paint.Style.FILL);
|
||||
textPaint.setTextSize(textSize);
|
||||
textPaint.setTextAlign(Paint.Align.LEFT);
|
||||
textGradient = new LinearGradient(-GRADIENT_OFFSET, 0, 0, 0, new int[]{0x33ffffff, 0xffffffff, 0x33ffffff}, null, Shader.TileMode.CLAMP);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
textPaint.setShader(textGradient);
|
||||
textPaint.getFontMetrics(blockTextMetrics);
|
||||
|
||||
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.module_och_base_slide_block);
|
||||
blockWidth = bmBlock.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int widthSize;
|
||||
int heightSize;
|
||||
|
||||
if (blockText.length() < 5) {
|
||||
textMarginLeft = SHORT_TEXT_MARGIN_LEFT;
|
||||
textMarginRight = SHORT_TEXT_MARGIN_RIGHT;
|
||||
} else {
|
||||
textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
|
||||
textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
|
||||
}
|
||||
|
||||
if (widthMode == MeasureSpec.AT_MOST) {
|
||||
// 宽度根据图片大小,字符串长度,各种间隔确定
|
||||
// 高度根据图片大小和上下间隔确定
|
||||
textPaint.getTextBounds(blockText, 0, blockText.length(), textRect);
|
||||
widthSize = BLOCK_START_X * 2 + bmBlock.getWidth() + textMarginLeft + textMarginRight + textRect.width();
|
||||
// heightSize = BLOCK_START_Y * 2 + bmBlock.getHeight();
|
||||
heightSize = SLIDEPANELVIEW_VIEW_HIGH;
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(widthSize, widthMode);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
|
||||
}
|
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
private float textOffset = 0;
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
bgRectF = new RectF(0, 0, w, h);
|
||||
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.cancel();
|
||||
}
|
||||
textOffset = (getHeight() - blockTextMetrics.ascent - blockTextMetrics.descent) / 2;
|
||||
matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + GRADIENT_OFFSET).setDuration(2000);
|
||||
matrixAnim.setRepeatCount(ValueAnimator.INFINITE);
|
||||
matrixAnim.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (matrixAnim != null) {
|
||||
matrixAnim.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
if (x > BLOCK_START_X + blockOffset && x < blockWidth + BLOCK_START_X + blockOffset && y > BLOCK_START_Y && y < getHeight() - BLOCK_START_Y) {
|
||||
isToEnd = false;
|
||||
lastX = x;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (lastX != 0) {
|
||||
blockOffset = (int) (x - lastX);
|
||||
if (blockOffset < 0) {
|
||||
blockOffset = 0;
|
||||
}
|
||||
if (blockOffset + BLOCK_START_X + blockWidth > getWidth()) {
|
||||
// 超出右边界
|
||||
blockOffset = getWidth() - BLOCK_START_X - blockWidth;
|
||||
if (!isToEnd) {
|
||||
isToEnd = true;
|
||||
if (moveToEndListener != null) {
|
||||
moveToEndListener.moveToEnd();
|
||||
}
|
||||
startBlockBackAnim();
|
||||
}
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
// 执行滑块回归动画
|
||||
if (!isToEnd) {
|
||||
startBlockBackAnim();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startBlockBackAnim() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
animator.setInterpolator(new DecelerateInterpolator());
|
||||
animator.setDuration(1000 * blockOffset / getWidth());
|
||||
animator.start();
|
||||
lastX = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
// 画背景
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2, SLIDEPANELVIEW_VIEW_HIGH / 2, bgPaint);
|
||||
// 画文字
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint);
|
||||
canvas.restore();
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint);
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
/**
|
||||
* 滑块滑到了末尾
|
||||
*/
|
||||
void moveToEnd();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/module_mogo_och_autopilot_text_color_normal"/>
|
||||
</selector>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
|
||||
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user