Merge branch 'dev_robotaxi-d-app-module_265_220329_2.6.5' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_265_220329_2.6.5

This commit is contained in:
xinfengkun
2022-04-13 15:26:48 +08:00
168 changed files with 4788 additions and 1219 deletions

View File

@@ -60,6 +60,7 @@ dependencies {
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_v2x
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
@@ -67,6 +68,7 @@ dependencies {
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.MogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.ui.BusPassengerBaseFragment;
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -31,7 +31,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
private FragmentActivity mActivity;
private int mContainerId;
private BusPassengerBaseFragment mBusPassengerFragment;
private BusPassengerRouteFragment mPassengerFragment;
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
@@ -44,7 +44,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
this.mActivity = activity;
this.mContainerId = containerId;
UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
UiThreadHandler.post(() -> stepIntoVrMode());
return null;
}
@@ -84,23 +84,23 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
private void stepIntoVrMode() {
CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "进入vr模式" );
MogoMapUIController.getInstance()
.openVrMode( false );
.stepInVrMode( true ); // 白天模式
}
private void showFragment() {
if (mBusPassengerFragment == null) {
if (mPassengerFragment == null) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备add fragment======");
mBusPassengerFragment = new BusPassengerBaseFragment();
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, mBusPassengerFragment).commitAllowingStateLoss();
mPassengerFragment = new BusPassengerRouteFragment();
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, mPassengerFragment).commitAllowingStateLoss();
return;
}
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备show fragment");
mActivity.getSupportFragmentManager().beginTransaction().show(mBusPassengerFragment).commitAllowingStateLoss();
mActivity.getSupportFragmentManager().beginTransaction().show(mPassengerFragment).commitAllowingStateLoss();
}
private void hideFragment(){
if (mBusPassengerFragment != null){
mActivity.getSupportFragmentManager().beginTransaction().hide(mBusPassengerFragment).commitAllowingStateLoss();
if (mPassengerFragment != null){
mActivity.getSupportFragmentManager().beginTransaction().hide(mPassengerFragment).commitAllowingStateLoss();
}
}
}

View File

@@ -0,0 +1,152 @@
package com.mogo.och.bus.passenger.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.passenger.R;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import java.util.List;
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
/**
* @author: wangmingjun
* @date: 2022/4/6
*/
public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context mContext;
private List<BusPassengerStation> mStations;
private static final int LINE_START_STATION_ITEM = 0;
private static final int LINE_END_STATION_ITEM = 1;
private static final int LINE_MIDDLE_STATION_ITEM = 2;
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
this.mContext = context;
this.mStations = stations;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (viewType == LINE_START_STATION_ITEM){
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_p_stations_start_item,parent,false);
StartStationViewHolder viewHolder = new StartStationViewHolder(view);
return viewHolder;
}else if (viewType == LINE_END_STATION_ITEM) {
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_p_stations_end_item,parent,false);
EndStationViewHolder viewHolder = new EndStationViewHolder(view);
return viewHolder;
}else {
View view = LayoutInflater.from(mContext).inflate(R.layout.bus_p_stations_middle_item,parent,false);
MiddleStationViewHolder viewHolder = new MiddleStationViewHolder(view);
return viewHolder;
}
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
BusPassengerStation station = mStations.get(position);
if (holder instanceof StartStationViewHolder){
StartStationViewHolder viewHolder = (StartStationViewHolder)holder;
viewHolder.startStationName.setText(station.getName());
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
}
}else if (holder instanceof EndStationViewHolder){
EndStationViewHolder viewHolder = (EndStationViewHolder)holder;
viewHolder.endStationName.setText(station.getName());
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())){//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
}
}else {
MiddleStationViewHolder viewHolder = (MiddleStationViewHolder)holder;
viewHolder.middleStationName.setText(station.getName());
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())) {//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
}
}
}
@Override
public int getItemCount() {
return mStations.size();
}
@Override
public int getItemViewType(int position) {
//第一个要显示时间
if (position == 0){
return LINE_START_STATION_ITEM;
}else if (position == mStations.size() -1){
return LINE_END_STATION_ITEM;
}else {
return LINE_MIDDLE_STATION_ITEM;
}
}
}
class StartStationViewHolder extends RecyclerView.ViewHolder{
public TextView startStationName;
public ImageView stationCircle;
public ImageView curStationBg;
public StartStationViewHolder(@NonNull View itemView) {
super(itemView);
startStationName = itemView.findViewById(R.id.bus_p_start_station);
stationCircle = itemView.findViewById(R.id.bus_p_start_circle);
curStationBg = itemView.findViewById(R.id.bus_p_cur_start_station_tag);
}
}
class EndStationViewHolder extends RecyclerView.ViewHolder{
public TextView endStationName;
public ImageView stationCircle;
public ImageView curStationBg;
public EndStationViewHolder(@NonNull View itemView) {
super(itemView);
endStationName = itemView.findViewById(R.id.bus_p_end_station);
stationCircle = itemView.findViewById(R.id.bus_p_end_circle);
curStationBg = itemView.findViewById(R.id.bus_p_cur_end_station_tag);
}
}
class MiddleStationViewHolder extends RecyclerView.ViewHolder{
public TextView middleStationName;
public ImageView curStationBg;
public MiddleStationViewHolder(@NonNull View itemView) {
super(itemView);
middleStationName = itemView.findViewById(R.id.bus_p_middle_station);
curStationBg = itemView.findViewById(R.id.bus_p_middle_tag);
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.och.bus.passenger.bean;
import com.mogo.eagle.core.data.BaseData;
/**
* @author congtaowang
* @since 2021/3/22
*
* 小巴车运营状态返回参数
*/
public class BusPassengerOperationStatusResponse extends BaseData {
public Result data;
public static class Result {
private String sn; //司机屏sn
public String plateNumber; //车牌号
public int serviceStatus;//0:已收车1:已出车
public int businessType;// 车辆类型: taxi/bus
}
}

View File

@@ -0,0 +1,18 @@
package com.mogo.och.bus.passenger.bean;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
public
/**
* @author congtaowang
* @since 2021/3/22
*
* 根据车机行驶线路站点信息
*/
class BusPassengerQueryLineRequest {
private String sn;
public BusPassengerQueryLineRequest(String sn) {
this.sn = sn;
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.och.bus.passenger.bean;
import com.mogo.eagle.core.data.BaseData;
/**
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
*
* @author tongchenfei
*/
public class BusPassengerRoutesResponse extends BaseData {
private BusPassengerRoutesResult data;
public BusPassengerRoutesResult getResult() {
return data;
}
public void setResult(BusPassengerRoutesResult data) {
this.data = data;
}
@Override
public String toString() {
return "OchBusRoutesResponse{" +
"data=" + data +
'}';
}
}

View File

@@ -0,0 +1,59 @@
package com.mogo.och.bus.passenger.bean;
import java.util.List;
/**
* 网约车小巴路线接口返回接口数据封装
*
* @author tongchenfei
*/
public class BusPassengerRoutesResult {
private List<BusPassengerStation> sites;
private int lineId;
private String name; //线路名称
private int lineType; //线路类型0:环形
private String description;
private int status;
private String runningDur; //运营时间
public List<BusPassengerStation> getSites() {
return sites;
}
public int getLineId() {
return lineId;
}
public String getName() {
return name;
}
public int getLineType() {
return lineType;
}
public String getDescription() {
return description;
}
public int getStatus() {
return status;
}
public String getRunningDur() {
return runningDur;
}
@Override
public String toString() {
return "BusPassengerRoutesResult{" +
"sites=" + sites +
", lineId=" + lineId +
", name='" + name + '\'' +
", lineType=" + lineType +
", description='" + description + '\'' +
", status=" + status +
", runningDur='" + runningDur + '\'' +
'}';
}
}

View File

@@ -0,0 +1,137 @@
package com.mogo.och.bus.passenger.bean;
/**
* 单个网约车小巴车站信息
*
* @author wangmingjun
*/
public class BusPassengerStation {
private String name;
private String description;
private String cityCode;
private double lon; //高精坐标
private double lat; //高精坐标
private int businessType; //站点类型9:taxi10:bus
private int status;
private int siteId;
private int seq;
private int drivingStatus;//行驶信息0初始值1已经过2当前站3未到站
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
private boolean leaving;
public void setName(String name) {
this.name = name;
}
public void setDescription(String description) {
this.description = description;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public void setLon(double lon) {
this.lon = lon;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setBusinessType(int businessType) {
this.businessType = businessType;
}
public void setStatus(int status) {
this.status = status;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
public void setSeq(int seq) {
this.seq = seq;
}
public void setDrivingStatus(int drivingStatus) {
this.drivingStatus = drivingStatus;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getCityCode() {
return cityCode;
}
public int getBusinessType() {
return businessType;
}
public int getStatus() {
return status;
}
public int getSiteId() {
return siteId;
}
public int getSeq() {
return seq;
}
public int getDrivingStatus() {
return drivingStatus;
}
public double getLon() {
return lon;
}
public double getLat() {
return lat;
}
public void setIfStop(int ifStop) {
this.ifStop = ifStop;
}
public int getIfStop() {
return ifStop;
}
public void setLeaving(boolean leaving) {
this.leaving = leaving;
}
public boolean isLeaving() {
return leaving;
}
@Override
public String toString() {
return "OchBusStation{" +
"name='" + name + '\'' +
", description='" + description + '\'' +
", cityCode='" + cityCode + '\'' +
", lon=" + lon +
", lat=" + lat +
", businessType=" + businessType +
", status=" + status +
", siteId=" + siteId +
", seq=" + seq +
", drivingStatus=" + drivingStatus +
", ifStop=" + ifStop +
", leaving=" + leaving +
'}';
}
}

View File

@@ -0,0 +1,9 @@
package com.mogo.och.bus.passenger.callback;
/**
* @author: wangmingjun
* @date: 2021/10/22
*/
public interface IBusPassegerDriverStatusCallback {
void changeOperationStatus(boolean changeStatus);
}

View File

@@ -1,6 +1,7 @@
package com.mogo.och.bus.passenger.callback;
import com.amap.api.maps.model.LatLng;
import com.mogo.eagle.core.data.map.MogoLatLng;
import java.util.List;
@@ -10,6 +11,6 @@ import mogo.telematics.pad.MessagePad;
* Created on 2022/3/31
*/
public interface IBusPassengerAutopilotPlanningCallback {
void routeResult(List<MessagePad.Location> models);
void routeResultByServer(List<LatLng> models);
void routeResult(List<LatLng> models);
void routePlanningToNextStationChanged(long meters, long timeInSecond);
}

View File

@@ -0,0 +1,9 @@
package com.mogo.och.bus.passenger.callback;
/**
* @author: wangmingjun
* @date: 2022/3/10
*/
public interface IBusPassengerMapViewCallback {
void onCameraChange(float bearing);
}

View File

@@ -0,0 +1,14 @@
package com.mogo.och.bus.passenger.callback;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import java.util.List;
/**
* @author: wangmingjun
* @date: 2022/4/6
*/
public interface IBusPassengerRouteLineInfoCallback {
void updateLineInfo(String lineName, String lineDurTime);
void updateStationsInfo(List<BusPassengerStation> stations,int currentStationIndex,boolean isArrived);
}

View File

@@ -24,5 +24,21 @@ class BusPassengerConst {
// OCH arouter 路由path
const val PATH = "/och/api"
// 轮询line
const val LOOP_LINE_2S = 2 * 1000L
const val LOOP_DELAY = 100L
// 无状态
const val STATION_STATUS_IDLE = 0
// 已过站(历史站)
const val STATION_STATUS_LEAVING = 1
// 到站(当前站)
const val STATION_STATUS_STOPPED = 2
// 未到站(未到站)
const val STATION_STATUS_ARRIVING = 3
//bus平均速度
const val BUS_AVERAGE_SPEED = 25
}
}

View File

@@ -8,8 +8,10 @@ import android.net.ConnectivityManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.amap.api.maps.model.LatLng;
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -17,14 +19,26 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
import com.mogo.och.bus.passenger.network.BusPassengerServiceCallback;
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
import com.mogo.och.bus.passenger.utils.BPCoordinateCalculateRouteUtil;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -40,6 +54,7 @@ import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
/**
* Created on 2022/3/31
@@ -47,6 +62,8 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS
public class BusPassengerModel {
private static final String TAG = BusPassengerModel.class.getSimpleName();
private List<LatLng> mRoutePoints = new ArrayList<>();
private static final class SingletonHolder {
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
}
@@ -60,6 +77,9 @@ public class BusPassengerModel {
private IBusPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter自动驾驶线路规划
private Map<String, IBusPassengerControllerStatusCallback> mControllerStatusCallbackMap = new ConcurrentHashMap<>();
private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态
private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新
private double mLongitude, mLatitude;
private BusPassengerModel() {
@@ -69,10 +89,81 @@ public class BusPassengerModel {
mContext = context.getApplicationContext();
initListeners();
// TODO: 2022/3/31
queryDriverOperationStatus();
}
public void setDriverStatusCallback(IBusPassegerDriverStatusCallback callback){
this.mDriverStatusCallback = callback;
}
public void setRouteLineInfoCallback(IBusPassengerRouteLineInfoCallback callback){
this.mRouteLineInfoCallback = callback;
}
private void queryDriverOperationStatus() {
BusPassengerServiceManager.getInstance().queryDriverOperationStatus(mContext
, new BusPassengerServiceCallback<BusPassengerOperationStatusResponse>() {
@Override
public void onSuccess(BusPassengerOperationStatusResponse data) {
if (data == null || data.data == null) return;
startOrStopOrderLoop(data.data.serviceStatus == 1);
if(mDriverStatusCallback != null){
mDriverStatusCallback.changeOperationStatus(data.data.serviceStatus == 1);
}
}
@Override
public void onFail(int code, String msg) {
queryDriverOperationStatus();
}
});
}
public void queryDriverSiteByCoordinate(){
BusPassengerServiceManager.getInstance().queryDriverSiteByCoordinate(mContext
, new BusPassengerServiceCallback<BusPassengerRoutesResponse>() {
@Override
public void onSuccess(BusPassengerRoutesResponse data) {
if ( data == null
|| data.getResult() == null
|| data.getResult().getSites() == null) {
return;
}
updatePassengerRouteInfo(data.getResult());
}
@Override
public void onFail(int code, String msg) {
}
});
}
private void updatePassengerRouteInfo(BusPassengerRoutesResult result) {
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
if (result.getSites() != null){
List<BusPassengerStation> stations = result.getSites();
for (int i = 0; i< stations.size(); i++){
BusPassengerStation station = stations.get(i);
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
return;
}else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
startOrStopCalculateRouteInfo(false);
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
return;
}
}
}
}
}
public void release() {
releaseListeners();
startOrStopCalculateRouteInfo(false);
startOrStopOrderLoop(false);
}
public void setMoGoAutopilotPlanningListener(IBusPassengerAutopilotPlanningCallback
@@ -147,7 +238,7 @@ public class BusPassengerModel {
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
if ( NetworkUtils.isConnected( mContext ) ) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// TODO: 2022/3/31
queryDriverOperationStatus();
}
}
}
@@ -246,17 +337,74 @@ public class BusPassengerModel {
@Override
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> trajectoryInfos) {
}
@Override
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
if (null != routeList && routeList.getWayPointsList().size() > 0){
// TODO: 2022/3/31
mAutopilotPlanningCallback.routeResult(routeList.getWayPointsList());
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onAutopilotRotting = "
+ GsonUtil.jsonFromObject(routeList));
List<MessagePad.Location> mRoutePoints = routeList.getWayPointsList();
if (null != routeList && mRoutePoints.size() > 0){
updateRoutePoints(mRoutePoints);
}
}
};
public void dynamicCalculateRouteInfo() {
List<LatLng> lastPoints = BPCoordinateCalculateRouteUtil
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
float lastSumLength = 0;
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
lastSumLength = CoordinateUtils.calculateLineDistance(
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
mLongitude, mLatitude);
}else {
lastSumLength = BPCoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
}
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
}
}
public void updateRoutePoints(List<MessagePad.Location> routePoints) {
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResult(
BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext
, routePoints));
}
//转换成高德坐标系
mRoutePoints.clear();
mRoutePoints.addAll(BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routePoints));
//开启实时计算剩余距离,剩余时间,预计时间
startOrStopCalculateRouteInfo(true);
}
/**
* 开始轮询计算剩余里程和时间
* @param isStart
*/
public void startOrStopCalculateRouteInfo(boolean isStart) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopOrderLoop() " + isStart);
if (isStart) {
BusPassengerModelLoopManager.getInstance().startCalculateRouteInfoLoop();
} else {
mRoutePoints.clear();
BusPassengerModelLoopManager.getInstance().stopCalculateRouteInfLoop();
}
}
private void startOrStopOrderLoop(boolean start) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopOrderLoop() " + start);
if (start) {
BusPassengerModelLoopManager.getInstance().startQueryDriverLineLoop();
} else {
BusPassengerModelLoopManager.getInstance().stopQueryDriverLineLoop();
}
}
}

View File

@@ -0,0 +1,79 @@
package com.mogo.och.bus.passenger.network;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.bus.passenger.model.BusPassengerModel;
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;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_DELAY;
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.LOOP_LINE_2S;
/**
* Created on 2021/11/22
*
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
*/
public class BusPassengerModelLoopManager {
private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName();
private Disposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
private static final class SingletonHolder {
private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager();
}
public static BusPassengerModelLoopManager getInstance() {
return SingletonHolder.INSTANCE;
}
private Disposable mHeartbeatDisposable; //心跳轮询
public void startQueryDriverLineLoop() {
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startQueryDriverLineLoop()");
mHeartbeatDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().queryDriverSiteByCoordinate());
}
public void stopQueryDriverLineLoop() {
if (mHeartbeatDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "stopQueryDriverLineLoop()");
mHeartbeatDisposable.dispose();
mHeartbeatDisposable = null;
}
}
public void startCalculateRouteInfoLoop() {
if (mCalculateRouteDisposable != null && !mCalculateRouteDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startCalculateRouteInfoLoop()");
mCalculateRouteDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().dynamicCalculateRouteInfo());
}
public void stopCalculateRouteInfLoop() {
if (mCalculateRouteDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "stopCalculateRouteInfLoop()");
mCalculateRouteDisposable.dispose();
mCalculateRouteDisposable = null;
}
}
}

View File

@@ -1,9 +1,38 @@
package com.mogo.och.bus.passenger.network;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* Created on 2022/3/31
*
* Bus乘客端接口定义
*/
interface BusPassengerServiceApi {
/**
* 查询bus司机端绑定路线
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
Observable<BusPassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
/**
* 查询司机端出车/收车状态
* @param sn
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
}

View File

@@ -2,14 +2,21 @@ package com.mogo.och.bus.passenger.network;
import android.content.Context;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
@@ -41,9 +48,39 @@ public class BusPassengerServiceManager {
*/
private String getDriverAppSn(){
return CallerTelematicManager.INSTANCE.getServerToken();
// return "X2020210525EFA93B5946FA38D4";
// return "X2020211111NG0XNFK";
}
/**
* 查询绑定行驶的小巴车路线
* @param context
* @param callback
*/
public void queryDriverSiteByCoordinate(Context context
,BusPassengerServiceCallback<BusPassengerRoutesResponse> callback){
mBusPassengerServiceApi.queryDriverSiteByCoordinate(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
,MoGoAiCloudClientConfig.getInstance().getToken()
,new BusPassengerQueryLineRequest(getDriverAppSn()))
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe(getSubscribeImpl(context,callback,"queryDriverSiteByCoordinate"));
}
/**
* 查询司机端出车收车状态,以及车牌号
* @param context
* @param callback
*/
public void queryDriverOperationStatus(Context context, BusPassengerServiceCallback<BusPassengerOperationStatusResponse> callback){
mBusPassengerServiceApi.queryDriverOperationStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
,MoGoAiCloudClientConfig.getInstance().getToken()
,getDriverAppSn())
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe(getSubscribeImpl(context,callback,"queryDriverOperationStatus"));
}
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
Context context, BusPassengerServiceCallback<T> callback, String apiName) {
return new SubscribeImpl<T>(RequestOptions.create(context)) {

View File

@@ -6,25 +6,33 @@ import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.amap.api.maps.model.LatLng;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
import com.mogo.och.bus.passenger.model.BusPassengerModel;
import com.mogo.och.bus.passenger.ui.BusPassengerBaseFragment;
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
import java.util.List;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* Created on 2022/3/31
*/
public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragment> implements
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback {
public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragment> implements
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback, IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
public BaseBusPassengerPresenter(BusPassengerBaseFragment view) {
public BaseBusPassengerPresenter(BusPassengerRouteFragment view) {
super(view);
BusPassengerModel.getInstance().init(AbsMogoApplication.getApp());
initListeners();
@@ -47,11 +55,17 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragmen
private void initListeners() {
BusPassengerModel.getInstance().setADASStatusCallback(this);
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, this);
BusPassengerModel.getInstance().setDriverStatusCallback(this);
BusPassengerModel.getInstance().setRouteLineInfoCallback(this);
BusPassengerModel.getInstance().setMoGoAutopilotPlanningListener(this);
}
private void releaseListeners() {
BusPassengerModel.getInstance().setADASStatusCallback(null);
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, null);
BusPassengerModel.getInstance().setDriverStatusCallback(null);
BusPassengerModel.getInstance().setRouteLineInfoCallback(null);
BusPassengerModel.getInstance().setMoGoAutopilotPlanningListener(null);
}
private void runOnUIThread( Runnable executor ) {
@@ -73,17 +87,20 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragmen
@Override
public void onAutopilotEnable() {
runOnUIThread(() -> mView.onAutopilotStatusChanged(
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE));
}
@Override
public void onAutopilotDisable() {
runOnUIThread(() -> mView.onAutopilotStatusChanged(
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE));
}
@Override
public void onAutopilotRunning() {
runOnUIThread(() -> mView.onAutopilotStatusChanged(
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
}
@Override
@@ -93,6 +110,33 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragmen
@Override
public void onCarLocationChanged(Location location) {
if (location != null){
runOnUIThread(() -> mView.onCarLocationChanged(location));
}
}
@Override
public void changeOperationStatus(boolean changeStatus) {
runOnUIThread(() -> mView.changeOperationStatus(changeStatus));
}
@Override
public void updateLineInfo(String lineName, String lineDurTime) {
runOnUIThread(() -> mView.updateLineInfo(lineName, lineDurTime));
}
@Override
public void updateStationsInfo(List<BusPassengerStation> stations,int currentStationIndex,boolean isArrived) {
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
}
@Override
public void routeResult(List<LatLng> models) {
runOnUIThread(() -> mView.routeResult(models));
}
@Override
public void routePlanningToNextStationChanged(long meters, long timeInSecond) {
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
}
}

View File

@@ -0,0 +1,359 @@
package com.mogo.och.bus.passenger.ui;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.LinearLayout;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.utils.DimenUtil;
/**
* @author: wangmingjun
* @date: 2022/1/21
* 边框阴影
*/
public class BusBorderShadowLayout extends LinearLayout {
private static final String TAG = "ShadowLayout";
//默认阴影半径
public static final float SHADOW_DEFAULT_RADIUS = DimenUtil.INSTANCE.dp2px(5);
//阴影最大偏移量
public static final float SHADOW_MAX_OFFSET = DimenUtil.INSTANCE.dp2px(20);
//阴影最大模糊半径
public static final float SHADOW_MAX_BLUR = DimenUtil.INSTANCE.dp2px(20);
//默认模糊半径
public static final float SHADOW_DEFAULT_BLUR_RADIUS = DimenUtil.INSTANCE.dp2px(5);
//阴影颜色
private int shadowColor = Color.parseColor("#333333");
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
private int shadowType;
//阴影半径
private float shadowRadius = 0f;
//模糊度半径
private float blurRadius = SHADOW_DEFAULT_BLUR_RADIUS ;
//水平位移
private float xOffset = DimenUtil.INSTANCE.dp2px(10);
//竖直方向位移
private float yOffset = DimenUtil.INSTANCE.dp2px(0);
//背景色
private int bgColor = Color.WHITE;
//是否有点击效果
private boolean hasEffect = false ;
int left =0 ,right =0,top = 0,bottom = 0 ;
//代理方式
private IShadow shadow = new BusBorderShadowLayout.ShadowConfig(this);
private float mWidthMode;
private float mHeightMode;
private Paint mPaint = new Paint();
private Paint locationPaint = new Paint();
public BusBorderShadowLayout(Context context) {
super(context,null);
}
public BusBorderShadowLayout(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public BusBorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.setLayerType(LAYER_TYPE_SOFTWARE, null);//取消硬件加速
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
shadowColor = typedArray.getColor(R.styleable.ShadowLayout_shadowColor, Color.BLUE);
blurRadius = typedArray.getDimension(R.styleable.ShadowLayout_blurRadius, SHADOW_DEFAULT_BLUR_RADIUS);
shadowRadius = typedArray.getDimension(R.styleable.ShadowLayout_shadowRadius,0);
hasEffect = typedArray.getBoolean(R.styleable.ShadowLayout_hasEffect, false);
xOffset = typedArray.getDimension(R.styleable.ShadowLayout_xOffset,DimenUtil.INSTANCE.dp2px(10));
yOffset = typedArray.getDimension(R.styleable.ShadowLayout_yOffset,DimenUtil.INSTANCE.dp2px(10));
bgColor = typedArray.getColor(R.styleable.ShadowLayout_bgColor,Color.WHITE);
typedArray.recycle();
if (shadowRadius<0){
shadowRadius = -shadowRadius;
}
if (blurRadius < 0) {
blurRadius = -blurRadius;
}
blurRadius = Math.min(SHADOW_MAX_BLUR,blurRadius);
if (Math.abs(xOffset)> SHADOW_MAX_OFFSET){
xOffset = xOffset/Math.abs(xOffset) * SHADOW_MAX_OFFSET;
}
if (Math.abs(yOffset) > SHADOW_MAX_OFFSET){
yOffset = yOffset/Math.abs(yOffset) * SHADOW_MAX_OFFSET;
}
init();
}
private void init(){
setBackgroundColor(Color.parseColor("#00ffffff"));
if (xOffset>0){
//水平偏移量为正数右侧有阴影阴影长度为blurRadius+|xOffset|
right = (int)(blurRadius + Math.abs(xOffset));
}else if (xOffset==0){
//水平偏移为0,水平间距为blurRadius
left = (int)blurRadius;
right = (int)blurRadius;
}else {
//水平偏移为负数,左侧有阴影阴影长度为blurRadius+|xOffset|
left = (int)(blurRadius + Math.abs(xOffset));
}
if (yOffset>0){
//竖直偏移量为正数底部有阴影阴影长度为blurRadius+|yOffset|
bottom = (int)(blurRadius + Math.abs(yOffset));
}else if (yOffset==0){
//竖直偏移量为0竖直间距为blurRadius
top = (int)blurRadius;
bottom = (int)blurRadius;
}else {
//竖直偏移量为负数顶部有阴影阴影长度为blurRadius+|yOffset|
top = (int)(blurRadius + Math.abs(yOffset));
}
setPadding(left,top,right,bottom);
}
/**
* 获取阴影设置
* @return 返回阴影设置配置
*/
public IShadow getShadowConfig(){
return shadow;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed,l,t,r,b);
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
}
@Override
protected void onDraw(Canvas canvas) {
drawBackground(canvas);//放在super前是后景相反是前景前景会覆盖子布局
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
//绘制背景色(在子view底部)
private void drawBackground(Canvas canvas){
mWidthMode = getMeasuredWidth();
mHeightMode = getMeasuredHeight();
float startX = 0;
float startY = 0;
float endX = 0;
float endY = 0;
if (xOffset==0){
startX = right;
endX = mWidthMode-blurRadius;
}else {
startX = right+blurRadius;
endX = mWidthMode-left-blurRadius;
}
if (yOffset==0){
startY = bottom;
endY = mHeightMode-blurRadius;
}else {
startY = bottom+blurRadius;
endY = mHeightMode-top-blurRadius;
}
// mPaint.setShadowLayer(blurRadius,0,0,shadowColor);
if (blurRadius>0){
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
}
mPaint.setColor(shadowColor);
mPaint.setAntiAlias(true);
RectF shadowRect = new RectF(startX,startY,endX,endY);
RectF locationRectF = new RectF(left,top,mWidthMode-right,mHeightMode-bottom);
if (shadowRadius==0){
//不是圆角
canvas.drawRect(shadowRect,mPaint);
}else {
//圆角角度为shadowRadius
canvas.drawRoundRect(shadowRect,shadowRadius,shadowRadius,mPaint);
}
locationPaint.setColor(bgColor);
locationPaint.setAntiAlias(true);
if (shadowRadius==0){
//不是圆角
canvas.drawRect(locationRectF,locationPaint);
}else {
//圆角角度为shadowRadius
canvas.drawRoundRect(locationRectF,shadowRadius,shadowRadius,locationPaint);
}
}
/**
* 阴影配置
*/
class ShadowConfig implements IShadow {
//代理
private BusBorderShadowLayout shadow;
private ShadowConfig(BusBorderShadowLayout shadow) {
this.shadow = shadow;
}
@Override
public IShadow setShadowRadius(float radius) {
return setShadowRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
}
@Override
public IShadow setShadowRadius(int unit, float radius) {
Context c = getContext();
Resources r;
if (c == null) {
r = Resources.getSystem();
} else {
r = c.getResources();
}
shadow.shadowRadius = Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics()));
return this;
}
@Override
public IShadow setShadowColor(int color) {
shadow.shadowColor = color;
return this;
}
@Override
public IShadow setShadowColorRes(int colorRes) {
shadow.shadowColor = shadow.getResources().getColor(colorRes);
return this;
}
@Override
public IShadow setBlurRadius(float radius) {
return setBlurRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
}
@Override
public IShadow setBlurRadius(int unit, float radius) {
Context c = getContext();
Resources r;
if (c == null) {
r = Resources.getSystem();
} else {
r = c.getResources();
}
shadow.blurRadius = Math.min(SHADOW_MAX_BLUR,Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics())));
return this;
}
@Override
public IShadow setXOffset(float offset) {
return setXOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
}
@Override
public IShadow setXOffset(int unit, float offset) {
Context c = getContext();
Resources r;
if (c == null) {
r = Resources.getSystem();
} else {
r = c.getResources();
}
float x = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
if (Math.abs(x)> SHADOW_MAX_OFFSET){
x = x/Math.abs(x) * SHADOW_MAX_OFFSET;
}
shadow.xOffset = x;
return this;
}
@Override
public IShadow setYOffset(float offset) {
return setYOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
}
@Override
public IShadow setYOffset(int unit, float offset) {
Context c = getContext();
Resources r;
if (c == null) {
r = Resources.getSystem();
} else {
r = c.getResources();
}
float y = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
if (Math.abs(y)> SHADOW_MAX_OFFSET){
y = y/Math.abs(y) * SHADOW_MAX_OFFSET;
}
shadow.yOffset = y;
return this;
}
@Override
public void commit() {
shadow.init();
shadow.requestLayout();
shadow.postInvalidate();
}
}
}

View File

@@ -1,32 +1,42 @@
package com.mogo.och.bus.passenger.ui;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.NonNull;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import org.jetbrains.annotations.NotNull;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.utils.BPDateTimeUtil;
/**
* Created on 2022/3/31
*
* <p>
* Bus乘客端基础Fragment
*/
public class BusPassengerBaseFragment extends MvpFragment<BusPassengerBaseFragment, BaseBusPassengerPresenter> {
public abstract class BusPassengerBaseFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> {
private static final String TAG = BusPassengerBaseFragment.class.getSimpleName();
private Handler mHandler = new Handler(Looper.getMainLooper());
private TextView mCurrentArriveStation;
private TextView mCurrentArriveStationTitle;
private TextView mCurrentArriveTip;
private ImageView mAutopilotIv;
private FrameLayout flContainer;
@NonNull
@NotNull
@Override
protected BaseBusPassengerPresenter createPresenter() {
return new BaseBusPassengerPresenter(this);
}
/**
* 改变自动驾驶状态
*
* @param status 2 - running 1 - enable 2 - disable
*/
private int mPrevAPStatus = -1;
@Override
protected int getLayoutId() {
@@ -38,9 +48,95 @@ public class BusPassengerBaseFragment extends MvpFragment<BusPassengerBaseFragme
return TAG;
}
@Override
protected void initViews() {
//隐藏小地图
CallerSmpManager.INSTANCE.hidePanel();
mCurrentArriveStation = findViewById(R.id.bus_p_cur_station_name);
mCurrentArriveStationTitle = findViewById(R.id.bus_p_cur_station_title);
mCurrentArriveTip = findViewById(R.id.bus_p_cur_station_tip);
mAutopilotIv = findViewById(R.id.bus_p_autopilot_iv);
showRouteFragment();
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
}
/**
* 获取站点面板view在{@link #initViews()}时候添加到container中
*
* @return 站点面板view
*/
public abstract int getStationPanelViewId();
/**
* 显示线路信息
*/
public void showRouteFragment() {
flContainer = findViewById(R.id.bus_p_route_panel);
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flContainer);
}
public void updateArrivedStation(String station,int currentIndex,boolean isArrived){
if (null == station){
mCurrentArriveStation.setText("----");
}else {
mCurrentArriveStation.setText(station);
if (currentIndex == 0){
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title_init));
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip_init));
return;
}
if (isArrived){
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title));
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip));
}else {
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_next_station_title));
}
}
}
public void updateRoutePlanningToNextStation(long meters, long timeInSecond){
String dis = "0";
String disUnit = "公里";
if (meters > 0){
if (meters / 1000 < 1){
disUnit = "";
dis = String.valueOf(Math.round(meters));
}else {
disUnit = "公里";
dis = BPDateTimeUtil.formatLong((double)meters / 1000);
}
}
String strHtml2 = "<font color=\"#2D3E5F\">距离 </font>" + "<b><font color=\"#0043FF\">" + dis + "</font></b>" + "<font color=\"#2D3E5F\"> "+disUnit+"</font>"
+ "<font color=\"#2D3E5F\">"+" "+"剩余 </font>" + "<b><font color=\"#0043FF\">" + (int)Math.ceil((double)timeInSecond/ 60f) + "</font></b>" + "<font color=\"#2D3E5F\"> 分钟</font>";
mCurrentArriveTip.setText(Html.fromHtml(strHtml2));
}
public void onAutopilotStatusChanged(int status) {
getActivity().runOnUiThread(() -> {
// 3. 其他过程直接更新
if (mPrevAPStatus != status){
AutopilotStatusChanged(status);
}
mPrevAPStatus = status;
});
}
public void AutopilotStatusChanged(int status) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
mAutopilotIv.setImageResource(R.drawable.bus_p_auto_nor);
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status){
mAutopilotIv.setImageResource(R.drawable.bus_p_un_auto_nor);
} else {
mAutopilotIv.setImageResource(R.drawable.bus_p_un_auto_nor);
}
}
}

View File

@@ -0,0 +1,357 @@
package com.mogo.och.bus.passenger.ui;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import androidx.annotation.Nullable;
import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.CustomMapStyleOptions;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.Polyline;
import com.amap.api.maps.model.PolylineOptions;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.callback.IBusPassengerMapViewCallback;
import com.mogo.och.bus.passenger.utils.BusPassengerMapAssetStyleUtil;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* 乘客屏小地图
*/
public class BusPassengerMapDirectionView
extends RelativeLayout
implements IMoGoMapLocationListener, IBusPassengerMapDirectionView, AMap.OnCameraChangeListener {
//小地图名称
public static final String TAG = "TPMapDirectionView";
private TextureMapView mAMapNaviView;
private AMap mAMap;
private Marker mCarMarker;
private Marker mStartMarker;
private Marker mEndMarker;
private int zoomLevel = 13;
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
private List<LatLng> mWayPointsLatLng = new ArrayList<>();
private Polyline mPolyline;
private CameraUpdate mCameraUpdate;
private Context mContext;
private List<Integer> colorList = new ArrayList<>();
private IBusPassengerMapViewCallback mIBusPassengerMapViewCallback;
public BusPassengerMapDirectionView(Context context) {
this(context, null);
}
public BusPassengerMapDirectionView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public BusPassengerMapDirectionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
try {
initView(context);
} catch (Exception e) {
e.printStackTrace();
}
}
public void setTaxiPassengerMapViewCallback(IBusPassengerMapViewCallback iBusPassengerMapViewCallback){
this.mIBusPassengerMapViewCallback = iBusPassengerMapViewCallback;
}
private void initView(Context context) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "initView");
mContext = context;
View smpView = LayoutInflater.from(context).inflate(R.layout.bus_p_map_view, this);
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.bus_p_line_amap_view);
initAMapView();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
}
private void initAMapView() {
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
mAMap = mAMapNaviView.getMap();
// 设置导航地图模式aMap是地图控制器对象。
mAMap.setMapType(AMap.MAP_TYPE_NIGHT);
// 关闭显示实时路况图层aMap是地图控制器对象。
mAMap.setTrafficEnabled(false);
// 设置 锚点 图标
mCarMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_car))
.anchor(0.5f, 0.5f));
mStartMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_start)));
mEndMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_end)));
// 加载自定义样式
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
.setEnable(true)
.setStyleData(BusPassengerMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
.setStyleExtraData(BusPassengerMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
// 设置自定义样式
mAMap.setCustomMapStyle(customMapStyleOptions);
//设置希望展示的地图缩放级别
mAMap.moveCamera(mCameraUpdate);
// 设置地图的样式
UiSettings uiSettings = mAMap.getUiSettings();
uiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮
uiSettings.setAllGesturesEnabled(false);// 所有手势
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
@Override
public void onMapLoaded() {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "smp---onMapLoaded");
// 加载自定义样式
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
.setEnable(true)
.setStyleData(BusPassengerMapAssetStyleUtil.getAssetsStyle(getContext(),"map_style.data"))
.setStyleExtraData(BusPassengerMapAssetStyleUtil.getAssetsExtraStyle(getContext(),"map_style_extra.data"));
// 设置自定义样式
mAMap.setCustomMapStyle(customMapStyleOptions);
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
}
});
//设置地图状态的监听接口
mAMap.setOnCameraChangeListener(this);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
@Override
public void onLocationChanged(@Nullable MogoLocation location) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude());
if (location == null){
return;
}
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
//更新车辆位置
if (mCarMarker != null) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "location.getBearing() = " + location.getBearing());
mCarMarker.setRotateAngle(360 - location.getBearing());
mCarMarker.setPosition(currentLatLng);
mCarMarker.setToTop();
}
if (mCoordinatesLatLng.size() > 1) {
//圈定地图显示范围
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
LatLng startLatLng = mCoordinatesLatLng.get(0);
//存放经纬度
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
boundsBuilder.include(startLatLng);
boundsBuilder.include(endLatLng);
for (int i=0;i < mWayPointsLatLng.size();i++){
boundsBuilder.include(mWayPointsLatLng.get(i));
}
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(), 100));
} else {
//设置希望展示的地图缩放级别
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
@Override
public void drawablePolyline() {
clearPolyline();
if (mAMap != null) {
addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
// 设置开始结束Marker位置
LatLng startLatLng = mCoordinatesLatLng.get(0);
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
mStartMarker.setPosition(startLatLng);
mEndMarker.setPosition(endLatLng);
mStartMarker.setVisible(true);
mEndMarker.setVisible(true);
//设置线段纹理
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.addAll(mCoordinatesLatLng);
polylineOptions.colorValues(colorList);
polylineOptions.useGradient(true);
polylineOptions.width(10); //线段宽度
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
}
if (mWayPointsLatLng.size() > 0){
for (int i =0 ;i< mWayPointsLatLng.size(); i++){
Marker mWayPointMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_way_point)));
mWayPointMarker.setPosition(mWayPointsLatLng.get(i));
mWayPointMarker.setVisible(true);
}
}
}
}
/**
* 添加画线颜色值
*/
private void addRouteColorList() {
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
colorList.add(Color.argb(255, 70, 147, 253));//路线颜色
}
}
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng) {
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
LatLng latLng = mCoordinateConverter.convert();
return latLng;
}
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
List<LatLng> list = new ArrayList<>();
for (MogoLatLng m : mogoLatLngList) {
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
list.add(mogoLatLng);
}
return list;
}
@Override
public void clearPolyline() {
if (mPolyline != null) {
mPolyline.remove();
}
if (mStartMarker != null) {
mStartMarker.setVisible(false);
}
if (mEndMarker != null) {
mEndMarker.setVisible(false);
}
}
public void resetPolyine() {
mCoordinatesLatLng.clear();
if (mPolyline != null) {
mPolyline.remove();
}
if (mStartMarker != null) {
mStartMarker.setVisible(false);
}
if (mEndMarker != null) {
mEndMarker.setVisible(false);
}
}
public void onCreateView(Bundle savedInstanceState) {
if (mAMapNaviView != null) {
mAMapNaviView.onCreate(savedInstanceState);
}
}
public void onResume() {
if (mAMapNaviView != null) {
mAMapNaviView.onResume();
}
}
public void onPause() {
if (mAMapNaviView != null) {
mAMapNaviView.onPause();
}
}
public void onDestroy() {
if (mAMapNaviView != null) {
mAMapNaviView.onDestroy();
}
}
public void convert(List<MogoLatLng> coordinates) {
mCoordinatesLatLng.clear();
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs){
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
}
public void setWayPointMarker(List<LatLng> wayPointLatLngs){
mWayPointsLatLng.clear();
mCoordinatesLatLng.addAll(wayPointLatLngs);
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mIBusPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);
}
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
}
}

View File

@@ -0,0 +1,435 @@
package com.mogo.och.bus.passenger.ui;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.adapter.BusPassengerLineStationsAdapter;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassengerMapViewCallback;
import com.mogo.och.bus.passenger.model.BusPassengerModel;
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* @author: wangmingjun
* @date: 2022/4/12
*/
public class BusPassengerRouteFragment extends
BusPassengerBaseFragment<BusPassengerRouteFragment, BaseBusPassengerPresenter> implements IBusPassengerMapViewCallback {
private final String TAG = "BusPassengerRouteFragment";
private BusPassengerTrafficLightView mTrafficLightView;
private List<BusPassengerStation> mStationsList = new ArrayList<>();
private List<LatLng> mWayPointsList = new ArrayList<>();
private TextView mSpeedTv;
private ConstraintLayout mNoLineInfoView;
private TextView mCarPlateNum;
private TextView mLineName;
private TextView mOperationTime;
private ConstraintLayout mRouteInfoView;
private RecyclerView mStationsListRv;
private BusPassengerMapDirectionView mMapDirectionView;
private ImageView mMapArrowIcon;
private RotateAnimation rotateAnimation;
private float lastBearing = 0;
private BusPassengerLineStationsAdapter mAdapter;
@Override
public int getStationPanelViewId() {
return R.layout.bus_p_route_fragment;
}
@NonNull
@Override
protected BaseBusPassengerPresenter createPresenter() {
return new BaseBusPassengerPresenter(this);
}
@Override
protected void initViews() {
super.initViews();
mTrafficLightView = findViewById(R.id.bus_p_traffic_light_view);
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
mSpeedTv = findViewById(R.id.bus_p_speed_tv);
mNoLineInfoView =findViewById(R.id.bus_p_no_order_data_view);
mCarPlateNum = findViewById(R.id.bus_p_driver_num_plate_tv);
mLineName = findViewById(R.id.bus_p_line_name_tv);
mOperationTime = findViewById(R.id.line_operation_time_tv);
mRouteInfoView = findViewById(R.id.bus_p_line_cl);
mStationsListRv = findViewById(R.id.bus_p_line_stations_rl);
LinearLayoutManager manager = new LinearLayoutManager(getContext());
mStationsListRv.setLayoutManager(manager);
mAdapter = new BusPassengerLineStationsAdapter(getContext(), mStationsList);
mStationsListRv.setAdapter(mAdapter);
mMapArrowIcon = findViewById(R.id.bus_p_arrow_nor);
//测试
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String listStr = "{\"models\":[{\n" +
"\t\t\"lat\": 40.19927810144466,\n" +
"\t\t\"lon\": 116.73527259387767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927836356079,\n" +
"\t\t\"lon\": 116.73513114732762\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19927759500293,\n" +
"\t\t\"lon\": 116.73497660879111\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199264819842284,\n" +
"\t\t\"lon\": 116.73480063747202\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992510141554,\n" +
"\t\t\"lon\": 116.73463922037767\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199245872804,\n" +
"\t\t\"lon\": 116.73445960685193\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924673374912,\n" +
"\t\t\"lon\": 116.73427704009703\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924747108264,\n" +
"\t\t\"lon\": 116.7340707102972\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924828745573,\n" +
"\t\t\"lon\": 116.73385916927226\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924941093133,\n" +
"\t\t\"lon\": 116.73364048294795\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924939253381,\n" +
"\t\t\"lon\": 116.73340837408566\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19924949105934,\n" +
"\t\t\"lon\": 116.73317368725336\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19925040039033,\n" +
"\t\t\"lon\": 116.73296532811216\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992515355653,\n" +
"\t\t\"lon\": 116.73277787366743\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1992512720328,\n" +
"\t\t\"lon\": 116.73263377253741\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.199205174954606,\n" +
"\t\t\"lon\": 116.73249773114644\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1991015743076,\n" +
"\t\t\"lon\": 116.7324219601283\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198971862686285,\n" +
"\t\t\"lon\": 116.73239393296355\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19883883071582,\n" +
"\t\t\"lon\": 116.73237676435652\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19870171355796,\n" +
"\t\t\"lon\": 116.73236052150362\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1985491853193,\n" +
"\t\t\"lon\": 116.73234157857011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1983890047355,\n" +
"\t\t\"lon\": 116.73232167996464\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1982209877466,\n" +
"\t\t\"lon\": 116.73230101645792\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.198037574138326,\n" +
"\t\t\"lon\": 116.73227735486083\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19787327856243,\n" +
"\t\t\"lon\": 116.73225676816314\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19771917207499,\n" +
"\t\t\"lon\": 116.73223814728027\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197548305175935,\n" +
"\t\t\"lon\": 116.73221624705808\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19739568979691,\n" +
"\t\t\"lon\": 116.73219618210774\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19724703821575,\n" +
"\t\t\"lon\": 116.73217598293311\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1970956560885,\n" +
"\t\t\"lon\": 116.73215773721505\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19697703483188,\n" +
"\t\t\"lon\": 116.73214337172284\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19687000725696,\n" +
"\t\t\"lon\": 116.73210037067965\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196833449601726,\n" +
"\t\t\"lon\": 116.73196646708011\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19685833847804,\n" +
"\t\t\"lon\": 116.73181315361103\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.196889170203264,\n" +
"\t\t\"lon\": 116.73164355747393\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19692242860347,\n" +
"\t\t\"lon\": 116.7314555399657\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19696431701069,\n" +
"\t\t\"lon\": 116.7312261834129\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19700025925464,\n" +
"\t\t\"lon\": 116.73102774016093\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19703414798773,\n" +
"\t\t\"lon\": 116.73084270562073\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19707287604138,\n" +
"\t\t\"lon\": 116.73062835248406\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19710951629977,\n" +
"\t\t\"lon\": 116.73041744082339\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19714593807105,\n" +
"\t\t\"lon\": 116.73021414314803\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197183297026285,\n" +
"\t\t\"lon\": 116.7300057066447\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.1972247359487,\n" +
"\t\t\"lon\": 116.7297751515664\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19726518822745,\n" +
"\t\t\"lon\": 116.72954958923812\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19730538240706,\n" +
"\t\t\"lon\": 116.72932440756041\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19734272112662,\n" +
"\t\t\"lon\": 116.72911631453036\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197379191549075,\n" +
"\t\t\"lon\": 116.72890982812105\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197417565369314,\n" +
"\t\t\"lon\": 116.72869447869044\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19746052080799,\n" +
"\t\t\"lon\": 116.72845641541247\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19750040582118,\n" +
"\t\t\"lon\": 116.72823569991117\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19753999704064,\n" +
"\t\t\"lon\": 116.72801998373052\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19757796882569,\n" +
"\t\t\"lon\": 116.72781280504363\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197617062364586,\n" +
"\t\t\"lon\": 116.72759949431683\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19765391602761,\n" +
"\t\t\"lon\": 116.72739776789756\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19768973009218,\n" +
"\t\t\"lon\": 116.72719980764646\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.197726191028785,\n" +
"\t\t\"lon\": 116.72699719861669\n" +
"\t}, {\n" +
"\t\t\"lat\": 40.19776233489642,\n" +
"\t\t\"lon\": 116.72679516155276\n" +
"\t}]}\n";
List<MessagePad.Location> list = new ArrayList<>();
try {
JSONObject jsonObject = new JSONObject(listStr);
JSONArray jsonElements = jsonObject.getJSONArray("models");
for (int i = 0; i < jsonElements.length(); i++){
JSONObject s = jsonElements.getJSONObject(i);
MessagePad.Location.Builder routeModels = MessagePad.Location.newBuilder();
routeModels.setLatitude(s.getDouble("lat"));
routeModels.setLongitude(s.getDouble("lon"));
list.add(routeModels.build());
}
BusPassengerModel.getInstance().updateRoutePoints(list);
} catch (JSONException e) {
e.printStackTrace();
}
return false;
}
});
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mMapDirectionView = findViewById(R.id.bus_p_line_map_view);
mMapDirectionView.onCreateView(savedInstanceState);
mMapDirectionView.setTaxiPassengerMapViewCallback(this);
}
@Override
public void onResume() {
super.onResume();
if (mMapDirectionView != null) {
mMapDirectionView.onResume();
}
}
@Override
public void onPause() {
super.onPause();
if (mMapDirectionView != null) {
mMapDirectionView.onPause();
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (mMapDirectionView != null) {
mMapDirectionView.onDestroy();
}
}
public void routeResult(List<LatLng> latLngList) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "routeResult:" + latLngList.size());
if (latLngList.size() > 0) {
drawablePolyline(latLngList);
} else {
clearPolyline();
}
}
/**
* 绘制
*
* @param coordinates
*/
private void drawablePolyline(List<LatLng> coordinates) {
if (mMapDirectionView != null) {
mMapDirectionView.setWayPointMarker(mWayPointsList);
mMapDirectionView.setCoordinatesLatLng(coordinates);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.drawablePolyline();
}
});
}
}
private void clearPolyline() {
if (mMapDirectionView != null) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.clearPolyline();
}
});
}
}
public void changeOperationStatus(boolean status) {
if (status) {
mNoLineInfoView.setVisibility(View.GONE);
mRouteInfoView.setVisibility(View.VISIBLE);
} else {
mNoLineInfoView.setVisibility(View.VISIBLE);
mRouteInfoView.setVisibility(View.GONE);
}
}
public void updateLineInfo(String lineName, String lineDurTime) {
if (!mLineName.getText().toString().equals(lineName)
|| !mOperationTime.getText().toString().equals(lineDurTime)
|| !mCarPlateNum.getText().toString().equals(AppConfigInfo.INSTANCE.getPlateNumber())){
mLineName.setText(lineName);
mOperationTime.setText(lineDurTime);
mCarPlateNum.setText(null == AppConfigInfo.INSTANCE.getPlateNumber() ? "-- --" : AppConfigInfo.INSTANCE.getPlateNumber());
}
}
public void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex,boolean isArrived) {
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
mStationsList.clear();
mStationsList.addAll(stations);
mAdapter.notifyDataSetChanged();
if (stations.size() > 2){
updateWayPointList(stations);
}
}
private void updateWayPointList(List<BusPassengerStation> stations) {
mWayPointsList.clear();
for (int i = 1; i< stations.size() -1; i++) {//去除路线的起点和终点, 只要中间途径站点
LatLng latLng = new LatLng(stations.get(i).getLat(),stations.get(i).getLon());// lat,lon
mWayPointsList.add(latLng);
}
}
@Override
public void onCameraChange(float bearing) {
startIvCompass(bearing);
}
/**
* 设置指南针旋转
*
* @param bearing
*/
private void startIvCompass(float bearing) {
bearing = 360 - bearing;
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startIvCompass: " + bearing);
rotateAnimation = new RotateAnimation(lastBearing, bearing, Animation.RELATIVE_TO_SELF
, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setFillAfter(true);
mMapArrowIcon.startAnimation(rotateAnimation);
lastBearing = bearing;
}
public void onCarLocationChanged(Location location) {
updateSpeedView(location.getSpeed());
}
public void updateSpeedView(float speed){
int speedKM = (int) (Math.abs(speed) * 3.6F);
mSpeedTv.setText(String.valueOf(speedKM));
}
}

View File

@@ -0,0 +1,166 @@
package com.mogo.och.bus.passenger.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.R;
import org.jetbrains.annotations.Nullable;
/**
* bus乘客端红绿灯view
*
* Created on 2022/3/14
*/
public class BusPassengerTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private TextView mLightTimeTV;
private int mCurrentLightId;
public BusPassengerTrafficLightView(@Nullable Context context) {
this(context, null, 0);
}
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public BusPassengerTrafficLightView(@Nullable Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
LayoutInflater.from(context).inflate(R.layout.bus_p_traffic_light_view, this, true);
mLightIconIV = findViewById(R.id.bus_p_traffic_light_iv);
mLightTimeTV = findViewById(R.id.bus_p_traffic_light_time_tv);
}
/**
* 展示红绿灯预警
*
* @param checkLightId 0-都是默认1-红2-黄3-绿
*/
@Override
public void showWarningTrafficLight(int checkLightId) {
super.showWarningTrafficLight(checkLightId);
mCurrentLightId = checkLightId;
updateTrafficLightIcon(checkLightId);
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/
@Override
public void disableWarningTrafficLight() {
super.disableWarningTrafficLight();
UiThreadHandler.post(() -> {
mCurrentLightId = 0;
BusPassengerTrafficLightView.this.setVisibility(GONE);
});
}
/**
* @param redNum 红灯倒计时
* @param yellowNum 黄灯倒计时
* @param greenNum 绿灯倒计时
*/
@Override
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
switch (mCurrentLightId) {
case 1:
changeCountdownRed(redNum);
break;
case 2:
changeCountdownYellow(yellowNum);
break;
case 3:
changeCountdownGreen(greenNum);
break;
default:
UiThreadHandler.post(() -> {
mLightTimeTV.setText("");
});
break;
}
}
@Override
public void changeCountdownRed(int redNum) {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
// mLightTimeTV.setVertrial(true);
// mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_p_traffic_light_red_color_up),
// getResources().getColor(R.color.bus_p_traffic_light_red_color_down)});
mLightTimeTV.setText(String.valueOf(redNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownGreen(int greenNum) {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
// mLightTimeTV.setVertrial(true);
// mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_p_traffic_light_green_color_up),
// getResources().getColor(R.color.bus_p_traffic_light_green_color_down)});
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
mLightTimeTV.setText("");
}
});
}
@Override
public void changeCountdownYellow(int yellowNum) {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
// mLightTimeTV.setVertrial(true);
// mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.bus_p_traffic_light_yellow_color_up),
// getResources().getColor(R.color.bus_p_traffic_light_yellow_color_down)});
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
mLightTimeTV.setText("");
}
});
}
/**
* 更新红绿灯icon
*
* @param lightId 0-都是默认1-红2-黄3-绿
*/
private void updateTrafficLightIcon(int lightId) {
UiThreadHandler.post(() -> {
switch (lightId) {
case 1:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_red_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_yellow_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_green_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
default:
BusPassengerTrafficLightView.this.setVisibility(GONE);
break;
}
});
}
}

View File

@@ -0,0 +1,18 @@
package com.mogo.och.bus.passenger.ui;
/**
* @author xiaoyuzhou
* @date 2021/6/24 11:33 上午
*/
public interface IBusPassengerMapDirectionView {
/**
* 绘制路径线
*/
void drawablePolyline();
/**
* 清除路径线
*/
void clearPolyline();
}

View File

@@ -0,0 +1,65 @@
package com.mogo.och.bus.passenger.ui
import androidx.annotation.ColorRes
/**
* @author: wangmingjun
* @date: 2022/1/21
*/
interface IShadow {
//设置阴影半径
fun setShadowRadius(radius:Float):IShadow
//添加单位设置
fun setShadowRadius(unit:Int,radius: Float):IShadow
//设置应用颜色
fun setShadowColor(color:Int):IShadow
//设置阴影颜色资源文件id
fun setShadowColorRes(@ColorRes color: Int):IShadow
/**
* 设置模糊半径
* @param radius
*/
fun setBlurRadius(radius:Float):IShadow
/**
*
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
* @param radius 模糊半径
*/
fun setBlurRadius(unit:Int,radius:Float):IShadow
/**
* 设置水平方向的偏移量
* @param offset x轴偏移
*/
fun setXOffset(offset:Float):IShadow
/**
* 设置x方向的偏移量,设置单位
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
* @param offset x轴偏移
*/
fun setXOffset(unit:Int,offset:Float):IShadow
/**
* 设置竖直方向的偏移量
* @param offset y轴偏移
*/
fun setYOffset(offset:Float):IShadow
/**
* 设置竖直方向的偏移量,带单位
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
* @param offset y轴偏移
*/
fun setYOffset(unit:Int,offset:Float):IShadow
/**
* 更新绘制
*/
fun commit();
}

View File

@@ -0,0 +1,95 @@
package com.mogo.och.bus.passenger.utils;
import android.content.Context;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.model.LatLng;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
/**
* @author: wangmingjun
* @date: 2022/3/28
*/
public class BPCoordinateCalculateRouteUtil {
public static float calculateRouteSumLength(List<LatLng> points){
if (null == points || points.size() == 0) return 0;
float sumLength = 0;
//计算全路径总距离
for (int i = 0;i + 1< points.size();i++){
double preLat = points.get(i).latitude;
double preLon = points.get(i).longitude;
double laLat = points.get(i+1).latitude;
double laLon = points.get(i+1).longitude;
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
sumLength += length;
}
return sumLength;
}
public static List<LatLng> coordinateConverterWgsToGcjListCommon(Context mContext, List<MessagePad.Location> models) {
//转成MogoLatLng集合
List<LatLng> list = new ArrayList<>();
for (MessagePad.Location m : models) {
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
list.add(mogoLatLng);
}
return list;
}
public static LatLng coordinateConverterWgsToGcj(Context mContext, MessagePad.Location mogoLatLng) {
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
mCoordinateConverter.coord(new LatLng(mogoLatLng.getLatitude(), mogoLatLng.getLongitude()));
LatLng latLng = mCoordinateConverter.convert();
return latLng;
}
/**
* 简单粗暴 直接比较 todo 需要优化
* @param mRoutePoints
* @param realLon
* @param realLat
* @return
*/
public static List<LatLng> getRemainPointListByCompare(List<LatLng> mRoutePoints,double realLon,double realLat) {
List<LatLng> latePoints = new ArrayList<>();
int currentIndex = 0; //记录疑似点
if (mRoutePoints.size() > 0){
//基础点
LatLng baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
}
}
Logger.d(M_BUS_P + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
if (currentIndex == mRoutePoints.size()-1){
latePoints.add(mRoutePoints.get(currentIndex));
}else {
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
}
return latePoints;
}
return latePoints;
}
}

View File

@@ -0,0 +1,109 @@
package com.mogo.och.bus.passenger.utils;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* @author: wangmingjun
* @date: 2021/8/20
*/
public class BPDateTimeUtil {
public static final String TAXI_HH_mm = "HH:mm";
public static final String TAXI_MM_dd = "MM-dd";
public static final String TAXI_MM_dd_HH_mm = "MM-dd HH:mm";
public static final String TAXI_yyyy_MM_dd = "yyyy-MM-dd";
public static final String TAXI_yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
public static String formatCalendarToString(Calendar calendar, String format){
if (calendar == null) return "";
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.format(calendar.getTime());
}catch (Exception e){
e.printStackTrace();
}
return "";
}
public static boolean compareDateIsCurrentDay(Calendar targetCalendar){
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
String currentDay = formatCalendarToString(currentCale, TAXI_yyyy_MM_dd);
if (currentDay.equals(formatCalendarToString(targetCalendar, TAXI_yyyy_MM_dd))){
return true;
}else {
return false;
}
}
public static Calendar formatLongToCalendar(long time){
Calendar calendar = null;
try {
calendar = Calendar.getInstance();
calendar.setTimeInMillis(time);
}catch (Exception e){
e.printStackTrace();
}
return calendar;
}
public static String formatLongToString(long time, String format){
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.format(time);
}catch (Exception e){
e.printStackTrace();
}
return "";
}
public static String getYMDTime(long time){//格式为 2021.8.21
try {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time);
int month = calendar.get(Calendar.MONTH) + 1;
return calendar.get(Calendar.YEAR)+"."+month+"."+ calendar.get(Calendar.DAY_OF_MONTH);
}catch (Exception e){
e.printStackTrace();
}
return "";
}
/**
*
* @param seconds 60
* @return 1 时
*/
public static String secondsToHourStr(long seconds){//秒数转成相应的 小时分钟数
if (seconds >= 3600){
int hours = (int)seconds/3600;
return String.valueOf(hours);
}
return "";
}
/**
*
* @param seconds 60
* @return 1 时
*/
public static String secondsToMinuteStr(long seconds){//秒数转成相应的 小时分钟数
int minute = (int)(seconds % 3600)/60;
return String.valueOf(minute);
}
/**
* 有小数两位, 没有小数保留整数
* @param d
* @return
*/
public static String formatLong(double d) {
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
double num = bg.doubleValue();
if (Math.ceil(num) - num == 0) {
return String.valueOf((long) num);
}
return String.valueOf(num);
}
}

View File

@@ -0,0 +1,61 @@
package com.mogo.och.bus.passenger.utils;
import android.content.Context;
import java.io.IOException;
import java.io.InputStream;
/**
* @author donghongyu
* @date 12/18/20 5:37 PM
*/
public class BusPassengerMapAssetStyleUtil {
public static byte[] getAssetsStyle(Context context,String fileName) {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is1 != null) {
is1.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return buffer1;
}
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style_extra.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is1 != null) {
is1.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return buffer1;
}
}

View File

@@ -0,0 +1,13 @@
package com.mogo.och.bus.passenger.utils
import android.content.res.Resources
/**
* @author: wangmingjun
* @date: 2022/1/21
*/
object DimenUtil{
fun dp2px(value:Float):Float{
return (0.5f + value * Resources.getSystem().displayMetrics.density)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bus_p_end_station_circle_borner_color" />
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="@dimen/bus_p_station_tag_width_height"
android:height="@dimen/bus_p_station_tag_width_height">
<shape android:shape="rectangle">
<corners android:radius="@dimen/bus_p_station_tag_radius_size"/>
<gradient
android:angle="90"
android:endColor="@color/bus_p_end_tag_bg_color1"
android:startColor="@color/bus_p_end_tag_bg_color2"
android:type="linear" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bus_p_start_station_circle_borner_color" />
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="@dimen/bus_p_station_tag_width_height"
android:height="@dimen/bus_p_station_tag_width_height">
<shape android:shape="rectangle">
<corners android:radius="@dimen/bus_p_station_tag_radius_size"/>
<gradient
android:angle="90"
android:endColor="@color/bus_p_start_tag_bg_color1"
android:startColor="@color/bus_p_start_tag_bg_color2"
android:type="linear" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/bus_p_traffic_light_bg_color"/>
<corners android:radius="@dimen/bus_p_route_traffic_light_view_corner"/>
<stroke android:color="@color/bus_p_traffic_light_bg_stroke"
android:width="@dimen/bus_p_traffic_light_bg_stroke_width"/>
</shape>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#B6CCF5"
android:startColor="#CDDBF6"
android:type="linear" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#E1E7F5"
android:startColor="#E1E7F5"
android:type="linear" />
</shape>
</item>
</layer-list>

View File

@@ -1,6 +1,95 @@
<?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="match_parent">
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
android:id="@+id/steering_wheel"
android:layout_width="@dimen/dp_300"
android:layout_height="@dimen/dp_300"
android:layout_marginLeft="@dimen/dp_90"
android:layout_marginTop="@dimen/dp_112"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bus_p_autopilot_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin"
android:layout_marginTop="@dimen/dp_112"
android:scaleType="fitXY"
android:layout_gravity="center_horizontal"
android:src="@drawable/bus_p_un_auto_nor"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.cardview.widget.CardView
android:id="@+id/iv_bg"
android:layout_width="@dimen/bus_p_curent_station_panel_width"
android:layout_height="@dimen/bus_p_curent_station_panel_height"
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin"
android:layout_marginBottom="@dimen/bus_p_curent_station_panel_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:alpha="0.99"
app:cardElevation="@dimen/dp_5"
app:cardBackgroundColor="@color/bus_p_panel_cur_station_panel_color"
app:cardCornerRadius="20px"/>
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_27"
android:layout_marginTop="@dimen/dp_50"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_title"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size"
app:layout_constraintLeft_toLeftOf="@+id/iv_bg"
app:layout_constraintTop_toTopOf="@+id/iv_bg" />
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
android:text="-- --"
android:elevation="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/bus_p_cur_station_arrived_tip"
android:elevation="@dimen/dp_10"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name" />
<FrameLayout
android:id="@+id/bus_p_route_panel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_48"
android:src="@drawable/bus_p_mogo_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent">
<com.amap.api.maps.TextureMapView
android:id="@+id/bus_p_line_amap_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bus_p_no_order_data_view">
<ImageView
android:id="@+id/no_order_data_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bus_p_no_order_data"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:id="@+id/no_order_data_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/bus_p_no_data_color"
android:textSize="@dimen/bus_p_no_data_size"
android:layout_marginTop="50px"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_order_data_iv"
android:text="@string/bus_p_no_data"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,176 @@
<?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="match_parent"
android:background="@android:color/transparent">
<com.mogo.och.bus.passenger.ui.BusBorderShadowLayout
android:id="@+id/edge_view"
android:layout_width="716px"
android:layout_height="match_parent"
app:shadowColor="@color/bus_p_route_view_left_edge_shadow"
app:xOffset="0px"
app:yOffset="0px"
app:bgColor="@android:color/transparent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/bus_p_route_info_panel_width"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
</com.mogo.och.bus.passenger.ui.BusBorderShadowLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/bus_p_route_info_panel_width"
android:layout_height="match_parent"
android:background="@drawable/bus_p_route_bg"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/bus_p_speed_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bus_p_route_info_margin_left"
android:layout_marginTop="@dimen/bus_p_route_info_margin_top"
android:includeFontPadding="false"
android:letterSpacing="-0.05"
android:text="0"
android:textColor="@color/bus_p_speed_txt_color"
android:textSize="@dimen/bus_p_speed_txt_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/bus_p_unit_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/bus_p_route_info_margin_right"
android:layout_marginBottom="@dimen/dp_20"
android:includeFontPadding="false"
android:textStyle="bold"
android:text="@string/bus_p_speed_unit_txt"
android:textColor="@color/bus_p_speed_txt_color"
android:textSize="@dimen/bus_p_speed_unit_txt_size"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_speed_tv"
app:layout_constraintLeft_toRightOf="@+id/bus_p_speed_tv" />
<com.mogo.och.bus.passenger.ui.BusPassengerTrafficLightView
android:id="@+id/bus_p_traffic_light_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/bus_p_route_info_margin_right"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_unit_tv"/>
<View
android:id="@+id/dividing_line_1"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:layout_marginTop="@dimen/dp_30"
android:background="@drawable/bus_p_dividing_line_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bus_p_speed_tv" />
<include
layout="@layout/bus_p_no_data_common_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/bus_p_line_map_view"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_1" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bus_p_line_cl"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bus_p_line_map_view"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_1">
<TextView
android:id="@+id/bus_p_driver_num_plate_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bus_p_route_info_margin_left"
android:layout_marginTop="@dimen/bus_p_driver_number_plate_margin_top"
android:text="----"
android:textColor="@color/bus_p_driver_number_plate_color"
android:textSize="@dimen/bus_p_driver_number_plate_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/bus_p_line_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:maxLines="1"
android:ellipsize="end"
android:text="----"
android:textColor="@color/bus_p_line_name_color"
android:textSize="@dimen/bus_p_driver_number_plate_size"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintTop_toTopOf="@+id/bus_p_driver_num_plate_tv"
app:layout_goneMarginLeft="0px" />
<TextView
android:id="@+id/line_operation_time_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bus_p_line_operation_time_margin_top"
android:text="-- --"
android:textColor="@color/bus_p_line_operation_time_color"
android:textSize="@dimen/bus_p_line_operation_time_size"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/dividing_line_2"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:layout_marginTop="@dimen/bus_p_route_dividing_line2_margin_top"
android:background="@drawable/bus_p_dividing_line_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bus_p_line_stations_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/bus_p_driver_number_plate_margin_top"
android:paddingLeft="@dimen/bus_p_route_info_margin_left"
android:paddingRight="@dimen/bus_p_route_info_margin_right"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.mogo.och.bus.passenger.ui.BusPassengerMapDirectionView
android:id="@+id/bus_p_line_map_view"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_map_view_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<ImageView
android:id="@+id/bus_p_arrow_nor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_370"
android:src="@drawable/bus_p_arrow_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/bus_p_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:includeFontPadding = "false"
android:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_tag"/>
<ImageView
android:id="@+id/bus_p_end_circle"
android:layout_width="@dimen/bus_p_station_circle_width_height"
android:layout_height="@dimen/bus_p_station_circle_width_height"
android:background="@drawable/bg_bus_p_end_station_circle"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"/>
<ImageView
android:id="@+id/bus_p_cur_end_station_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_station"/>
<ImageView
android:id="@+id/bus_p_end_tag"
android:layout_width="@dimen/bus_p_station_tag_width_height"
android:layout_height="@dimen/bus_p_station_tag_width_height"
android:background="@drawable/bg_bus_p_end_tag_bg"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_station_tag_txt_size"
android:textColor="@color/bus_p_end_tag_txt_color"
android:text="@string/bus_p_end_station_txt_tag"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_end_tag"
app:layout_constraintRight_toRightOf="@+id/bus_p_end_tag"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_tag"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/bus_p_middle_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:includeFontPadding = "false"
android:textColor="@color/bus_p_current_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<ImageView
android:id="@+id/bus_p_middle_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_station_item_height"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="@dimen/bus_p_station_tag_line_width"
android:layout_height="@dimen/bus_p_station_tag_line_height"
android:background="@color/bus_p_tag_line_color"
android:layout_marginLeft="@dimen/dp_7"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
<TextView
android:id="@+id/bus_p_start_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--"
android:textSize="@dimen/bus_p_station_txt_size"
android:textStyle="bold"
android:includeFontPadding = "false"
android:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_45"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_tag"/>
<ImageView
android:id="@+id/bus_p_start_circle"
android:layout_width="@dimen/bus_p_station_circle_width_height"
android:layout_height="@dimen/bus_p_station_circle_width_height"
android:background="@drawable/bg_bus_p_start_station_circle"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_station"/>
<ImageView
android:id="@+id/bus_p_cur_start_station_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="wrap_content"
android:background="@drawable/bg_bus_p_arrived_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"/>
<ImageView
android:id="@+id/bus_p_start_tag"
android:layout_width="@dimen/bus_p_station_tag_width_height"
android:layout_height="@dimen/bus_p_station_tag_width_height"
android:background="@drawable/bg_bus_p_start_tag_bg"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_station"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_station_tag_txt_size"
android:textColor="@color/bus_p_end_tag_txt_color"
android:text="@string/bus_p_start_station_txt_tag"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_start_tag"
app:layout_constraintRight_toRightOf="@+id/bus_p_start_tag"
app:layout_constraintTop_toTopOf="@+id/bus_p_start_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_start_tag"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?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="@dimen/bus_p_route_traffic_light_view_width"
android:layout_height="@dimen/bus_p_route_traffic_light_view_height"
android:visibility="visible">
<ImageView
android:layout_width="@dimen/bus_p_traffic_light_bg_width"
android:layout_height="@dimen/bus_p_traffic_light_bg_height"
android:background="@drawable/bg_bus_p_traffic_light_background"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bus_p_traffic_light_iv"
android:layout_width="@dimen/bus_p_traffic_light_icon_size"
android:layout_height="@dimen/bus_p_traffic_light_icon_size"
android:scaleType="fitXY"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/bus_p_traffic_light_time_tv"
android:layout_width="@dimen/bus_p_traffic_light_time_view_width"
android:layout_height="match_parent"
android:textSize="@dimen/bus_p_traffic_light_time_size"
android:textStyle="bold"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bus_p_route_info_panel_width">700px</dimen>
<dimen name="bus_p_route_info_margin_right">40px</dimen>
<dimen name="bus_p_route_info_margin_left">40px</dimen>
<dimen name="bus_p_route_info_margin_bottom">40px</dimen>
<dimen name="bus_p_route_info_margin_top">70px</dimen>
<dimen name="bus_p_route_line_info_height">224px</dimen>
<dimen name="bus_p_route_line_map_view_height">510px</dimen>
<dimen name="bus_p_route_line_dividing_view_height">1px</dimen>
<dimen name="bus_p_route_traffic_light_view_width">158px</dimen>
<dimen name="bus_p_route_traffic_light_view_height">90px</dimen>
<dimen name="bus_p_route_traffic_light_view_corner">45px</dimen>
<dimen name="bus_p_traffic_light_bg_width">158px</dimen>
<dimen name="bus_p_traffic_light_bg_height">90px</dimen>
<dimen name="bus_p_traffic_light_time_size">45px</dimen>
<dimen name="bus_p_traffic_light_time_view_width">100px</dimen>
<dimen name="bus_p_traffic_light_icon_size">100px</dimen>
<dimen name="bus_p_traffic_light_bg_stroke_width">3px</dimen>
<dimen name="bus_p_route_dividing_line2_margin_top">224px</dimen>
<dimen name="bus_p_driver_number_plate_margin_top">50px</dimen>
<dimen name="bus_p_driver_number_plate_margin_bottom">50px</dimen>
<dimen name="bus_p_driver_number_plate_size">44px</dimen>
<dimen name="bus_p_line_operation_time_margin_top">130px</dimen>
<dimen name="bus_p_line_operation_time_size">38px</dimen>
<dimen name="bus_p_no_data_size">36px</dimen>
<dimen name="bus_p_speed_txt_size">110px</dimen>
<dimen name="bus_p_speed_unit_txt_size">42px</dimen>
<dimen name="bus_p_station_circle_borner_size">4px</dimen>
<dimen name="bus_p_station_circle_radius_size">10px</dimen>
<dimen name="bus_p_station_circle_width_height">20px</dimen>
<dimen name="bus_p_station_tag_width_height">60px</dimen>
<dimen name="bus_p_station_tag_radius_size">30px</dimen>
<dimen name="bus_p_cur_station_circle_width">20px</dimen>
<dimen name="bus_p_cur_station_circle_height">50px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">50px</dimen>
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">75px</dimen>
<dimen name="bus_p_station_tag_line_height">50px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
</resources>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--阴影布局 -->
<declare-styleable name="ShadowLayout">
<!-- 阴影颜色-->
<attr name="shadowColor" format="color"/>
<!-- 圆角大小默认无圆角0-->
<attr name="shadowRadius" format="dimension"/>
<!-- 模糊半径 -->
<attr name="blurRadius" format="dimension" />
<!-- 是否有点击效果-->
<attr name="hasEffect" format="boolean"/>
<attr name="bgColor" format="color"/>
<!-- 水平位移-->
<attr name="xOffset" format="dimension"/>
<!--竖直位移 -->
<attr name="yOffset" format="dimension"/>
</declare-styleable>
</resources>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bus_p_speed_txt_color">#2D3E5F</color>
<color name="bus_p_traffic_light_bg_color">#CCE9EFFC</color>
<color name="bus_p_traffic_light_bg_stroke">#C7D2E1</color>
<color name="bus_p_driver_number_plate_color">#2D3E5F</color>
<color name="bus_p_line_name_color">#0043FF</color>
<color name="bus_p_line_operation_time_color">#2D3E5F</color>
<color name="bus_p_no_data_color">#596A8A</color>
<color name="bus_p_station_circle_color">#D8E5F8</color>
<color name="bus_p_start_station_circle_borner_color">#FFB327</color>
<color name="bus_p_station_txt_color">#2D3E5F</color>
<color name="bus_p_current_station_txt_color">#0043FF</color>
<color name="bus_p_middle_station_circle_color2">#276AFE</color>
<color name="bus_p_middle_station_circle_color1">#0043FF</color>
<color name="bus_p_end_station_circle_borner_color">#276AFE</color>
<color name="bus_p_start_tag_bg_color1">#FFC125</color>
<color name="bus_p_start_tag_bg_color2">#FF8131</color>
<color name="bus_p_end_tag_bg_color1">#31BFF2</color>
<color name="bus_p_end_tag_bg_color2">#3257E9</color>
<color name="bus_p_end_tag_txt_color">#FFFFFF</color>
<color name="bus_p_tag_line_color">#CDDBF6</color>
<color name="bus_p_panel_cur_txt_color">#2D3E5F</color>
<color name="bus_p_panel_cur_station_txt_color">#0043FF</color>
<color name="bus_p_panel_cur_station_tips_color">#2D3E5F</color>
<color name="bus_p_panel_cur_station_panel_color">#E6E9EFFC</color>
<color name="bus_p_route_view_left_edge_shadow">#33394C63</color>
</resources>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bus_p_route_info_panel_width">700px</dimen>
<dimen name="bus_p_auto_icon_margin_top">40px</dimen>
<dimen name="bus_p_route_info_margin_right">40px</dimen>
<dimen name="bus_p_route_info_margin_left">40px</dimen>
<dimen name="bus_p_route_info_margin_bottom">40px</dimen>
<dimen name="bus_p_route_info_margin_top">70px</dimen>
<dimen name="bus_p_route_line_info_height">224px</dimen>
<dimen name="bus_p_route_line_map_view_height">510px</dimen>
<dimen name="bus_p_route_line_dividing_view_height">1px</dimen>
<dimen name="bus_p_route_traffic_light_view_width">158px</dimen>
<dimen name="bus_p_route_traffic_light_view_height">90px</dimen>
<dimen name="bus_p_route_traffic_light_view_corner">45px</dimen>
<dimen name="bus_p_traffic_light_bg_width">158px</dimen>
<dimen name="bus_p_traffic_light_bg_height">90px</dimen>
<dimen name="bus_p_traffic_light_time_size">45px</dimen>
<dimen name="bus_p_traffic_light_time_view_width">100px</dimen>
<dimen name="bus_p_traffic_light_icon_size">100px</dimen>
<dimen name="bus_p_traffic_light_bg_stroke_width">3px</dimen>
<dimen name="bus_p_route_dividing_line2_margin_top">224px</dimen>
<dimen name="bus_p_driver_number_plate_margin_top">50px</dimen>
<dimen name="bus_p_driver_number_plate_margin_bottom">50px</dimen>
<dimen name="bus_p_driver_number_plate_size">44px</dimen>
<dimen name="bus_p_line_operation_time_margin_top">130px</dimen>
<dimen name="bus_p_line_operation_time_size">38px</dimen>
<dimen name="bus_p_no_data_size">36px</dimen>
<dimen name="bus_p_speed_txt_size">110px</dimen>
<dimen name="bus_p_speed_unit_txt_size">42px</dimen>
<dimen name="bus_p_station_circle_borner_size">4px</dimen>
<dimen name="bus_p_station_circle_radius_size">10px</dimen>
<dimen name="bus_p_station_circle_width_height">20px</dimen>
<dimen name="bus_p_station_tag_width_height">60px</dimen>
<dimen name="bus_p_station_tag_radius_size">30px</dimen>
<dimen name="bus_p_cur_station_circle_width">20px</dimen>
<dimen name="bus_p_cur_station_circle_height">50px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">50px</dimen>
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">75px</dimen>
<dimen name="bus_p_station_tag_line_height">50px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="bus_p_speed_unit_txt">KM/H</string>
<string name="bus_p_no_data">您已收车</string>
<string name="bus_p_start_station_txt_tag"></string>
<string name="bus_p_end_station_txt_tag"></string>
<string name="bus_p_cur_station_title">到达站:</string>
<string name="bus_p_cur_next_station_title">下一站:</string>
<string name="bus_p_cur_station_title_init">始发站:</string>
<string name="bus_p_cur_station_arrived_tip">请携带好随身物品下车。</string>
<string name="bus_p_cur_station_arrived_tip_init">欢迎乘坐蘑菇车联无人驾驶车。</string>
</resources>

View File

@@ -40,7 +40,7 @@ public class BusProvider implements IMogoOCH {
private void stepIntoVrMode(){
CallerLogger.INSTANCE.d( M_BUS + TAG, "进入vr模式" );
MogoMapUIController.getInstance()
.openVrMode(false);
.stepInVrMode(false);
}
@Override
@@ -102,7 +102,7 @@ public class BusProvider implements IMogoOCH {
this.containerId = integer;
this.activity = fragmentActivity;
UiThreadHandler.postDelayed(this::stepIntoVrMode, 5_000L );
// UiThreadHandler.postDelayed(this::stepIntoVrMode, 5_000L );
return null;
}

View File

@@ -174,16 +174,16 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon());
, startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon());
, endStation.getLon(),R.raw.end_marker);
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
isArriveAtStation = true;
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon());
, startStation.getLon(),R.raw.star_marker);
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon());
, endStation.getLon(),R.raw.end_marker);
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
isArriveEndStation = true;
nextStationName = "--";
@@ -192,14 +192,14 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
endStationFlagVisibility = View.INVISIBLE;
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon());
, startStation.getLon(),R.raw.star_marker);
if (isArrived) {
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon());
, endStation.getLon(),R.raw.end_marker);
} else {
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon());
, endStation.getLon(),R.raw.end_marker);
}
}
@@ -292,11 +292,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
//移除起点终点
if (null != startStation) {
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon());
, startStation.getLon(),R.raw.star_marker);
}
if (null != endStation) {
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon());
, endStation.getLon(),R.raw.end_marker);
}
}
}
@@ -318,9 +318,9 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
* @param isAdd
* @param uuid
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi) {
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
CallerLogger.INSTANCE.d("setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
@@ -328,7 +328,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(R.raw.start_and_end)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
@@ -337,7 +337,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
.getAngle()
.floatValue());
}else {
CallerLogger.INSTANCE.d("RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
}
}

View File

@@ -24,7 +24,7 @@ import com.mogo.och.bus.R;
public class BusArcView extends View {
//中心的文字描述
private String mDes = "km/h";
private String mDes = "KM/H";
//根据数据显示的圆弧Paint
private Paint mArcPaint;
//圆弧颜色

View File

@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/bus_ext_speed_width"

Binary file not shown.

View File

@@ -46,7 +46,7 @@ class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
private void stepIntoVrMode() {
CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "进入vr模式" );
MogoMapUIController.getInstance()
.openVrMode( false );
.stepInVrMode( false );
}
private void showFragment() {
@@ -94,7 +94,7 @@ class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
this.mActivity = fragmentActivity;
this.mContainerId = integer;
UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
// UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
return null;
}

View File

@@ -2,6 +2,7 @@ package com.mogo.och.taxi.passenger.presenter;
import android.location.Location;
import android.os.Build;
import android.os.Looper;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
@@ -12,6 +13,7 @@ import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCallback;
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
@@ -72,13 +74,13 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
for (MessagePad.Location routeModel : models) {
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
}
mView.routeResult(latLngList);
runOnUIThread(() -> mView.routeResult(latLngList));
}
@Override
public void routeResultByServer(List<LatLng> models) {
if (models == null) return;
mView.routeResultByServer(models);
runOnUIThread(() -> mView.routeResultByServer(models));
}
@Override
@@ -112,12 +114,12 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
mView.onCurrentOrderDistToEndChanged(meters, timeInSecond);
runOnUIThread(() -> mView.onCurrentOrderDistToEndChanged(meters, timeInSecond));
}
@Override
public void onCurrentRoadName(String currentRoadName) {
mView.onCurrentRoadName(currentRoadName);
runOnUIThread(() -> mView.onCurrentRoadName(currentRoadName));
}
@Override
@@ -128,7 +130,7 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
@Override
public void onCarLocationChanged(Location location) {
if (location != null){
mView.onCarLocationChanged(location);
runOnUIThread(() -> mView.onCarLocationChanged(location));
}
}
@@ -143,4 +145,14 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
releaseListener();
}
private void runOnUIThread( Runnable executor ) {
if ( executor == null ) {
return;
}
if ( Looper.myLooper() != Looper.getMainLooper() ) {
UiThreadHandler.post( executor );
} else {
executor.run();
}
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.och.taxi.passenger.ui;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -17,6 +18,7 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.map.MogoMapUIController;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.listener.IMogoMapListener;
@@ -45,7 +47,8 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
private TaxiPassengerTrafficLightView mTrafficLightView;
private TaxiPassengerV2XNotificationView mV2XNotificationView;
private ConstraintLayout mArrivedEndCL;
// private ConstraintLayout mArrivedEndCL;
private View mArrivedEndView;
private TextView mArrivedEndStation;
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
@@ -76,8 +79,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
mV2XNotificationView = new TaxiPassengerV2XNotificationView(getContext());
CallerHmiManager.INSTANCE.setProxyNotificationView(mV2XNotificationView);
mArrivedEndCL = findViewById(R.id.taxi_p_arrive_end_bg);
mArrivedEndStation = findViewById(R.id.arrived_end_station);
// mArrivedEndCL = findViewById(R.id.taxi_p_arrive_end_bg);
mArrivedEndView = LayoutInflater.from(getContext()).inflate(R.layout.taxi_p_arrived_end_panel,null);
mArrivedEndStation = mArrivedEndView.findViewById(R.id.arrived_end_station);
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
mMapswitchBtn.setOnClickListener(new View.OnClickListener() {
@@ -137,32 +141,34 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
private int mPrevAPStatus = -1;
public void onAutopilotStatusChanged(int status) {
getActivity().runOnUiThread(() -> {
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
// 1. 主动开启自动驾驶中不为2为0、1则继续loading
return;
}
if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status
&& mPrevAPStatus != status) {
// 2. 主动开启自动驾驶中为2则停止loading并isStarting = false
startAutopilotDone(true);
return;
}
// if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status) {
// // 1. 主动开启自动驾驶中不为2为0、1则继续loading
// return;
// }
// if (isStarting && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status
// && mPrevAPStatus != status) {
// // 2. 主动开启自动驾驶中为2则停止loading并isStarting = false
// startAutopilotDone(true);
// return;
// }
// 3. 其他过程直接更新
AutopilotStatusAnimchanged(status);
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == mPrevAPStatus) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
// 2->1
// AIAssist.getInstance(getContext()).speakTTSVoice("已进入人工驾驶模式");
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE == status) {
// 2->0
// AIAssist.getInstance(getContext()).speakTTSVoice("自动驾驶已停止,请人工接管");
}
if (mPrevAPStatus != status){
autopilotStatusAnimchanged(status);
}
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == mPrevAPStatus) {
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == status) {
// // 2->1
//// AIAssist.getInstance(getContext()).speakTTSVoice("已进入人工驾驶模式");
// } else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE == status) {
// // 2->0
//// AIAssist.getInstance(getContext()).speakTTSVoice("自动驾驶已停止,请人工接管");
// }
// }
mPrevAPStatus = status;
});
}
public void AutopilotStatusAnimchanged(int status) {
public void autopilotStatusAnimchanged(int status) {
// mAutopilotTv.setText(isInAutopilot?"自动驾驶":"开启自动驾驶");
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
mAutopilotImage.setImageResource(R.drawable.taxi_p_auto_nor);
@@ -239,10 +245,12 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
*/
public void showOrHideArrivedEndLayout(boolean isShow, String arrivedEndStation){
if (isShow){
mArrivedEndCL.setVisibility(View.VISIBLE);
// mArrivedEndCL.setVisibility(View.VISIBLE);
OverlayViewUtils.showOverlayView(getActivity(),mArrivedEndView);
mArrivedEndStation.setText(arrivedEndStation);
}else {
mArrivedEndCL.setVisibility(View.GONE);
// mArrivedEndCL.setVisibility(View.GONE);
OverlayViewUtils.dismissOverlayView(mArrivedEndView);
}
}
}

View File

@@ -228,7 +228,8 @@ public class TaxiPassengerMapDirectionView
polylineOptions.addAll(mCoordinatesLatLng);
polylineOptions.colorValues(colorList); // 1FC3FF -> 57ABFF
polylineOptions.useGradient(true);
polylineOptions.width(5);
polylineOptions.width(10);
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);

View File

@@ -518,7 +518,7 @@ public class TaxiPassengerServingOrderFragment extends
}
public void onCarLocationChanged(Location location) {
runOnUIThread(() -> updateSpeedView(location.getSpeed()));
updateSpeedView(location.getSpeed());
}
public void onLimitingVelocityChange(int limitingVelocity) {

View File

@@ -99,7 +99,7 @@ public class TaxiPassengerUtils {
* @return
*/
public static String formatLong(double d) {
BigDecimal bg = new BigDecimal(d).setScale(2, RoundingMode.HALF_UP);
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
double num = bg.doubleValue();
if (Math.round(num) - num == 0) {
return String.valueOf((long) num);

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="12px" android:height="12px"/>
<corners android:radius="11px" />
<size android:width="14px" android:height="14px"/>
<corners android:radius="12px" />
<gradient
android:startColor="#D2F4FF"
android:endColor="#57C5FF"

View File

@@ -2,14 +2,14 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 背景图 -->
<item android:id="@android:id/background"
android:height="@dimen/dp_7"
android:height="@dimen/dp_10"
android:gravity="center_vertical">
<shape>
<solid android:color="#1A3FA5FF"/>
</shape>
</item>
<item android:id="@android:id/progress"
android:height="@dimen/dp_7"
android:height="@dimen/dp_10"
android:gravity="center_vertical">
<clip>
<shape>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size android:width="12px" android:height="12px"/>
<corners android:radius="11px" />
<size android:width="14px" android:height="14px"/>
<corners android:radius="12px" />
<gradient
android:startColor="#FEB223"
android:endColor="#FFE2AC"

View File

@@ -8,11 +8,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="@dimen/dp_40"
app:cardCornerRadius="@dimen/dp_48"
app:cardElevation="@dimen/dp_20"
app:cardPreventCornerOverlap="true"
android:layout_marginTop="@dimen/dp_34"
app:cardUseCompatPadding="true"
android:layout_marginTop="@dimen/dp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -25,23 +25,25 @@
<com.mogo.och.taxi.passenger.ui.TaxiPassengerRadiuImageView
android:id="@+id/taxi_p_speed_bg"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:src="@drawable/taxi_p_speed_light_green_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:taxi_passenger_left_top_radius="@dimen/dp_40"
app:taxi_passenger_right_top_radius="@dimen/dp_40" />
app:taxi_passenger_left_top_radius="@dimen/dp_48"
app:taxi_passenger_right_top_radius="@dimen/dp_48" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/taxi_p_order_stations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_96"
android:layout_marginTop="@dimen/dp_116"
android:background="#2661A2DC"
android:paddingTop="@dimen/dp_24"
android:paddingBottom="@dimen/dp_24"
android:paddingTop="@dimen/dp_30"
android:paddingBottom="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -49,12 +51,12 @@
android:id="@+id/taxi_p_order_status_start_station_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="68px"
android:layout_marginLeft="@dimen/dp_82"
android:ellipsize="end"
android:maxLines="1"
android:text="--"
android:textColor="#FFFFFF"
android:textSize="30px"
android:textSize="@dimen/taxi_p_order_station_size"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -62,7 +64,7 @@
android:id="@+id/taxi_p_blue_dot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20px"
android:layout_marginRight="@dimen/dp_22"
android:background="@drawable/taxi_p_blue_circle_bg"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_order_status_start_station_tv"
app:layout_constraintRight_toLeftOf="@+id/taxi_p_order_status_start_station_tv"
@@ -72,12 +74,12 @@
android:id="@+id/taxi_p_order_status_end_station_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10px"
android:layout_marginTop="@dimen/dp_12"
android:ellipsize="end"
android:maxLines="1"
android:text="--"
android:textColor="#FFFFFF"
android:textSize="30px"
android:textSize="@dimen/taxi_p_order_station_size"
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_order_status_start_station_tv"
app:layout_constraintTop_toBottomOf="@+id/taxi_p_order_status_start_station_tv" />
@@ -85,7 +87,7 @@
android:id="@+id/taxi_p_yellow_dot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20px"
android:layout_marginRight="@dimen/dp_22"
android:background="@drawable/taxi_p_yellow_circle_bg"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_order_status_end_station_tv"
app:layout_constraintRight_toLeftOf="@+id/taxi_p_order_status_end_station_tv"
@@ -136,8 +138,8 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textColor="@color/taxi_p_route_txt_color"
android:textSize="@dimen/taxi_p_order_route_size"
android:textStyle="bold" />
<TextView
@@ -145,12 +147,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/taxi_p_order_remain_distance_title"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginLeft="@dimen/dp_7"
android:layout_toRightOf="@+id/taxi_p_order_remain_distance"
android:includeFontPadding="false"
android:text="公里"
android:textColor="#FFFFFF"
android:textSize="20px" />
android:textSize="@dimen/taxi_p_route_txt_unit_size" />
</LinearLayout>
<TextView
@@ -163,7 +165,7 @@
android:includeFontPadding="false"
android:text="距离"
android:textColor="#8FB3EF"
android:textSize="20px" />
android:textSize="@dimen/taxi_p_route_txt_unit_size" />
</RelativeLayout>
@@ -189,8 +191,8 @@
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textColor="@color/taxi_p_route_txt_color"
android:textSize="@dimen/taxi_p_order_route_size"
android:textStyle="bold" />
<TextView
@@ -198,12 +200,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/taxi_p_order_remain_time_title"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginLeft="@dimen/dp_7"
android:layout_toRightOf="@+id/taxi_p_order_remain_time"
android:includeFontPadding="false"
android:text="分钟"
android:textColor="#FFFFFF"
android:textSize="20px" />
android:textSize="@dimen/taxi_p_route_txt_unit_size" />
</LinearLayout>
<TextView
@@ -216,7 +218,7 @@
android:includeFontPadding="false"
android:text="剩余"
android:textColor="#8FB3EF"
android:textSize="20px" />
android:textSize="@dimen/taxi_p_route_txt_unit_size" />
</RelativeLayout>
@@ -236,8 +238,8 @@
android:layout_centerHorizontal="true"
android:includeFontPadding="false"
android:text="--"
android:textColor="#84D4FF"
android:textSize="42px"
android:textColor="@color/taxi_p_route_txt_color"
android:textSize="@dimen/taxi_p_order_route_size"
android:textStyle="bold" />
<TextView
@@ -250,7 +252,7 @@
android:includeFontPadding="false"
android:text="到达"
android:textColor="#8FB3EF"
android:textSize="20px" />
android:textSize="@dimen/taxi_p_route_txt_unit_size" />
</RelativeLayout>
@@ -273,13 +275,13 @@
<com.mogo.och.taxi.passenger.ui.CustomSeekBar
android:id="@+id/taxi_p_seekbar"
android:layout_width="@dimen/dp_250"
android:layout_height="@dimen/dp_25"
android:layout_marginBottom="20px"
android:layout_width="@dimen/dp_296"
android:layout_height="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_42"
android:fadingEdge="horizontal"
android:focusable="true"
android:maxHeight="@dimen/dp_25"
android:minHeight="@dimen/dp_25"
android:maxHeight="@dimen/dp_30"
android:minHeight="@dimen/dp_30"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:thumbOffset="5px"
@@ -293,12 +295,12 @@
android:id="@+id/taxi_p_progress_des"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_20"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_p_progress_des_size"
android:textStyle="italic"
android:layout_marginBottom="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10"
android:typeface="monospace"
app:layout_constraintBottom_toTopOf="@+id/taxi_p_seekbar"
app:layout_constraintLeft_toLeftOf="parent" />
@@ -308,7 +310,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_25"
android:src="@drawable/taxi_p_arrow_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
@@ -319,8 +321,8 @@
android:layout_width="@dimen/taxi_p_order_panel_width"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="@dimen/dp_36"
android:elevation="15dp"
android:layout_marginLeft="@dimen/dp_40"
android:elevation="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="bottom">
@@ -334,7 +336,6 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_8"
android:includeFontPadding = "false"
android:letterSpacing="-0.05"
android:text="0"
android:textStyle="bold"
@@ -345,7 +346,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:includeFontPadding = "false"
android:letterSpacing="-0.05"
android:text="0"
android:textStyle="bold"
@@ -357,21 +357,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:text="KM/h"
android:text="KM/H"
android:includeFontPadding="false"
android:layout_marginBottom="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_22"
android:textColor="@android:color/white"
android:textSize="26px" />
android:textSize="@dimen/taxi_p_speed_unit_size" />
<TextView
android:id="@+id/taxi_p_order_status_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_22"
android:gravity="right"
android:text="@string/taxi_p_arrive_to_start"
android:textColor="@android:color/white"
android:textSize="26px" />
android:textSize="@dimen/taxi_p_order_status_size" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,56 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/taxi_p_arrive_end_panel_bg"
tools:ignore="MissingDefaultResource">
<TextView
android:id="@+id/arrived_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_88"
android:layout_marginBottom="@dimen/dp_190"
android:includeFontPadding="false"
android:text="@string/taxi_p_arrived_title"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_p_arrived_end_tv_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<TextView
android:id="@+id/arrived_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:includeFontPadding="false"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_p_arrived_end_tv_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/arrived_title"
app:layout_constraintLeft_toRightOf="@+id/arrived_title"
app:layout_constraintTop_toTopOf="@+id/arrived_title" />
<TextView
android:id="@+id/arrived_end_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:includeFontPadding="false"
android:text="@string/taxi_p_arrived_end_tips"
android:textColor="@color/taxi_p_arrive_end_tip_color"
android:textSize="@dimen/taxi_p_arrived_end_tip_size"
app:layout_constraintLeft_toLeftOf="@+id/arrived_title"
app:layout_constraintTop_toBottomOf="@+id/arrived_title" />
<View
android:layout_width="@dimen/dp_18"
android:layout_height="0dp"
android:background="@color/taxi_p_arrive_end_bg_line_color"
app:layout_constraintBottom_toBottomOf="@+id/arrived_end_tip"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/arrived_title" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<ImageView
android:id="@+id/module_och_autopilot_iv"
@@ -99,7 +100,7 @@
android:id="@+id/module_mogo_och_navi_panel_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_150"
android:layout_marginTop="@dimen/dp_120"
android:layout_marginRight="@dimen/dp_10"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
@@ -114,55 +115,4 @@
android:layout_marginTop="@dimen/taxi_p_traffic_light_layout_margin_top"
android:visibility="gone"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/taxi_p_arrive_end_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:background="@drawable/taxi_p_arrive_end_panel_bg">
<TextView
android:id="@+id/arrived_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_190"
android:layout_marginLeft="@dimen/dp_88"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:includeFontPadding="false"
android:text="@string/taxi_p_arrived_title"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_p_arrived_end_tv_size"/>
<TextView
android:id="@+id/arrived_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
app:layout_constraintTop_toTopOf="@+id/arrived_title"
app:layout_constraintBottom_toBottomOf="@+id/arrived_title"
app:layout_constraintLeft_toRightOf="@+id/arrived_title"
android:layout_marginLeft="@dimen/dp_30"
android:textSize="@dimen/taxi_p_arrived_end_tv_size"
android:includeFontPadding="false"
android:textStyle="bold"/>
<TextView
android:id="@+id/arrived_end_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="@+id/arrived_title"
app:layout_constraintTop_toBottomOf="@+id/arrived_title"
android:layout_marginTop="@dimen/dp_30"
android:textColor="@color/taxi_p_arrive_end_tip_color"
android:textSize="@dimen/taxi_p_arrived_end_tip_size"
android:includeFontPadding="false"
android:text="@string/taxi_p_arrived_end_tips"/>
<View
android:layout_width="@dimen/dp_18"
android:layout_height="0dp"
android:background="@color/taxi_p_arrive_end_bg_line_color"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/arrived_title"
app:layout_constraintBottom_toBottomOf="@+id/arrived_end_tip"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="taxi_p_order_map_height">496px</dimen>
<dimen name="module_och_taxi_panel_width">560px</dimen>
<dimen name="module_och_taxi_panel_height">910px</dimen>
<dimen name="taxi_operation_data_item_width">800px</dimen>
@@ -24,8 +26,8 @@
<dimen name="taxi_tab_autoaploit_width">420px</dimen>
<dimen name="taxi_tab_autoaploit_height">220px</dimen>
<dimen name="taxi_p_order_panel_width">520px</dimen>
<dimen name="taxi_p_order_panel_height">820px</dimen>
<dimen name="taxi_p_order_panel_width">624px</dimen>
<dimen name="taxi_p_order_panel_height">984px</dimen>
<dimen name="taxi_p_traffic_light_layout_width">225px</dimen>
<dimen name="taxi_p_traffic_light_layout_height">154px</dimen>
@@ -52,6 +54,11 @@
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
<dimen name="taxi_p_speed_size">120px</dimen>
<dimen name="taxi_p_progress_des_size">28px</dimen>
<dimen name="taxi_p_speed_size">144px</dimen>
<dimen name="taxi_p_speed_unit_size">32px</dimen>
<dimen name="taxi_p_order_status_size">32px</dimen>
<dimen name="taxi_p_order_station_size">36px</dimen>
<dimen name="taxi_p_order_route_size">50px</dimen>
<dimen name="taxi_p_progress_des_size">34px</dimen>
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
</resources>

View File

@@ -24,12 +24,6 @@
<dimen name="module_mogo_och_operation_status_bg_width">120px</dimen>
<dimen name="module_mogo_och_operation_status_bg_height">120px</dimen>
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
<dimen name="taxi_p_speed_size">120px</dimen>
<dimen name="taxi_p_progress_des_size">28px</dimen>
<dimen name="module_mogo_och_operation_status_padding">83px</dimen>
<dimen name="module_mogo_och_autopilot_order_m_t">40px</dimen>
@@ -45,8 +39,6 @@
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
<dimen name="module_och_taxi_panel_width">560px</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>
@@ -71,6 +63,10 @@
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
<dimen name="module_och_taxi_order_text_marginRight">31.5px</dimen>
<dimen name="taxi_p_order_map_height">496px</dimen>
<dimen name="module_och_taxi_panel_width">560px</dimen>
<dimen name="module_och_taxi_panel_height">910px</dimen>
<dimen name="taxi_operation_data_item_width">800px</dimen>
<dimen name="taxi_operation_data_item_height">222px</dimen>
<dimen name="taxi_order_cancel_width">1120px</dimen>
@@ -93,8 +89,8 @@
<dimen name="taxi_tab_autoaploit_width">420px</dimen>
<dimen name="taxi_tab_autoaploit_height">220px</dimen>
<dimen name="taxi_p_order_panel_width">520px</dimen>
<dimen name="taxi_p_order_panel_height">820px</dimen>
<dimen name="taxi_p_order_panel_width">624px</dimen>
<dimen name="taxi_p_order_panel_height">984px</dimen>
<dimen name="taxi_p_traffic_light_layout_width">225px</dimen>
<dimen name="taxi_p_traffic_light_layout_height">154px</dimen>
@@ -118,4 +114,15 @@
<dimen name="taxi_p_v2x_notification_text_margin_left">20px</dimen>
<dimen name="taxi_p_v2x_notification_text_margin_right">30px</dimen>
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
<dimen name="taxi_p_speed_size">144px</dimen>
<dimen name="taxi_p_speed_unit_size">32px</dimen>
<dimen name="taxi_p_order_status_size">32px</dimen>
<dimen name="taxi_p_order_station_size">36px</dimen>
<dimen name="taxi_p_order_route_size">50px</dimen>
<dimen name="taxi_p_progress_des_size">34px</dimen>
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
</resources>

View File

@@ -34,6 +34,7 @@
<color name="taxi_p_speed_warn_color2">#FF6F62</color>
<color name="taxi_p_speed_normal_color1">#CEEEFF</color>
<color name="taxi_p_speed_normal_color2">#A1DAFF</color>
<color name="taxi_p_route_txt_color">#84D4FF</color>
<color name="taxi_p_map_bg">#00000000</color>

View File

@@ -35,8 +35,6 @@
<dimen name="module_mogo_och_notice_text_max_width">460px</dimen>
<dimen name="module_mogo_och_notice_text_size">30px</dimen>
<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>
@@ -61,6 +59,9 @@
<dimen name="module_och_taxi_order_distance_marginRight">17px</dimen>
<dimen name="module_och_taxi_order_text_marginRight">22.5px</dimen>
<dimen name="taxi_p_order_map_height">496px</dimen>
<dimen name="module_och_taxi_panel_width">560px</dimen>
<dimen name="module_och_taxi_panel_height">910px</dimen>
<dimen name="taxi_operation_data_item_width">800px</dimen>
<dimen name="taxi_operation_data_item_height">222px</dimen>
<dimen name="taxi_order_cancel_width">1120px</dimen>
@@ -83,10 +84,8 @@
<dimen name="taxi_tab_autoaploit_width">420px</dimen>
<dimen name="taxi_tab_autoaploit_height">220px</dimen>
<dimen name="taxi_p_order_panel_width">520px</dimen>
<dimen name="taxi_p_order_panel_height">820px</dimen>
<dimen name="taxi_p_order_map_width">520px</dimen>
<dimen name="taxi_p_order_map_height">432px</dimen>
<dimen name="taxi_p_order_panel_width">624px</dimen>
<dimen name="taxi_p_order_panel_height">984px</dimen>
<dimen name="taxi_p_traffic_light_layout_width">225px</dimen>
<dimen name="taxi_p_traffic_light_layout_height">154px</dimen>
@@ -110,10 +109,14 @@
<dimen name="taxi_p_v2x_notification_text_margin_left">20px</dimen>
<dimen name="taxi_p_v2x_notification_text_margin_right">30px</dimen>
<dimen name="taxi_p_arrived_end_tv_size">82px</dimen>
<dimen name="taxi_p_arrived_end_tip_size">42px</dimen>
<dimen name="taxi_p_speed_size">120px</dimen>
<dimen name="taxi_p_progress_des_size">28px</dimen>
<dimen name="taxi_p_speed_size">144px</dimen>
<dimen name="taxi_p_speed_unit_size">32px</dimen>
<dimen name="taxi_p_order_status_size">32px</dimen>
<dimen name="taxi_p_order_station_size">36px</dimen>
<dimen name="taxi_p_order_route_size">50px</dimen>
<dimen name="taxi_p_progress_des_size">34px</dimen>
<dimen name="taxi_p_route_txt_unit_size">28px</dimen>
</resources>

View File

@@ -46,7 +46,7 @@ class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
private void stepIntoVrMode() {
CallerLogger.INSTANCE.d( M_TAXI + TAG, "进入vr模式" );
MogoMapUIController.getInstance()
.openVrMode( false );
.stepInVrMode( false );
}
private void showFragment() {
@@ -94,7 +94,7 @@ class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
this.mActivity = fragmentActivity;
this.mContainerId = integer;
UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
// UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
return null;
}

Some files were not shown because too many files have changed in this diff Show More