[140 taxi/bus 乘客屏] 小地图轨迹UI调整
@@ -42,6 +42,9 @@ public class BusPassengerModelLoopManager {
|
||||
|
||||
public void startOrStopRouteAndWipe() {
|
||||
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startOrStopRouteWipe()");
|
||||
if (mRouteWipeDisposable == null){
|
||||
mRouteWipeDisposable = new CompositeDisposable();
|
||||
}
|
||||
Disposable disposable = startLoopRouteAndWipe()
|
||||
.doOnSubscribe(new Consumer<Disposable>() {
|
||||
@Override
|
||||
@@ -93,6 +96,9 @@ public class BusPassengerModelLoopManager {
|
||||
|
||||
public void startCalculateRouteInfoLoop() {
|
||||
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startCalculateRouteInfoLoop()");
|
||||
if (mCalculateRouteDisposable == null){
|
||||
mCalculateRouteDisposable = new CompositeDisposable();
|
||||
}
|
||||
Disposable disposable = startLoopCalculateRouteInfo()
|
||||
.doOnSubscribe(new Consumer<Disposable>() {
|
||||
@Override
|
||||
|
||||
@@ -64,9 +64,8 @@ public class BusPassengerMapDirectionView
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
|
||||
private List<Integer> colorList = new ArrayList<>();
|
||||
// List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
// List<Integer> texIndexList = new ArrayList<>();
|
||||
List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
List<Integer> texIndexList = new ArrayList<>();
|
||||
private int mHaveArrivedIndex = 0;
|
||||
|
||||
private List<Marker> mLineMarkers = new ArrayList<>();
|
||||
@@ -222,8 +221,6 @@ public class BusPassengerMapDirectionView
|
||||
}
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
|
||||
//设置线段纹理
|
||||
@@ -232,9 +229,9 @@ public class BusPassengerMapDirectionView
|
||||
polylineOptions.useGradient(true);
|
||||
polylineOptions.width(10); //线段宽度
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
// polylineOptions.setCustomTextureList(textureList);
|
||||
// polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
polylineOptions.colorValues(colorList);
|
||||
polylineOptions.setCustomTextureList(textureList);
|
||||
polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
// polylineOptions.colorValues(colorList);
|
||||
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
|
||||
|
||||
// 绘制线
|
||||
@@ -248,17 +245,15 @@ public class BusPassengerMapDirectionView
|
||||
* 添加画线颜色值
|
||||
*/
|
||||
private void addRouteColorList() {
|
||||
// for (int i = 0 ; i < mHaveArrivedIndex; i++){
|
||||
// textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow));
|
||||
// texIndexList.add(i);
|
||||
// }
|
||||
//
|
||||
// for (int i = mHaveArrivedIndex; i < mCoordinatesLatLng.size(); i++){
|
||||
// textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow));
|
||||
// texIndexList.add(i);
|
||||
// }
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
|
||||
colorList.add(Color.argb(255, 70, 147, 253));//路线颜色
|
||||
textureList.clear();
|
||||
texIndexList.clear();
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
|
||||
if (i <= mHaveArrivedIndex){
|
||||
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived));
|
||||
}else {
|
||||
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive));
|
||||
}
|
||||
texIndexList.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,6 +330,7 @@ public class BusPassengerMapDirectionView
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
mHaveArrivedIndex = haveArrivedIndex;
|
||||
addRouteColorList();
|
||||
}
|
||||
|
||||
public void clearLineMarkers(){
|
||||
|
||||
|
After Width: | Height: | Size: 829 B |
|
After Width: | Height: | Size: 879 B |
|
After Width: | Height: | Size: 829 B |
|
After Width: | Height: | Size: 879 B |
@@ -12,5 +12,5 @@ import mogo.telematics.pad.MessagePad;
|
||||
*/
|
||||
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
|
||||
void setLineMarker(List<LatLng> models);
|
||||
void routeResultByServer(List<LatLng> models);
|
||||
void routeResultByServer(List<LatLng> models,int haveArrivedIndex);
|
||||
}
|
||||
@@ -617,10 +617,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
public void loopRouteAndWipe() {
|
||||
if (mLocationsModels != null && mLocationsModels.size() > 0){
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mLocationsModels,mLongitude,mLatitude);
|
||||
int haveArrivedIndex = CoordinateCalculateRouteUtil
|
||||
.getArrivedPointIndex(mLocationsModels,mLongitude,mLatitude);
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routeResultByServer(lastPoints);
|
||||
mAutopilotPlanningCallback.routeResultByServer(mLocationsModels,haveArrivedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TaxiPassengerModelLoopManager {
|
||||
|
||||
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
|
||||
private Disposable mQueryOrderRemainingDisposable; //心跳轮询
|
||||
private CompositeDisposable mRouteWipeDisposable; //轨迹擦除
|
||||
private CompositeDisposable mRouteWipeDisposable = new CompositeDisposable(); //轨迹擦除
|
||||
private Disposable mReadyToAutopilotDisposable; //轮询是否可开启自动驾驶
|
||||
|
||||
public void startReadyToAutopilot() {
|
||||
@@ -60,6 +60,9 @@ public class TaxiPassengerModelLoopManager {
|
||||
}
|
||||
|
||||
public void startRouteAndWipe() {
|
||||
if (mRouteWipeDisposable == null){
|
||||
mRouteWipeDisposable = new CompositeDisposable();
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startRouteAndWipe()");
|
||||
Disposable disposable = startLoopRouteAndWipe()
|
||||
.doOnSubscribe(new Consumer<Disposable>() {
|
||||
|
||||
@@ -74,13 +74,13 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
runOnUIThread(() -> mView.setLineMarker(models));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void routeResultByServer(List<LatLng> models) {
|
||||
public void routeResultByServer(List<LatLng> models, int haveArrivedIndex) {
|
||||
if (models == null) return;
|
||||
runOnUIThread(() -> mView.routeResultByServer(models));
|
||||
runOnUIThread(() -> mView.routeResultByServer(models,haveArrivedIndex));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.taxi.passenger.ui;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -19,6 +18,7 @@ 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.BitmapDescriptor;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions;
|
||||
@@ -61,8 +61,10 @@ public class TaxiPassengerMapDirectionView
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
private int mHaveArrivedIndex;
|
||||
|
||||
private List<Integer> colorList = new ArrayList<>();
|
||||
List<BitmapDescriptor> textureList = new ArrayList<>();
|
||||
List<Integer> texIndexList = new ArrayList<>();
|
||||
|
||||
private ITaxiPassengerMapViewCallback mITaxiPassengerMapViewCallback;
|
||||
|
||||
@@ -232,7 +234,7 @@ public class TaxiPassengerMapDirectionView
|
||||
}
|
||||
if (mAMap != null) {
|
||||
|
||||
addRouteColorList();
|
||||
// addRouteColorList();
|
||||
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
//设置线段纹理
|
||||
@@ -243,7 +245,9 @@ public class TaxiPassengerMapDirectionView
|
||||
//polylineOptions.useGradient(true);
|
||||
polylineOptions.width(15);
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
|
||||
polylineOptions.setCustomTextureList(textureList);
|
||||
polylineOptions.setCustomTextureIndex(texIndexList);
|
||||
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions);
|
||||
@@ -256,12 +260,20 @@ public class TaxiPassengerMapDirectionView
|
||||
* 添加画线颜色值
|
||||
*/
|
||||
private void addRouteColorList() {
|
||||
textureList.clear();
|
||||
texIndexList.clear();
|
||||
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
|
||||
if (i <= mCoordinatesLatLng.size()/2){
|
||||
colorList.add(Color.argb(255, 31, 195, 255));//start
|
||||
// if (i <= mCoordinatesLatLng.size()/2){
|
||||
// colorList.add(Color.argb(255, 31, 195, 255));//start
|
||||
// }else {
|
||||
// colorList.add(Color.argb(255, 87, 171, 255));//end
|
||||
// }
|
||||
if (i <= mHaveArrivedIndex){
|
||||
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_arrived));
|
||||
}else {
|
||||
colorList.add(Color.argb(255, 87, 171, 255));//end
|
||||
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
|
||||
}
|
||||
texIndexList.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,6 +356,13 @@ public class TaxiPassengerMapDirectionView
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setCoordinatesLatLng(List<LatLng> latLngs, int haveArrivedIndex){
|
||||
mCoordinatesLatLng.clear();
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
mHaveArrivedIndex = haveArrivedIndex;
|
||||
addRouteColorList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
mITaxiPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);
|
||||
|
||||
@@ -228,18 +228,18 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void routeResultByServer(List<LatLng> latLngList) {
|
||||
public void routeResultByServer(List<LatLng> latLngList,int haveArrivedIndex) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "routeResultByServer:" + latLngList.size());
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolylineByServerRoute(latLngList);
|
||||
drawablePolylineByServerRoute(latLngList,haveArrivedIndex);
|
||||
} else {
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng){
|
||||
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
|
||||
if (mMapDirectionView != null){
|
||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng);
|
||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
Before Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 588 B |