[bus passenger ] bus 乘客屏

This commit is contained in:
wangmingjun
2022-04-07 14:02:22 +08:00
parent 0953d32953
commit b95fe398f7
56 changed files with 2355 additions and 28 deletions

Binary file not shown.

View File

@@ -12,6 +12,7 @@ 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.BusPassengerRouteLineFragment;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
@@ -31,7 +32,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
private FragmentActivity mActivity;
private int mContainerId;
private BusPassengerBaseFragment mBusPassengerFragment;
private BusPassengerRouteLineFragment mPassengerFragment;
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
@@ -88,19 +89,19 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
}
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 = BusPassengerRouteLineFragment.newInstance();
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,142 @@
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);
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
}
}else if (holder instanceof EndStationViewHolder){
EndStationViewHolder viewHolder = (EndStationViewHolder)holder;
viewHolder.endStationName.setText(station.getName());
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
}
}else {
MiddleStationViewHolder viewHolder = (MiddleStationViewHolder)holder;
viewHolder.middleStationName.setText(station.getName());
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
viewHolder.curStationBg.setVisibility(View.VISIBLE);
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
}
}
}
@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,63 @@
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;
private double lat;
private double lon;
private boolean markDrivingStatus; // 默认falsetrue:是否需要返回站点的行驶状态对应返回的drivingStatus
// 0 - 关闭、1 - 启动
// public String status;
public BusPassengerQueryLineRequest(String sn,double lon, double lat, boolean markDrivingStatus) {
this.sn = sn;
this.lat = lat;
this.lon = lon;
this.markDrivingStatus = markDrivingStatus;
}
public boolean isMarkDrivingStatus() {
return markDrivingStatus;
}
public void setMarkDrivingStatus(boolean markDrivingStatus) {
this.markDrivingStatus = markDrivingStatus;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getSn() {
return sn;
}
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
// public OchBusOperationStatusRequest shutdown() {
// status = "0";
// return this;
// }
//
// public OchBusOperationStatusRequest launch() {
// status = "1";
// return this;
// }
}

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

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

View File

@@ -24,5 +24,18 @@ 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
}
}

View File

@@ -22,9 +22,18 @@ 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.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.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;
@@ -59,6 +68,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() {
@@ -68,6 +80,65 @@ 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,mLongitude,mLatitude
, new BusPassengerServiceCallback<BusPassengerRoutesResponse>() {
@Override
public void onSuccess(BusPassengerRoutesResponse data) {
if ( data == null
|| data.getResult() == null
|| data.getResult().getSites() == null
|| data.getResult().getSites().isEmpty() ) {
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){
mRouteLineInfoCallback.updateStationsInfo(result.getSites());
}
}
}
public void release() {
@@ -246,8 +317,9 @@ public class BusPassengerModel {
@Override
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
if (null != routeList && routeList.getWayPointsList().size() > 0){
// TODO: 2022/3/31
mAutopilotPlanningCallback.routeResult(routeList.getWayPointsList());
mAutopilotPlanningCallback.routeResult(
BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext
,routeList.getWayPointsList()));
}
}
@@ -257,4 +329,13 @@ public class BusPassengerModel {
}
};
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,56 @@
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 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;
}
}
}

View File

@@ -1,9 +1,40 @@
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司机端绑定路线
*
* @param driverSn 请求参数 司机端的sn并不是乘客屏的sn
* @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;
/**
@@ -40,10 +47,41 @@ public class BusPassengerServiceManager {
* @return
*/
private String getDriverAppSn(){
return CallerTelematicManager.INSTANCE.getServerToken();
// return "X2020210525EFA93B5946FA38D4";
// return CallerTelematicManager.INSTANCE.getServerToken();
return "X2020211111NG0XNFK";
}
/**
* 查询绑定行驶的小巴车路线
* @param context
* @param callback
*/
public void queryDriverSiteByCoordinate(Context context,double lon,double lat
,BusPassengerServiceCallback<BusPassengerRoutesResponse> callback){
mBusPassengerServiceApi.queryDriverSiteByCoordinate(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
,MoGoAiCloudClientConfig.getInstance().getToken()
,new BusPassengerQueryLineRequest(getDriverAppSn(),lon
,lat,true))
.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,32 @@ 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.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.BusPassengerRouteLineFragment;
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<BusPassengerRouteLineFragment> implements
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback, IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
public BaseBusPassengerPresenter(BusPassengerBaseFragment view) {
public BaseBusPassengerPresenter(BusPassengerRouteLineFragment view) {
super(view);
BusPassengerModel.getInstance().init(AbsMogoApplication.getApp());
initListeners();
@@ -47,11 +54,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 ) {
@@ -93,6 +106,28 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragmen
@Override
public void onCarLocationChanged(Location location) {
if (location != null){
mView.onCarLocationChanged(location);
}
}
@Override
public void changeOperationStatus(boolean changeStatus) {
mView.changeOperationStatus(changeStatus);
}
@Override
public void updateLineInfo(String lineName, String lineDurTime) {
mView.updateLineInfo(lineName, lineDurTime);
}
@Override
public void updateStationsInfo(List<BusPassengerStation> stations) {
mView.updateStationsInfo(stations);
}
@Override
public void routeResult(List<LatLng> models) {
mView.routeResult(models);
}
}

View File

@@ -1,32 +1,55 @@
package com.mogo.och.bus.passenger.ui;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
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.presenter.BaseBusPassengerPresenter;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
/**
* 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());
@NonNull
@NotNull
@Override
protected BaseBusPassengerPresenter createPresenter() {
return new BaseBusPassengerPresenter(this);
}
private FrameLayout mPassengerLayout;
protected TextView mCurrentArriveStation;
@Override
protected int getLayoutId() {
@@ -40,7 +63,30 @@ public class BusPassengerBaseFragment extends MvpFragment<BusPassengerBaseFragme
@Override
protected void initViews() {
//隐藏小地图
CallerSmpManager.INSTANCE.hidePanel();
mCurrentArriveStation = findViewById(R.id.bus_p_cur_station_name);
showRouteFragment();
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
}
/**
* 显示线路信息
*/
public void showRouteFragment() {
mPassengerLayout = findViewById(R.id.bus_p_panel_container);
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), mPassengerLayout);
}
/**
* 获取站点面板view在{@link #initViews()}时候添加到container中
*
* @return 站点面板view
*/
public abstract int getStationPanelViewId();
}

View File

@@ -0,0 +1,342 @@
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_TAXI_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 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_TAXI_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_TAXI_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_TAXI_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_TAXI_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);
//存放经纬度
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
boundsBuilder.include(currentLatLng);
boundsBuilder.include(endLatLng);
//第二个参数为四周留空宽度
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); // 1FC3FF -> 57ABFF
polylineOptions.useGradient(true);
polylineOptions.width(5);
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
}
}
}
/**
* 添加画线颜色值
*/
private void addRouteColorList() {
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mCoordinatesLatLng.size()/2){
colorList.add(Color.argb(255, 31, 195, 255));//start
}else {
colorList.add(Color.argb(255, 87, 171, 255));//end
}
}
}
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() {
// mCoordinatesLatLng.clear();
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);
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mIBusPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);
}
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
}
}

View File

@@ -0,0 +1,229 @@
package com.mogo.och.bus.passenger.ui;
import android.location.Location;
import android.os.Bundle;
import android.os.Looper;
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.presenter.BaseBusPassengerPresenter;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
/**
* @author: wangmingjun
* @date: 2022/4/6
*/
public class BusPassengerRouteLineFragment extends BusPassengerBaseFragment<BusPassengerRouteLineFragment, BaseBusPassengerPresenter>
implements IBusPassengerMapViewCallback {
private static final String TAG = BusPassengerBaseFragment.class.getSimpleName();
private BusPassengerTrafficLightView mTrafficLightView;
private List<BusPassengerStation> mStationsList = 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;
public static BusPassengerRouteLineFragment newInstance() {
Bundle args = new Bundle();
BusPassengerRouteLineFragment fragment = new BusPassengerRouteLineFragment();
fragment.setArguments(args);
return fragment;
}
@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);
mStationsListRv.setAdapter(new BusPassengerLineStationsAdapter(getContext(), mStationsList));
mMapArrowIcon = findViewById(R.id.bus_p_arrow_nor);
}
@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 int getStationPanelViewId() {
return R.layout.bus_p_route_fragment;
}
@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_TAXI_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.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) {
mLineName.setText(lineName);
mOperationTime.setText(lineDurTime);
mCarPlateNum.setText(AppConfigInfo.INSTANCE.getPlateNumber());
}
public void updateStationsInfo(List<BusPassengerStation> stations) {
mStationsList.clear();
mStationsList.addAll(stations);
}
@Override
public void onCameraChange(float bearing) {
startIvCompass(bearing);
}
/**
* 设置指南针旋转
*
* @param bearing
*/
private void startIvCompass(float bearing) {
bearing = 360 - bearing;
CallerLogger.INSTANCE.d(M_TAXI_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) {
runOnUIThread(() -> updateSpeedView(location.getSpeed()));
}
public void updateSpeedView(float speed){
int speedKM = (int) (Math.abs(speed) * 3.6F);
mSpeedTv.setText(speedKM);
}
@NonNull
@Override
protected BaseBusPassengerPresenter createPresenter() {
return new BaseBusPassengerPresenter(this);
}
private void runOnUIThread(Runnable executor) {
if (executor == null) {
return;
}
if (Looper.myLooper() != Looper.getMainLooper()) {
UiThreadHandler.post(executor);
} else {
executor.run();
}
}
}

View File

@@ -0,0 +1,169 @@
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:
//todo 等待UI给图片
// mLightIconIV.setBackgroundResource(R.drawable.bus_p_light_red_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 2:
//todo 等待UI给图片
// mLightIconIV.setBackgroundResource(R.drawable.bus_p_lightyellow_nor);
BusPassengerTrafficLightView.this.setVisibility(VISIBLE);
break;
case 3:
//todo 等待UI给图片
// 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,55 @@
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 java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
/**
* @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;
}
}

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

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_station_circle_color" />
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
<stroke
android:width="@dimen/bus_p_station_circle_borner_size"
android:color="@color/bus_p_end_station_circle_borner_color" />
</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="-225"
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,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_cur_station_circle_width"
android:height="@dimen/bus_p_cur_station_circle_height">
<shape android:shape="rectangle">
<corners android:radius="@dimen/bus_p_mid_station_circle_cor"/>
<gradient
android:angle="90"
android:endColor="@color/bus_p_middle_station_circle_color1"
android:startColor="@color/bus_p_middle_station_circle_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_station_circle_color" />
<corners android:radius="@dimen/bus_p_station_circle_radius_size" />
<stroke
android:width="@dimen/bus_p_station_circle_borner_size"
android:color="@color/bus_p_start_station_circle_borner_color" />
</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="-225"
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,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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
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"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin"
android:layout_marginBottom="@dimen/bus_p_curent_station_panel_margin"
android:background="@color/bus_p_panel_cur_station_panel_color"/>
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_curent_station_txt_size"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:text="@string/bus_p_cur_station_title"
app:layout_constraintLeft_toLeftOf="@+id/iv_bg"
app:layout_constraintTop_toTopOf="@+id/iv_bg"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_27"/>
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title"
android:layout_marginTop="@dimen/dp_10" />
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:text="@string/bus_p_cur_station_arrived_tip"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name"
android:layout_marginTop="@dimen/dp_20" />
<FrameLayout
android:id="@+id/bus_p_panel_container"
android:layout_width="@dimen/bus_p_route_info_panel_width"
android:layout_height="match_parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</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,140 @@
<?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="@drawable/bus_p_route_bg">
<TextView
android:id="@+id/bus_p_speed_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_speed_txt_size"
android:textColor="@color/bus_p_speed_txt_color"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:includeFontPadding = "false"
android:letterSpacing="-0.05"
android:textStyle="bold"
android:text="0"
android:layout_marginLeft="@dimen/bus_p_route_info_margin_left"
android:layout_marginTop="@dimen/bus_p_route_info_margin_top"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_speed_tv"
app:layout_constraintLeft_toRightOf="@+id/bus_p_speed_tv"
android:textColor="@color/bus_p_speed_txt_color"
android:textSize="@dimen/bus_p_speed_unit_txt_size"
android:text="@string/bus_p_speed_unit_txt"
android:includeFontPadding="false"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/bus_p_route_info_margin_right"/>
<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"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="@dimen/bus_p_route_info_margin_right"
android:layout_marginTop="@dimen/bus_p_route_info_margin_top"/>
<View
android:id="@+id/dividing_line_1"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:background="@drawable/bus_p_dividing_line_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bus_p_speed_tv"
android:layout_marginTop="@dimen/bus_p_route_info_margin_top"/>
<include layout="@layout/bus_p_no_data_common_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_1"
app:layout_constraintBottom_toTopOf="@+id/bus_p_line_map_view"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bus_p_line_cl"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_1"
app:layout_constraintBottom_toTopOf="@+id/bus_p_line_map_view">
<TextView
android:id="@+id/bus_p_driver_num_plate_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="@dimen/bus_p_driver_number_plate_margin_top"
android:layout_marginLeft="@dimen/bus_p_route_info_margin_left"
android:textColor="@color/bus_p_driver_number_plate_color"
android:textSize="@dimen/bus_p_driver_number_plate_size"
android:textStyle="bold"
android:text="京 HBBB"/>
<TextView
android:id="@+id/bus_p_line_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/bus_p_line_name_color"
android:textSize="@dimen/bus_p_driver_number_plate_size"
android:layout_marginLeft="@dimen/dp_20"
android:text="15路"
app:layout_constraintTop_toTopOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintLeft_toRightOf="@+id/bus_p_driver_num_plate_tv"/>
<TextView
android:id="@+id/line_operation_time_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/bus_p_line_operation_time_size"
android:textColor="@color/bus_p_line_operation_time_color"
app:layout_constraintTop_toTopOf="parent"
android:text="早 8:00 - 晚 8:00"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"
android:layout_marginTop="@dimen/bus_p_line_operation_time_margin_top"/>
<View
android:id="@+id/dividing_line_2"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:background="@drawable/bus_p_dividing_line_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/bus_p_route_dividing_line2_margin_top"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bus_p_line_stations_rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_2"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_driver_num_plate_tv"/>
</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_40"
android:layout_marginBottom="@dimen/dp_430"
android:src="@drawable/bus_p_arrow_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,62 @@
<?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_3"
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:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_25"
app:layout_constraintLeft_toRightOf="@+id/bus_p_end_circle"
app:layout_constraintTop_toTopOf="@+id/bus_p_end_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_end_tag"/>
<View
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="@dimen/bus_p_cur_station_circle_height"
android:background="@drawable/bg_bus_p_middle_station"
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_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,44 @@
<?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_3"
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_3"
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:textColor="@color/bus_p_current_station_txt_color"
android:layout_marginLeft="@dimen/dp_25"
app:layout_constraintLeft_toRightOf="@+id/bus_p_middle_tag"
app:layout_constraintTop_toTopOf="@+id/bus_p_middle_tag"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_middle_tag"/>
<ImageView
android:id="@+id/bus_p_middle_tag"
android:layout_width="@dimen/bus_p_cur_station_circle_width"
android:layout_height="@dimen/bus_p_cur_station_circle_height"
android:background="@drawable/bg_bus_p_middle_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,64 @@
<?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_3"
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:textColor="@color/bus_p_station_txt_color"
android:layout_marginLeft="@dimen/dp_25"
app:layout_constraintLeft_toRightOf="@+id/bus_p_start_circle"
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="@dimen/bus_p_cur_station_circle_height"
android:background="@drawable/bg_bus_p_middle_station"
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_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"
android:layout_marginLeft="@dimen/bus_p_route_info_margin_right"/>
<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"
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">560px</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">57px</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">90px</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">60px</dimen>
<dimen name="bus_p_traffic_light_icon_size">60px</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">32px</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">34px</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">50px</dimen>
<dimen name="bus_p_station_tag_radius_size">25px</dimen>
<dimen name="bus_p_cur_station_circle_width">12px</dimen>
<dimen name="bus_p_cur_station_circle_height">34px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">36px</dimen>
<dimen name="bus_p_station_tag_txt_size">28px</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">580px</dimen>
<dimen name="bus_p_curent_station_panel_height">288px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_txt_size">40px</dimen>
<dimen name="bus_p_curent_station_txt_size1">50px</dimen>
<dimen name="bus_p_curent_station_tip_size1">36px</dimen>
</resources>

View File

@@ -0,0 +1,27 @@
<?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>
</resources>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bus_p_route_info_panel_width">560px</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">57px</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">90px</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">60px</dimen>
<dimen name="bus_p_traffic_light_icon_size">60px</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">32px</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">34px</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">50px</dimen>
<dimen name="bus_p_station_tag_radius_size">25px</dimen>
<dimen name="bus_p_cur_station_circle_width">12px</dimen>
<dimen name="bus_p_cur_station_circle_height">34px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">36px</dimen>
<dimen name="bus_p_station_tag_txt_size">28px</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">580px</dimen>
<dimen name="bus_p_curent_station_panel_height">288px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_txt_size">40px</dimen>
<dimen name="bus_p_curent_station_txt_size1">50px</dimen>
<dimen name="bus_p_curent_station_tip_size1">36px</dimen>
</resources>

View File

@@ -0,0 +1,9 @@
<?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_station_arrived_tip">请携带好随身物品下车。</string>
</resources>