Merge branch 'dev_robotaxi-d-app-module_270_220510_2.7.0' into 'master'
Dev robotaxi d app module 270 220510 2.7.0 See merge request zhjt/AndroidApp/MoGoEagleEye!17
@@ -53,6 +53,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
|
||||
@@ -38,7 +38,7 @@ import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceCallback;
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
|
||||
import com.mogo.och.bus.passenger.utils.BPCoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -288,6 +288,10 @@ public class BusPassengerModel {
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
@@ -355,7 +359,7 @@ public class BusPassengerModel {
|
||||
};
|
||||
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
List<LatLng> lastPoints = BPCoordinateCalculateRouteUtil
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
|
||||
|
||||
float lastSumLength = 0;
|
||||
@@ -364,7 +368,7 @@ public class BusPassengerModel {
|
||||
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
|
||||
mLongitude, mLatitude);
|
||||
}else {
|
||||
lastSumLength = BPCoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
|
||||
}
|
||||
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
|
||||
|
||||
@@ -377,13 +381,13 @@ public class BusPassengerModel {
|
||||
public void updateRoutePoints(List<MessagePad.Location> routePoints) {
|
||||
if (mAutopilotPlanningCallback != null){
|
||||
mAutopilotPlanningCallback.routeResult(
|
||||
BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext
|
||||
CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext
|
||||
, routePoints));
|
||||
}
|
||||
|
||||
//转换成高德坐标系
|
||||
mRoutePoints.clear();
|
||||
mRoutePoints.addAll(BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routePoints));
|
||||
mRoutePoints.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routePoints));
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true);
|
||||
}
|
||||
|
||||
@@ -1,359 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.utils.DimenUtil;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
* 边框阴影
|
||||
*/
|
||||
public class BusBorderShadowLayout extends LinearLayout {
|
||||
|
||||
|
||||
private static final String TAG = "ShadowLayout";
|
||||
|
||||
//默认阴影半径
|
||||
public static final float SHADOW_DEFAULT_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
//阴影最大偏移量
|
||||
public static final float SHADOW_MAX_OFFSET = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
//阴影最大模糊半径
|
||||
public static final float SHADOW_MAX_BLUR = DimenUtil.INSTANCE.dp2px(20);
|
||||
|
||||
|
||||
|
||||
//默认模糊半径
|
||||
public static final float SHADOW_DEFAULT_BLUR_RADIUS = DimenUtil.INSTANCE.dp2px(5);
|
||||
|
||||
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
//模糊度半径
|
||||
private float blurRadius = SHADOW_DEFAULT_BLUR_RADIUS ;
|
||||
|
||||
//水平位移
|
||||
private float xOffset = DimenUtil.INSTANCE.dp2px(10);
|
||||
|
||||
|
||||
//竖直方向位移
|
||||
private float yOffset = DimenUtil.INSTANCE.dp2px(0);
|
||||
|
||||
//背景色
|
||||
private int bgColor = Color.WHITE;
|
||||
|
||||
//是否有点击效果
|
||||
private boolean hasEffect = false ;
|
||||
|
||||
|
||||
int left =0 ,right =0,top = 0,bottom = 0 ;
|
||||
|
||||
//代理方式
|
||||
private IShadow shadow = new BusBorderShadowLayout.ShadowConfig(this);
|
||||
|
||||
private float mWidthMode;
|
||||
private float mHeightMode;
|
||||
private Paint mPaint = new Paint();
|
||||
private Paint locationPaint = new Paint();
|
||||
|
||||
public BusBorderShadowLayout(Context context) {
|
||||
super(context,null);
|
||||
}
|
||||
|
||||
public BusBorderShadowLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public BusBorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.setLayerType(LAYER_TYPE_SOFTWARE, null);//取消硬件加速
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
|
||||
shadowColor = typedArray.getColor(R.styleable.ShadowLayout_shadowColor, Color.BLUE);
|
||||
blurRadius = typedArray.getDimension(R.styleable.ShadowLayout_blurRadius, SHADOW_DEFAULT_BLUR_RADIUS);
|
||||
shadowRadius = typedArray.getDimension(R.styleable.ShadowLayout_shadowRadius,0);
|
||||
hasEffect = typedArray.getBoolean(R.styleable.ShadowLayout_hasEffect, false);
|
||||
xOffset = typedArray.getDimension(R.styleable.ShadowLayout_xOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
yOffset = typedArray.getDimension(R.styleable.ShadowLayout_yOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
bgColor = typedArray.getColor(R.styleable.ShadowLayout_bgColor,Color.WHITE);
|
||||
typedArray.recycle();
|
||||
|
||||
if (shadowRadius<0){
|
||||
shadowRadius = -shadowRadius;
|
||||
}
|
||||
if (blurRadius < 0) {
|
||||
blurRadius = -blurRadius;
|
||||
}
|
||||
|
||||
blurRadius = Math.min(SHADOW_MAX_BLUR,blurRadius);
|
||||
|
||||
if (Math.abs(xOffset)> SHADOW_MAX_OFFSET){
|
||||
xOffset = xOffset/Math.abs(xOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
if (Math.abs(yOffset) > SHADOW_MAX_OFFSET){
|
||||
yOffset = yOffset/Math.abs(yOffset) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
setBackgroundColor(Color.parseColor("#00ffffff"));
|
||||
if (xOffset>0){
|
||||
//水平偏移量为正数,右侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
right = (int)(blurRadius + Math.abs(xOffset));
|
||||
}else if (xOffset==0){
|
||||
//水平偏移为0,水平间距为blurRadius
|
||||
left = (int)blurRadius;
|
||||
right = (int)blurRadius;
|
||||
}else {
|
||||
//水平偏移为负数,左侧有阴影,阴影长度为blurRadius+|xOffset|
|
||||
left = (int)(blurRadius + Math.abs(xOffset));
|
||||
}
|
||||
if (yOffset>0){
|
||||
//竖直偏移量为正数,底部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
bottom = (int)(blurRadius + Math.abs(yOffset));
|
||||
}else if (yOffset==0){
|
||||
//竖直偏移量为0,竖直间距为blurRadius
|
||||
top = (int)blurRadius;
|
||||
bottom = (int)blurRadius;
|
||||
}else {
|
||||
//竖直偏移量为负数,顶部有阴影,阴影长度为blurRadius+|yOffset|
|
||||
top = (int)(blurRadius + Math.abs(yOffset));
|
||||
}
|
||||
setPadding(left,top,right,bottom);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取阴影设置
|
||||
* @return 返回阴影设置配置
|
||||
*/
|
||||
public IShadow getShadowConfig(){
|
||||
return shadow;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed,l,t,r,b);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
drawBackground(canvas);//放在super前是后景,相反是前景,前景会覆盖子布局
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//绘制背景色(在子view底部)
|
||||
private void drawBackground(Canvas canvas){
|
||||
|
||||
mWidthMode = getMeasuredWidth();
|
||||
mHeightMode = getMeasuredHeight();
|
||||
float startX = 0;
|
||||
float startY = 0;
|
||||
float endX = 0;
|
||||
float endY = 0;
|
||||
|
||||
if (xOffset==0){
|
||||
startX = right;
|
||||
endX = mWidthMode-blurRadius;
|
||||
}else {
|
||||
startX = right+blurRadius;
|
||||
endX = mWidthMode-left-blurRadius;
|
||||
}
|
||||
|
||||
if (yOffset==0){
|
||||
startY = bottom;
|
||||
endY = mHeightMode-blurRadius;
|
||||
}else {
|
||||
startY = bottom+blurRadius;
|
||||
endY = mHeightMode-top-blurRadius;
|
||||
}
|
||||
// mPaint.setShadowLayer(blurRadius,0,0,shadowColor);
|
||||
if (blurRadius>0){
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
|
||||
}
|
||||
mPaint.setColor(shadowColor);
|
||||
mPaint.setAntiAlias(true);
|
||||
|
||||
RectF shadowRect = new RectF(startX,startY,endX,endY);
|
||||
|
||||
RectF locationRectF = new RectF(left,top,mWidthMode-right,mHeightMode-bottom);
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(shadowRect,mPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(shadowRect,shadowRadius,shadowRadius,mPaint);
|
||||
}
|
||||
|
||||
locationPaint.setColor(bgColor);
|
||||
locationPaint.setAntiAlias(true);
|
||||
|
||||
if (shadowRadius==0){
|
||||
//不是圆角
|
||||
canvas.drawRect(locationRectF,locationPaint);
|
||||
}else {
|
||||
//圆角,角度为shadowRadius
|
||||
canvas.drawRoundRect(locationRectF,shadowRadius,shadowRadius,locationPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 阴影配置
|
||||
*/
|
||||
class ShadowConfig implements IShadow {
|
||||
|
||||
//代理
|
||||
private BusBorderShadowLayout shadow;
|
||||
|
||||
private ShadowConfig(BusBorderShadowLayout shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(float radius) {
|
||||
return setShadowRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.shadowRadius = Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics()));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColor(int color) {
|
||||
shadow.shadowColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setShadowColorRes(int colorRes) {
|
||||
shadow.shadowColor = shadow.getResources().getColor(colorRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(float radius) {
|
||||
return setBlurRadius(TypedValue.COMPLEX_UNIT_DIP,radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setBlurRadius(int unit, float radius) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
shadow.blurRadius = Math.min(SHADOW_MAX_BLUR,Math.abs(TypedValue.applyDimension(unit,radius,r.getDisplayMetrics())));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(float offset) {
|
||||
return setXOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setXOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float x = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(x)> SHADOW_MAX_OFFSET){
|
||||
x = x/Math.abs(x) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.xOffset = x;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(float offset) {
|
||||
return setYOffset(TypedValue.COMPLEX_UNIT_DIP,offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IShadow setYOffset(int unit, float offset) {
|
||||
Context c = getContext();
|
||||
Resources r;
|
||||
if (c == null) {
|
||||
r = Resources.getSystem();
|
||||
} else {
|
||||
r = c.getResources();
|
||||
}
|
||||
|
||||
float y = TypedValue.applyDimension(unit,offset,r.getDisplayMetrics());
|
||||
if (Math.abs(y)> SHADOW_MAX_OFFSET){
|
||||
y = y/Math.abs(y) * SHADOW_MAX_OFFSET;
|
||||
}
|
||||
shadow.yOffset = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commit() {
|
||||
shadow.init();
|
||||
shadow.requestLayout();
|
||||
shadow.postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.utils.BPDateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
@@ -111,7 +111,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
dis = String.valueOf(Math.round(meters));
|
||||
}else {
|
||||
disUnit = "公里";
|
||||
dis = BPDateTimeUtil.formatLong((double)meters / 1000);
|
||||
dis = NumberFormatUtil.formatLong((double)meters / 1000);
|
||||
}
|
||||
}
|
||||
String strHtml2 = "<font color=\"#2D3E5F\">距离 </font>" + "<b><font color=\"#0043FF\">" + dis + "</font></b>" + "<font color=\"#2D3E5F\"> "+disUnit+"</font>"
|
||||
|
||||
@@ -22,8 +22,8 @@ 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 com.mogo.och.bus.passenger.utils.BPCoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -241,7 +241,7 @@ public class BusPassengerRouteFragment extends
|
||||
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
|
||||
mLinePointsList.clear();
|
||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
||||
LatLng latLng = BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
|
||||
LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
|
||||
,stations.get(i).getLon(),stations.get(i).getLat());// lat,lon
|
||||
mLinePointsList.add(latLng);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.bus.passenger.ui;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -22,6 +23,7 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
private ImageView mLightIconIV;
|
||||
private TextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
private ImageView mLightIconBG;
|
||||
|
||||
public BusPassengerTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
@@ -40,6 +42,7 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
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);
|
||||
mLightIconBG = findViewById(R.id.bus_p_traffic_light_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +77,7 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
resetView();
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
@@ -97,8 +101,10 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -109,8 +115,10 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -121,8 +129,10 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -154,4 +164,30 @@ public class BusPassengerTrafficLightView extends IViewTrafficLight {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCountdown() {
|
||||
super.disableCountdown();
|
||||
UiThreadHandler.post(() ->{
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams){
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_icon_size);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(GONE);
|
||||
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_90);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetView(){
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.bus_p_route_traffic_light_view_width);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(VISIBLE);
|
||||
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.bus_p_traffic_light_bg_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.ui
|
||||
|
||||
import androidx.annotation.ColorRes
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
*/
|
||||
interface IShadow {
|
||||
//设置阴影半径
|
||||
fun setShadowRadius(radius:Float):IShadow
|
||||
|
||||
//添加单位设置
|
||||
fun setShadowRadius(unit:Int,radius: Float):IShadow
|
||||
|
||||
//设置应用颜色
|
||||
fun setShadowColor(color:Int):IShadow
|
||||
|
||||
//设置阴影颜色资源文件id
|
||||
fun setShadowColorRes(@ColorRes color: Int):IShadow
|
||||
/**
|
||||
* 设置模糊半径
|
||||
* @param radius
|
||||
*/
|
||||
fun setBlurRadius(radius:Float):IShadow
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param radius 模糊半径
|
||||
*/
|
||||
fun setBlurRadius(unit:Int,radius:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置水平方向的偏移量
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(offset:Float):IShadow
|
||||
|
||||
|
||||
/**
|
||||
* 设置x方向的偏移量,设置单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量,带单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(unit:Int,offset:Float):IShadow
|
||||
|
||||
/**
|
||||
* 更新绘制
|
||||
*/
|
||||
fun commit();
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/28
|
||||
*/
|
||||
public class BPCoordinateCalculateRouteUtil {
|
||||
|
||||
public static float calculateRouteSumLength(List<LatLng> points){
|
||||
if (null == points || points.size() == 0) return 0;
|
||||
|
||||
float sumLength = 0;
|
||||
|
||||
//计算全路径总距离
|
||||
for (int i = 0;i + 1< points.size();i++){
|
||||
double preLat = points.get(i).latitude;
|
||||
double preLon = points.get(i).longitude;
|
||||
double laLat = points.get(i+1).latitude;
|
||||
double laLon = points.get(i+1).longitude;
|
||||
|
||||
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
|
||||
sumLength += length;
|
||||
}
|
||||
return sumLength;
|
||||
}
|
||||
|
||||
public static List<LatLng> coordinateConverterWgsToGcjListCommon(Context mContext, List<MessagePad.Location> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MessagePad.Location m : models) {
|
||||
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static LatLng coordinateConverterWgsToGcj(Context mContext, double lon, double lat) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(lat,lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
public static LatLng coordinateConverterWgsToGcj(Context mContext, MessagePad.Location mogoLatLng) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.getLatitude(), mogoLatLng.getLongitude()));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单粗暴 直接比较 todo 需要优化
|
||||
* @param mRoutePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return
|
||||
*/
|
||||
public static List<LatLng> getRemainPointListByCompare(List<LatLng> mRoutePoints,double realLon,double realLat) {
|
||||
List<LatLng> latePoints = new ArrayList<>();
|
||||
int currentIndex = 0; //记录疑似点
|
||||
if (mRoutePoints.size() > 0){
|
||||
//基础点
|
||||
LatLng baseLatLng = mRoutePoints.get(0);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
|
||||
|
||||
for (int i= 1; i < mRoutePoints.size(); i++){
|
||||
LatLng latLng = mRoutePoints.get(i);
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,latLng.longitude,latLng.latitude);
|
||||
if (baseDiffDis > diff){
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
Logger.d(M_BUS_P + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
|
||||
android:id="@+id/steering_wheel"
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_300"
|
||||
android:layout_marginLeft="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_112"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/dp_490"
|
||||
android:layout_height="@dimen/dp_490"
|
||||
android:layout_marginLeft="@dimen/dp_22"
|
||||
android:layout_marginTop="@dimen/dp_88"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_autopilot_iv"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -20,23 +20,29 @@
|
||||
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin"
|
||||
android:layout_marginTop="@dimen/dp_112"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/bus_p_un_auto_nor"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/iv_bg"
|
||||
android:layout_width="@dimen/bus_p_curent_station_panel_width"
|
||||
android:layout_height="@dimen/bus_p_curent_station_panel_height"
|
||||
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin"
|
||||
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin_left"
|
||||
android:layout_marginBottom="@dimen/bus_p_curent_station_panel_margin"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:alpha="0.99"
|
||||
app:cardElevation="@dimen/dp_5"
|
||||
app:cardBackgroundColor="@color/bus_p_panel_cur_station_panel_color"
|
||||
app:cardCornerRadius="20px"/>
|
||||
app:bgColor="@color/bus_p_panel_cur_station_panel_color"
|
||||
app:blurRadius="@dimen/dp_12"
|
||||
app:shadowRadius="@dimen/dp_20"
|
||||
app:shadowColor="@color/bus_p_panel_edge_shadow"
|
||||
app:xOffset="0px"
|
||||
app:yOffset="0px">
|
||||
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_p_cur_station_title"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<com.mogo.och.bus.passenger.ui.BusBorderShadowLayout
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
android:id="@+id/edge_view"
|
||||
android:layout_width="716px"
|
||||
android:layout_height="match_parent"
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_width="@dimen/bus_p_route_info_panel_width"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent" />
|
||||
</com.mogo.och.bus.passenger.ui.BusBorderShadowLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/bus_p_route_info_panel_width"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_p_traffic_light_bg"
|
||||
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"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_margin_left">38px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
|
||||
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--阴影布局 -->
|
||||
<declare-styleable name="ShadowLayout">
|
||||
<!-- 阴影颜色-->
|
||||
<attr name="shadowColor" format="color"/>
|
||||
<!-- 圆角大小,默认无圆角0-->
|
||||
<attr name="shadowRadius" format="dimension"/>
|
||||
<!-- 模糊半径 -->
|
||||
<attr name="blurRadius" format="dimension" />
|
||||
<!-- 是否有点击效果-->
|
||||
<attr name="hasEffect" format="boolean"/>
|
||||
<attr name="bgColor" format="color"/>
|
||||
<!-- 水平位移-->
|
||||
<attr name="xOffset" format="dimension"/>
|
||||
<!--竖直位移 -->
|
||||
<attr name="yOffset" format="dimension"/>
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -26,4 +26,5 @@
|
||||
<color name="bus_p_panel_cur_station_panel_color">#E6E9EFFC</color>
|
||||
<color name="bus_p_route_view_left_edge_shadow">#33394C63</color>
|
||||
<color name="bus_p_traffic_txt_color">#2D3E5F</color>
|
||||
<color name="bus_p_panel_edge_shadow">#33394C63</color>
|
||||
</resources>
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_margin">38px</dimen>
|
||||
<dimen name="bus_p_curent_station_panel_margin_left">38px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
|
||||
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
|
||||
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
|
||||
|
||||
@@ -52,6 +52,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -48,6 +48,8 @@ class BusConst {
|
||||
//终点UUID
|
||||
const val BUS_END_MAP_MAKER = "bus_end_map_maker";
|
||||
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_bus_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
const val EVENT_KEY_START_SERVICE = "event_key_och_bus_start_service"
|
||||
const val EVENT_PARAM_SN = "sn"
|
||||
@@ -63,5 +65,7 @@ class BusConst {
|
||||
* 订单起终点Marker类型
|
||||
*/
|
||||
const val TYPE_MARKER_BUS_ORDER = "TYPE_MARKER_BUS_ORDER"
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 10 * 1000L
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.fragment;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Intent;
|
||||
@@ -10,6 +11,7 @@ import android.view.View;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -23,7 +25,6 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
@@ -31,6 +32,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
@@ -40,12 +42,11 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.view.OnPreventFastClickListener;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.ui.BusTrafficLightView;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.BusArcView;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
@@ -78,11 +79,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
//远景和中景的切换
|
||||
private ImageView mSwitchMapModeImage;
|
||||
private FrameLayout mSwitchMapModeLayout;
|
||||
private TextView mSwitchText;
|
||||
private LinearLayout mSwitchMapModeLayout;
|
||||
|
||||
private ObjectAnimator autopilotLoadingAnimator;
|
||||
|
||||
public boolean isAnimateRunning = false;
|
||||
|
||||
/**
|
||||
* 滑动按钮触发的事件
|
||||
*/
|
||||
@@ -122,7 +124,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout);
|
||||
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon);
|
||||
mSwitchText = findViewById(R.id.bus_switch_model_text);
|
||||
updateSwitchMapIcon();
|
||||
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
|
||||
|
||||
@@ -132,11 +134,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchText.setText(R.string.bus_map_model_normal);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, BusConst.TYPE_MARKER_BUS_ORDER);
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchText.setText(R.string.bus_map_model_faster);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -156,47 +159,33 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
restartAutopilot();
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE){
|
||||
restartAutopilot();
|
||||
}else {
|
||||
TipToast.shortTip(getResources().getString(R.string.bus_auto_disable_tip));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// debug下调用测试面板 2022.2.25修改到 长按当前站点名字
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// ctvAutopilotStatus.setOnLongClickListener(v -> {
|
||||
// debugTestBar();
|
||||
// return true;
|
||||
// });
|
||||
// }
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState(), false);
|
||||
setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE, "不能使用")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
|
||||
);
|
||||
|
||||
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
|
||||
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, "能使用")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
|
||||
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi()
|
||||
// .mockOchStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, "Running")
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶网约车回调数据
|
||||
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
|
||||
// MogoApisHandler.getInstance().getApis()
|
||||
// .getAdasControllerApi().mockOchStatus(-1, "Arrived")
|
||||
debugArrivedStation()
|
||||
debugArrivedStation()
|
||||
);
|
||||
|
||||
findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute());
|
||||
@@ -230,6 +219,14 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
CallerHmiManager.INSTANCE.registerUpgradeTipsCallback(() -> mUpgradeTipIv);
|
||||
}
|
||||
|
||||
private void updateSwitchMapIcon(){
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
|
||||
private void debugArrivedRoute() {
|
||||
BDRouteDataTestUtils.converToRouteData();
|
||||
}
|
||||
@@ -298,70 +295,72 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(int autopilotStatus, boolean isAnimateRunning) {
|
||||
public void onAutopilotStatusChanged(int autopilotStatus) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// ctvAutopilotStatus.setChecked(isInAutopilot);
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning);
|
||||
});
|
||||
}
|
||||
|
||||
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChangeChangeAutopilotBtnView: " + autopilotStatus + "isAnimateRunning = " + isAnimateRunning);
|
||||
public void setAutopilotBtnStatus(int autopilotStatus) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus) {//0不可用
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation();
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_failure_tv));
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(false);
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
}
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_disable));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(false);
|
||||
}
|
||||
}, 1000);
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_disable));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE
|
||||
== autopilotStatus) {//1可用
|
||||
if (isAnimateRunning) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_ic_autopilot);
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(true);
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus) {//2 running
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation();
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) {//1可用
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
}else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus){
|
||||
ctvAutopilotStatus.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAutopilotStatus(int autopilotStatus){
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus) {//2 running
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_success_tv));
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(false);
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_ic_autopilot);
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatus.setSelected(true);
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(true);
|
||||
// ctvAutopilotStatus.setPressed(false);
|
||||
}
|
||||
}, 1000);
|
||||
}else {
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_failure_tv));
|
||||
ctvAutopilotStatus.setFocusableInTouchMode(false);
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
}
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setAutopilotBtnStatus(autopilotStatus);
|
||||
}
|
||||
},1000);
|
||||
}
|
||||
|
||||
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChangeChangeAutopilotBtnView: "
|
||||
+ autopilotStatus + "isAnimateRunning = " + isAnimateRunning);
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return;
|
||||
}
|
||||
if (isAnimateRunning){
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(autopilotStatus);
|
||||
}else {
|
||||
setAutopilotBtnStatus(autopilotStatus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,7 +425,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
* 开启自动驾驶中间动画
|
||||
*/
|
||||
public void startAutopilotAnimation() {
|
||||
// if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE){
|
||||
isAnimateRunning = true;
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_tv));
|
||||
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatus.setSelected(false);
|
||||
@@ -439,17 +438,33 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
// }
|
||||
|
||||
startingAutoApilotCountDown();
|
||||
|
||||
}
|
||||
|
||||
private void startingAutoApilotCountDown(){
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() { //未启动成功做处理
|
||||
if (isAnimateRunning){// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
}
|
||||
}
|
||||
},TIMER_START_AUTOPILOT_INTERVAL);
|
||||
|
||||
}
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
public void stopAutopilotAnimation() {
|
||||
protected void stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator.end();
|
||||
ctvAutopilotStatusIv.clearAnimation();
|
||||
autopilotLoadingAnimator = null;
|
||||
isAnimateRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
@@ -94,11 +95,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, false);
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE);
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false);
|
||||
onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -239,7 +240,9 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
mPresenter.restartAutopilot();
|
||||
if (!isAnimateRunning) {
|
||||
mPresenter.restartAutopilot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,6 +253,9 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
@Override
|
||||
public void moveToEnd() {
|
||||
// 开启自动驾驶到下一站
|
||||
if (isAnimateRunning){
|
||||
stopAutopilotAnimation();
|
||||
}
|
||||
mPresenter.autoDriveToNextStation(false);
|
||||
}
|
||||
|
||||
@@ -332,10 +338,12 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
.latitude(lat)
|
||||
.longitude(longi);
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
|
||||
marker.setRotateAngle(CallerHDMapManager.INSTANCE.getCenterLineInfo(
|
||||
longi,lat,-1)
|
||||
.getAngle()
|
||||
.floatValue());
|
||||
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
|
||||
longi,lat,-1);
|
||||
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
|
||||
marker.setRotateAngle(centerLine.getAngle().floatValue());
|
||||
}
|
||||
|
||||
}else {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
@@ -53,7 +54,11 @@ public class BusLineModel {
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.longTip("查询所有绑定路线失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -69,7 +74,11 @@ public class BusLineModel {
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
TipToast.longTip("切换路线失败");
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.longTip("切换路线失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_OCH_BUS_START_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
@@ -11,6 +14,7 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -44,11 +48,13 @@ import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.net.BusServiceManager;
|
||||
import com.mogo.och.bus.net.IBusServiceCallback;
|
||||
import com.mogo.och.bus.presenter.BusModelLoopManager;
|
||||
import com.mogo.och.bus.util.BusAnalyticsUtil;
|
||||
import com.mogo.och.bus.util.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.bus.util.PinYinUtil;
|
||||
import com.mogo.och.bus.util.BusAnalyticsManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -217,13 +223,25 @@ public class BusOrderModel {
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
points.clear();
|
||||
points.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjList(mContext,routeList.getWayPointsList()));
|
||||
points.addAll(coordinateConverterWgsToGcjList(mContext,routeList.getWayPointsList()));
|
||||
updateOrderRoute();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static List<BusRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
BusRoutePlanningUpdateReqBean.Result result = new BusRoutePlanningUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报订单全路径规划数据
|
||||
*/
|
||||
@@ -253,7 +271,7 @@ public class BusOrderModel {
|
||||
|
||||
public void debugUpdateOrderRoute(List<MessagePad.Location> list){
|
||||
points.clear();
|
||||
points.addAll(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjList(mContext,list));
|
||||
points.addAll(coordinateConverterWgsToGcjList(mContext,list));
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
@@ -442,6 +460,8 @@ public class BusOrderModel {
|
||||
public void onFail(String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else{
|
||||
TipToast.longTip("离站上报失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -452,6 +472,14 @@ public class BusOrderModel {
|
||||
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
|
||||
*/
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT,
|
||||
linkCode = CHAIN_LINK_ADAS,
|
||||
endpoint = TracingConstants.Endpoint.PAD,
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_OCH_BUS_START_AUTOPILOT,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private void RenderLeaveStationSuccess(BusRoutesResult result, boolean isRestart) {
|
||||
renderBusStationsStatus(result);
|
||||
if (slidePannelHideCallback != null) {
|
||||
@@ -494,7 +522,7 @@ public class BusOrderModel {
|
||||
+" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName());
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot);
|
||||
|
||||
triggerStartServiceEvent(false);
|
||||
triggerStartServiceEvent(isRestart, false);
|
||||
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.startOpenAutopilot();
|
||||
@@ -521,7 +549,10 @@ public class BusOrderModel {
|
||||
public void onFail(String failMsg) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.longTip("离站上报失败:"+failMsg);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -578,7 +609,7 @@ public class BusOrderModel {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.shortTip(failMsg);
|
||||
TipToast.shortTip("收车失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -605,7 +636,7 @@ public class BusOrderModel {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.shortTip(failMsg);
|
||||
TipToast.shortTip("出车失败:"+failMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -632,8 +663,9 @@ public class BusOrderModel {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
TipToast.shortTip("网络异常,请稍后重试");
|
||||
}else {
|
||||
TipToast.shortTip(failMsg);
|
||||
TipToast.shortTip("出车收车状态查询:"+failMsg);
|
||||
}
|
||||
queryOperationStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -706,27 +738,6 @@ public class BusOrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置下一站
|
||||
*
|
||||
* @param lastStopStation
|
||||
*/
|
||||
private void resetNextStopStation( int lastStopStation ) {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "重置下一站");
|
||||
int nextStopStation = getNextStopStation();
|
||||
if ( nextStopStation < 0 ) {
|
||||
return;
|
||||
}
|
||||
if ( lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex ) {
|
||||
return;
|
||||
}
|
||||
if ( CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ) {
|
||||
// 自动驾驶中动态设置下一个停靠站点/
|
||||
autoDriveToNextStation( true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单状态、获取下一站靠站的的站点
|
||||
*
|
||||
@@ -758,9 +769,7 @@ public class BusOrderModel {
|
||||
*/
|
||||
public void restartAutopilot() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "重启自动驾驶===" + isGoingToNextStation );
|
||||
if ( isGoingToNextStation ) {
|
||||
autoDriveToNextStation( true );
|
||||
}
|
||||
autoDriveToNextStation( true );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -846,7 +855,7 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" );
|
||||
return;
|
||||
}
|
||||
if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1){//到达最后一站结束美化
|
||||
if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1) {//到达最后一站结束美化
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为false(到最后一站)");
|
||||
}
|
||||
@@ -895,13 +904,13 @@ public class BusOrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void triggerStartServiceEvent(boolean send) {
|
||||
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
|
||||
if (stationList == null || currentStationIndex >= stationList.size() || currentStationIndex == 0) {
|
||||
return;
|
||||
}
|
||||
BusStationBean currentStation = stationList.get( currentStationIndex -1);
|
||||
BusStationBean nextStation = stationList.get( currentStationIndex);
|
||||
BusAnalyticsUtil.triggerStartServiceEvent(send,
|
||||
BusAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
|
||||
currentStation.getName(), nextStation.getName(), currentLineId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.location.Location;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
@@ -43,7 +44,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
private static final String TAG = "BusPresenter";
|
||||
|
||||
private int currentAutopilotStatus = -1;
|
||||
private boolean isAnimateRunning = false;
|
||||
private List<BusStationBean> mStationList = new ArrayList<>();
|
||||
private int mCurrentStation = 0;
|
||||
|
||||
@@ -83,6 +83,14 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().setControllerStatusCallback(null);
|
||||
}
|
||||
|
||||
// public void setIsAnimateRunning(boolean isAnimateRunning){
|
||||
// this.isAnimateRunning = isAnimateRunning;
|
||||
// }
|
||||
|
||||
// public boolean getIsAnimateRunning(){
|
||||
// return isAnimateRunning;
|
||||
// }
|
||||
|
||||
public void queryBusRoutes() {
|
||||
BusOrderModel.getInstance().queryBusRoutes();
|
||||
}
|
||||
@@ -97,8 +105,10 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
|
||||
public void restartAutopilot() {
|
||||
currentAutopilotStatus = -1;
|
||||
BusOrderModel.getInstance().restartAutopilot();
|
||||
if (BusOrderModel.getInstance().isGoingToNextStation()){
|
||||
currentAutopilotStatus = -1;
|
||||
BusOrderModel.getInstance().restartAutopilot();
|
||||
}
|
||||
}
|
||||
|
||||
public void onChangeOperationStatus() {
|
||||
@@ -117,7 +127,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
mStationList.clear();
|
||||
mStationList.addAll(stationList);
|
||||
mCurrentStation = currentStation;
|
||||
functionDemoModeChange();
|
||||
// functionDemoModeChange();
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
if (mView != null) {
|
||||
runOnUIThread(() -> mView.refreshBusStations(
|
||||
@@ -132,7 +142,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|| ((mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()))) {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING, false));
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,18 +193,17 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
return;
|
||||
}
|
||||
// 改变UI自动驾驶状态
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning));
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
}
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
runOnUIThread(() -> mView.stopAutopilotAnimation());
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
// 改变UI自动驾驶状态
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning));
|
||||
BusOrderModel.getInstance().triggerStartServiceEvent(true);
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
BusOrderModel.getInstance().triggerStartServiceEvent(
|
||||
BusOrderModel.getInstance().isGoingToNextStation(), true);
|
||||
}
|
||||
isAnimateRunning = false;
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
@@ -215,11 +224,9 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
return;
|
||||
}
|
||||
runOnUIThread(() -> {
|
||||
mView.onAutopilotEnableChange(false);
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus, isAnimateRunning);
|
||||
mView.onAutopilotStatusChanged(currentAutopilotStatus);
|
||||
});
|
||||
}
|
||||
isAnimateRunning = false;
|
||||
break;
|
||||
default:
|
||||
runOnUIThread(() -> mView.onAutopilotEnableChange(false));
|
||||
@@ -241,15 +248,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
isAnimateRunning = true;
|
||||
//非美化模式下启动动画
|
||||
runOnUIThread(() -> mView.startAutopilotAnimation());
|
||||
// TODO: 2021/8/20 无工控机环境, 手动调起自动驾驶开启返回结果,有工控机环境要删除
|
||||
// UiThreadHandler.postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
// }
|
||||
// },2300);
|
||||
}
|
||||
|
||||
private void runOnUIThread(Runnable executor) {
|
||||
@@ -278,4 +278,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.ImageView;
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -19,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class BusTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public BusTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.mogo.och.bus.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
private float mRadius;
|
||||
private float mdx;
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
if (isVertrial) {
|
||||
mViewHeight = getMeasuredHeight();
|
||||
} else {
|
||||
mViewWidth = getMeasuredWidth();
|
||||
}
|
||||
mPaint = getPaint();
|
||||
String mTipText = getText().toString();
|
||||
|
||||
setStyle();
|
||||
|
||||
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
|
||||
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* true表示纵向渐变,false变身横向渐变
|
||||
*
|
||||
* @param vertrial
|
||||
*/
|
||||
public void setVertrial(boolean vertrial) {
|
||||
isVertrial = vertrial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置渐变的颜色
|
||||
*
|
||||
* @param mColorList
|
||||
*/
|
||||
public void setmColorList(int[] mColorList) {
|
||||
if (mColorList != null && mColorList.length < 2) {
|
||||
throw new RuntimeException("ClorList's length must be > 2");
|
||||
} else {
|
||||
|
||||
this.mColorList = mColorList;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyle() {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
mPaint.setFilterBitmap(true);
|
||||
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
|
||||
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
mPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置投影层
|
||||
* @param radius
|
||||
* @param dx
|
||||
* @param dy
|
||||
* @param color
|
||||
*/
|
||||
public void setShadowLayerCustom(float radius, float dx, float dy, int color) {
|
||||
this.mRadius = radius;
|
||||
this.mdx = dx;
|
||||
this.mdy = dy;
|
||||
this.mColor = color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
public class BusAnalyticsManager {
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusAnalyticsManager INSTANCE = new BusAnalyticsManager();
|
||||
}
|
||||
|
||||
public static BusAnalyticsManager getInstance() {
|
||||
return BusAnalyticsManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String mStartAutopilotKey;
|
||||
private HashMap<String, Object> mStartAutopilotParams = new HashMap<>();
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, false);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
};
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
* @param restart false(点击'滑动出发'启动)/true(接管后点击'自动驾驶'按钮启动)
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
public void triggerStartAutopilotEvent(
|
||||
boolean restart, boolean send, String startName, String endName, int lineId) {
|
||||
mStartAutopilotKey = restart ?
|
||||
BusConst.EVENT_KEY_RESTART_AUTOPILOT : BusConst.EVENT_KEY_START_SERVICE;
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_SN, sn);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_TIME, dateTime);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_NAME, startName);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_END_NAME, endName);
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
|
||||
if (send) {
|
||||
// 开启成功,上报埋点
|
||||
if (startAutopilotRunnable != null &&
|
||||
UiThreadHandler.getsUiHandler().hasCallbacks(startAutopilotRunnable)) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, BusConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
public class BusAnalyticsUtil {
|
||||
|
||||
/**
|
||||
* 触发'滑动出发'埋点流程:
|
||||
* 滑动出发(开启自动驾驶)后,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
public static void triggerStartServiceEvent(
|
||||
boolean send, String startName, String endName, int lineId) {
|
||||
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put(BusConst.EVENT_PARAM_SN, sn);
|
||||
params.put(BusConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(BusConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(BusConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(BusConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(BusConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
|
||||
Runnable runnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
params.put(BusConst.EVENT_PARAM_START_RESULT, false);
|
||||
AnalyticsManager.INSTANCE.track(BusConst.EVENT_KEY_START_SERVICE, params);
|
||||
};
|
||||
|
||||
if (send) {
|
||||
// 开启成功,上报埋点
|
||||
if (runnable != null && UiThreadHandler.getsUiHandler().hasCallbacks(runnable)) {
|
||||
UiThreadHandler.removeCallbacks(runnable);
|
||||
}
|
||||
params.put(BusConst.EVENT_PARAM_START_RESULT, true);
|
||||
AnalyticsManager.INSTANCE.track(BusConst.EVENT_KEY_START_SERVICE, params);
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(runnable, BusConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/28
|
||||
*/
|
||||
public class CoordinateCalculateRouteUtil {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
public static List<BusRoutePlanningUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<BusRoutePlanningUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
BusRoutePlanningUpdateReqBean.Result result = new BusRoutePlanningUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实时定位的坐标确定出已行驶到那个坐标点 todo 有问题 暂不使用
|
||||
* @param mRoutePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return 返回剩余路径集合
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<LatLng> getCurrentPoinByCompare(List<LatLng> mRoutePoints, double realLon, double realLat) {
|
||||
// 疑似坐标 先以坐标中间1/2为第一个比对点
|
||||
int currentIndex = Math.round(mRoutePoints.size()/2);
|
||||
LatLng currentLatLng = mRoutePoints.get(currentIndex);
|
||||
|
||||
//差值初始化
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,currentLatLng.longitude,currentLatLng.latitude);// lon,lat, prelon, prelat
|
||||
|
||||
List<LatLng> latePoints = new ArrayList<>();
|
||||
//与选中点左右比较
|
||||
if (currentIndex -1 >= 0 && currentIndex+1<= mRoutePoints.size()-1){
|
||||
LatLng leftCurrentLatLng = mRoutePoints.get(currentIndex -1);
|
||||
LatLng rightCurentLatLng = mRoutePoints.get(currentIndex + 1);
|
||||
float leftDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,leftCurrentLatLng.longitude,leftCurrentLatLng.latitude);
|
||||
float rightDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat,rightCurentLatLng.longitude,rightCurentLatLng.latitude);
|
||||
|
||||
if (rightDiffDis < leftDiffDis){ //靠近了右半边
|
||||
baseDiffDis = rightDiffDis;
|
||||
for (int i = currentIndex +1; i+1 <mRoutePoints.size() ;i++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,mRoutePoints.get(i).longitude,mRoutePoints.get(i).latitude);
|
||||
Logger.d(M_BUS + "Compare右半边集合", "点:"+i+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
if (i == mRoutePoints.size()-1){
|
||||
latePoints.addAll(mRoutePoints);
|
||||
}
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
}else if (rightDiffDis > leftDiffDis){ //靠近左半边
|
||||
baseDiffDis = leftDiffDis;
|
||||
for (int j = currentIndex-1; j -1 >=0 ;j++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat,mRoutePoints.get(j).longitude,mRoutePoints.get(j).latitude);
|
||||
Logger.d(M_BUS + "Compare左半边集合", "点:"+j+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = j;
|
||||
if (j == 0){
|
||||
latePoints.addAll(mRoutePoints);
|
||||
}
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Logger.d(M_BUS + "正好相等", "点:"+currentIndex+"------------baseDiffDis = "+baseDiffDis+"---diff="+leftDiffDis);
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,currentIndex));
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单粗暴 直接比较 todo 需要优化
|
||||
* @param mRoutePoints
|
||||
* @param realLon
|
||||
* @param realLat
|
||||
* @return
|
||||
*/
|
||||
public static List<LatLng> getRemainPointListByCompare(List<LatLng> mRoutePoints,double realLon,double realLat) {
|
||||
List<LatLng> latePoints = new ArrayList<>();
|
||||
int currentIndex = 0; //记录疑似点
|
||||
if (mRoutePoints.size() > 0){
|
||||
//基础点
|
||||
LatLng baseLatLng = mRoutePoints.get(0);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
|
||||
|
||||
for (int i= 1; i < mRoutePoints.size(); i++){
|
||||
LatLng latLng = mRoutePoints.get(i);
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,latLng.longitude,latLng.latitude);
|
||||
if (baseDiffDis > diff){
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
Logger.d(M_BUS + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else {
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,mRoutePoints.size()-1));
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
return latePoints;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.mogo.och.bus.util;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/26
|
||||
*/
|
||||
public class PinYinUtil {
|
||||
/**
|
||||
* 得到中文字符串首字母
|
||||
* @param str 需要转化的中文字符串
|
||||
* @return 大写首字母缩写的字符串
|
||||
*/
|
||||
public static String getPinYinHeadChar(String str) {
|
||||
str = str.replaceAll("[\\p{P}‘’“”|+=¥$<>^~~]", "");
|
||||
StringBuilder convert = new StringBuilder();
|
||||
for (int j = 0; j < str.length(); j++) {
|
||||
char word = str.charAt(j);
|
||||
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
|
||||
if (pinyinArray != null) {
|
||||
convert.append(pinyinArray[0].charAt(0));
|
||||
} else {
|
||||
if (!"".equals(String.valueOf(word).trim())){
|
||||
convert.append(word);
|
||||
}
|
||||
}
|
||||
}
|
||||
return convert.toString().trim().toUpperCase();
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 862 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/bus_switch_map_long.png
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/bus_switch_map_medium.png
Executable file
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 862 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/bus_switch_map_long.png
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/bus_switch_map_medium.png
Executable file
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 862 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/bus_switch_map_long.png
Executable file
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
@@ -71,49 +71,28 @@
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--切换地图远近事件 @dimen/module_switch_map -->
|
||||
<FrameLayout
|
||||
android:id="@+id/bus_switch_model_layout"
|
||||
android:layout_width="@dimen/bus_switch_map"
|
||||
android:layout_height="@dimen/bus_switch_map_height"
|
||||
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
|
||||
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
|
||||
android:background="@drawable/bus_switch_map_bg"
|
||||
android:elevation="@dimen/bus_dp_10"
|
||||
android:padding="@dimen/bus_dp_20"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bus_switch_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/bus_switch_model_layout"
|
||||
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
|
||||
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
|
||||
android:background="@drawable/bus_switch_map_bg"
|
||||
android:elevation="@dimen/bus_dp_10"
|
||||
android:padding="@dimen/bus_dp_20"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_operation_status"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_operation_status"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_switch_model_icon"
|
||||
android:layout_width="@dimen/bus_switch_image"
|
||||
android:layout_height="@dimen/bus_switch_image"
|
||||
android:paddingLeft="@dimen/bus_switch_margin_left"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:src="@drawable/bus_switch_map_angle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_switch_model_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/bus_switch_margin_left"
|
||||
android:textSize="@dimen/bus_switch_text_size"
|
||||
android:gravity="right|center"
|
||||
android:text="@string/bus_map_model_normal"
|
||||
android:textColor="@color/module_ext_color_voice_text" />
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
<CheckedTextView
|
||||
android:id="@+id/module_mogo_och_operation_status"
|
||||
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
|
||||
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
|
||||
android:background="@drawable/bus_operation_status_bg"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
@@ -122,8 +101,10 @@
|
||||
android:textColor="@color/bus_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/bus_switch_model_layout"
|
||||
app:layout_constraintLeft_toRightOf="@+id/bus_switch_model_layout" />
|
||||
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
|
||||
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_setting_layout"
|
||||
@@ -134,7 +115,7 @@
|
||||
android:background="@drawable/bus_operation_status_bg"
|
||||
android:elevation="@dimen/dp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_operation_status">
|
||||
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
|
||||
<ImageView
|
||||
android:id="@+id/module_och_bus_upgrade_red_tip"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.bus.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/bus_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/bus_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
<!-- <string name="bus_arrive_to_end_start1">上车</string>-->
|
||||
<string name="bus_arrive_to_end_end">终</string>
|
||||
<!-- <string name="bus_arrive_to_end_end1">下车</string>-->
|
||||
<string name="bus_auto_disable_tip">自动驾驶状态为0不可用</string>
|
||||
</resources>
|
||||
|
||||
1
OCH/mogo-och-common-module/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
54
OCH/mogo-och-common-module/build.gradle
Normal file
@@ -0,0 +1,54 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
buildToolsVersion "30.0.2"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 31
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.core:core-ktx:1.1.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_v2x
|
||||
}else {
|
||||
implementation project(":core:mogo-core-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:function-impl:mogo-core-function-v2x')
|
||||
}
|
||||
|
||||
}
|
||||
0
OCH/mogo-och-common-module/consumer-rules.pro
Normal file
21
OCH/mogo-och-common-module/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.common.module
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.mogo.och.common.module.test", appContext.packageName)
|
||||
}
|
||||
}
|
||||
5
OCH/mogo-och-common-module/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.common.module">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.common.module
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/26
|
||||
*/
|
||||
class OchCommonApi private constructor(){
|
||||
companion object{
|
||||
private var instance: OchCommonApi? = null
|
||||
get() {
|
||||
if (field == null){
|
||||
field = OchCommonApi();
|
||||
}
|
||||
return field
|
||||
}
|
||||
@Synchronized
|
||||
fun get():OchCommonApi{
|
||||
return instance!!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.callback
|
||||
package com.mogo.och.common.module.callback
|
||||
|
||||
import androidx.annotation.ColorRes
|
||||
|
||||
@@ -8,34 +8,34 @@ import androidx.annotation.ColorRes
|
||||
*/
|
||||
interface IShadow {
|
||||
//设置阴影半径
|
||||
fun setShadowRadius(radius:Float):IShadow
|
||||
fun setShadowRadius(radius:Float): IShadow
|
||||
|
||||
//添加单位设置
|
||||
fun setShadowRadius(unit:Int,radius: Float):IShadow
|
||||
fun setShadowRadius(unit:Int,radius: Float): IShadow
|
||||
|
||||
//设置应用颜色
|
||||
fun setShadowColor(color:Int):IShadow
|
||||
fun setShadowColor(color:Int): IShadow
|
||||
|
||||
//设置阴影颜色资源文件id
|
||||
fun setShadowColorRes(@ColorRes color: Int):IShadow
|
||||
fun setShadowColorRes(@ColorRes color: Int): IShadow
|
||||
/**
|
||||
* 设置模糊半径
|
||||
* @param radius
|
||||
*/
|
||||
fun setBlurRadius(radius:Float):IShadow
|
||||
fun setBlurRadius(radius:Float): IShadow
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param radius 模糊半径
|
||||
*/
|
||||
fun setBlurRadius(unit:Int,radius:Float):IShadow
|
||||
fun setBlurRadius(unit:Int,radius:Float): IShadow
|
||||
|
||||
/**
|
||||
* 设置水平方向的偏移量
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(offset:Float):IShadow
|
||||
fun setXOffset(offset:Float): IShadow
|
||||
|
||||
|
||||
/**
|
||||
@@ -43,20 +43,20 @@ interface IShadow {
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset x轴偏移
|
||||
*/
|
||||
fun setXOffset(unit:Int,offset:Float):IShadow
|
||||
fun setXOffset(unit:Int,offset:Float): IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(offset:Float):IShadow
|
||||
fun setYOffset(offset:Float): IShadow
|
||||
|
||||
/**
|
||||
* 设置竖直方向的偏移量,带单位
|
||||
* @param unit @{@link android.util.TypedValue#TYPE_DIMENSION}
|
||||
* @param offset y轴偏移
|
||||
*/
|
||||
fun setYOffset(unit:Int,offset:Float):IShadow
|
||||
fun setYOffset(unit:Int,offset:Float): IShadow
|
||||
|
||||
/**
|
||||
* 更新绘制
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
@@ -6,15 +6,12 @@ import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.och.taxi.bean.OrderRouteUpdateReqBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/28
|
||||
@@ -57,19 +54,15 @@ public class CoordinateCalculateRouteUtil {
|
||||
return latLng;
|
||||
}
|
||||
|
||||
|
||||
public static List<OrderRouteUpdateReqBean.Result> coordinateConverterWgsToGcjList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
|
||||
List<OrderRouteUpdateReqBean.Result> points = new ArrayList<>();
|
||||
for (MessagePad.Location m : mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(mContext, m);
|
||||
OrderRouteUpdateReqBean.Result result = new OrderRouteUpdateReqBean.Result();
|
||||
result.latitude = mogoLatLng.latitude;
|
||||
result.longitude = mogoLatLng.longitude;
|
||||
points.add(result);
|
||||
}
|
||||
return points;
|
||||
public static LatLng coordinateConverterWgsToGcj(Context mContext, double lon, double lat) {
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(lat,lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据实时定位的坐标确定出已行驶到那个坐标点 todo 有问题 暂不使用
|
||||
* @param mRoutePoints
|
||||
@@ -101,7 +94,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
for (int i = currentIndex +1; i+1 <mRoutePoints.size() ;i++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
|
||||
,mRoutePoints.get(i).longitude,mRoutePoints.get(i).latitude);
|
||||
Logger.d(M_TAXI + "Compare右半边集合", "点:"+i+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
// Logger.d(M_TAXI + "Compare右半边集合", "点:"+i+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = i;
|
||||
@@ -117,7 +110,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
baseDiffDis = leftDiffDis;
|
||||
for (int j = currentIndex-1; j -1 >=0 ;j++){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat,mRoutePoints.get(j).longitude,mRoutePoints.get(j).latitude);
|
||||
Logger.d(M_TAXI + "Compare左半边集合", "点:"+j+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
// Logger.d(M_TAXI + "Compare左半边集合", "点:"+j+"------------baseDiffDis = "+baseDiffDis+"---diff="+diff);
|
||||
if (baseDiffDis >= diff){
|
||||
baseDiffDis = diff;
|
||||
currentIndex = j;
|
||||
@@ -130,7 +123,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Logger.d(M_TAXI + "正好相等", "点:"+currentIndex+"------------baseDiffDis = "+baseDiffDis+"---diff="+leftDiffDis);
|
||||
// Logger.d(M_TAXI + "正好相等", "点:"+currentIndex+"------------baseDiffDis = "+baseDiffDis+"---diff="+leftDiffDis);
|
||||
latePoints.addAll(mRoutePoints.subList(currentIndex,currentIndex));
|
||||
return latePoints;
|
||||
}
|
||||
@@ -164,7 +157,7 @@ public class CoordinateCalculateRouteUtil {
|
||||
currentIndex = i;
|
||||
}
|
||||
}
|
||||
Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
latePoints.add(mRoutePoints.get(currentIndex));
|
||||
}else {
|
||||
@@ -1,18 +1,15 @@
|
||||
package com.mogo.och.bus.passenger.utils;
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/8/20
|
||||
* @date: 2022/5/6
|
||||
*/
|
||||
public class BPDateTimeUtil {
|
||||
|
||||
public class DateTimeUtil {
|
||||
public static final String TAXI_HH_mm = "HH:mm";
|
||||
public static final String TAXI_MM_dd = "MM-dd";
|
||||
public static final String TAXI_MM_dd_HH_mm = "MM-dd HH:mm";
|
||||
@@ -51,13 +48,13 @@ public class BPDateTimeUtil {
|
||||
return calendar;
|
||||
}
|
||||
public static String formatLongToString(long time, String format){
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static String getYMDTime(long time){//格式为 2021.8.21
|
||||
try {
|
||||
@@ -92,18 +89,4 @@ public class BPDateTimeUtil {
|
||||
int minute = (int)(seconds % 3600)/60;
|
||||
return String.valueOf(minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有小数两位, 没有小数保留整数
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public static String formatLong(double d) {
|
||||
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
|
||||
double num = bg.doubleValue();
|
||||
if (Math.ceil(num) - num == 0) {
|
||||
return String.valueOf((long) num);
|
||||
}
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.passenger.utils
|
||||
package com.mogo.och.common.module.utils
|
||||
|
||||
import android.content.res.Resources
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/5/6
|
||||
*/
|
||||
public class NumberFormatUtil {
|
||||
/**
|
||||
* 有小数两位, 没有小数保留整数
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public static String formatLong(double d) {
|
||||
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
|
||||
double num = bg.doubleValue();
|
||||
if (Math.ceil(num) - num == 0) {
|
||||
return String.valueOf((long) num);
|
||||
}
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -12,16 +12,16 @@ import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.callback.IShadow;
|
||||
import com.mogo.och.taxi.utils.DimenUtil;
|
||||
import com.mogo.och.common.module.R;
|
||||
import com.mogo.och.common.module.callback.IShadow;
|
||||
import com.mogo.och.common.module.utils.DimenUtil;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
* 边框阴影
|
||||
*/
|
||||
public class BorderShadowLayout extends LinearLayout {
|
||||
public class OCHBorderShadowLayout extends LinearLayout {
|
||||
|
||||
|
||||
private static final String TAG = "ShadowLayout";
|
||||
@@ -43,10 +43,8 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影的位置
|
||||
private int shadowPosition = 0;
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
@@ -70,22 +68,22 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
int left =0 ,right =0,top = 0,bottom = 0 ;
|
||||
|
||||
//代理方式
|
||||
private IShadow shadow = new BorderShadowLayout.ShadowConfig(this);
|
||||
private IShadow shadow = new OCHBorderShadowLayout.ShadowConfig(this);
|
||||
|
||||
private float mWidthMode;
|
||||
private float mHeightMode;
|
||||
private Paint mPaint = new Paint();
|
||||
private Paint locationPaint = new Paint();
|
||||
|
||||
public BorderShadowLayout(Context context) {
|
||||
public OCHBorderShadowLayout(Context context) {
|
||||
super(context,null);
|
||||
}
|
||||
|
||||
public BorderShadowLayout(Context context, AttributeSet attrs) {
|
||||
public OCHBorderShadowLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public BorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public OCHBorderShadowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.setLayerType(LAYER_TYPE_SOFTWARE, null);//取消硬件加速
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ShadowLayout);
|
||||
@@ -96,6 +94,7 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
xOffset = typedArray.getDimension(R.styleable.ShadowLayout_xOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
yOffset = typedArray.getDimension(R.styleable.ShadowLayout_yOffset,DimenUtil.INSTANCE.dp2px(10));
|
||||
bgColor = typedArray.getColor(R.styleable.ShadowLayout_bgColor,Color.WHITE);
|
||||
shadowPosition = typedArray.getInt(R.styleable.ShadowLayout_shadow_position,0);
|
||||
typedArray.recycle();
|
||||
|
||||
if (shadowRadius<0){
|
||||
@@ -211,7 +210,23 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
}
|
||||
// mPaint.setShadowLayer(blurRadius,0,0,shadowColor);
|
||||
if (blurRadius>0){
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
|
||||
switch (shadowPosition){
|
||||
case 0:
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.NORMAL));
|
||||
break;
|
||||
case 1:
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.SOLID));
|
||||
break;
|
||||
case 2:
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.OUTER));
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mPaint.setStrokeWidth(0);
|
||||
break;
|
||||
case 3:
|
||||
mPaint.setMaskFilter(new BlurMaskFilter(blurRadius,BlurMaskFilter.Blur.INNER));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
mPaint.setColor(shadowColor);
|
||||
mPaint.setAntiAlias(true);
|
||||
@@ -247,9 +262,9 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
class ShadowConfig implements IShadow {
|
||||
|
||||
//代理
|
||||
private BorderShadowLayout shadow;
|
||||
private OCHBorderShadowLayout shadow;
|
||||
|
||||
private ShadowConfig(BorderShadowLayout shadow) {
|
||||
private ShadowConfig(OCHBorderShadowLayout shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -12,36 +12,36 @@ import android.util.AttributeSet;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
* @date: 2022/5/7
|
||||
*/
|
||||
public class TaxiPassengerCardView extends CardView {
|
||||
public class OCHCornerCustomCardView extends CardView {
|
||||
|
||||
private int defaultRadius = 0;
|
||||
private float tlRadiu;
|
||||
private float trRadiu;
|
||||
private float brRadiu;
|
||||
private float blRadiu;
|
||||
public TaxiPassengerCardView(Context context) {
|
||||
public OCHCornerCustomCardView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs) {
|
||||
public OCHCornerCustomCardView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.materialCardViewStyle);
|
||||
}
|
||||
|
||||
public TaxiPassengerCardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public OCHCornerCustomCardView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setRadius(0);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.TaxiPassengerRoundCorner);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.OCHCardViewCorner);
|
||||
|
||||
tlRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_top_radius, defaultRadius);
|
||||
trRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_top_radius, defaultRadius);
|
||||
brRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_right_bottom_radius, defaultRadius);
|
||||
blRadiu = array.getDimension(R.styleable.TaxiPassengerRoundCorner_taxi_left_bottom_radius, defaultRadius);
|
||||
tlRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_left_top_radius, defaultRadius);
|
||||
trRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_right_top_radius, defaultRadius);
|
||||
brRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_right_bottom_radius, defaultRadius);
|
||||
blRadiu = array.getDimension(R.styleable.OCHCardViewCorner_och_card_left_bottom_radius, defaultRadius);
|
||||
setBackground(new ColorDrawable());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -11,10 +11,11 @@ import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* 通用渐变文字
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
public class OCHGradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
@@ -29,12 +30,12 @@ public class GradientTextView extends AppCompatTextView {
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
public OCHGradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
public OCHGradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -10,13 +10,14 @@ import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
/**
|
||||
* 通用圆角ImageView
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
*/
|
||||
public class TaxiPassengerRadiuImageView extends AppCompatImageView {
|
||||
public class OCHRadiusImageView extends AppCompatImageView {
|
||||
private float width, height;
|
||||
private int defaultRadius = 0;
|
||||
private int radius;
|
||||
@@ -26,17 +27,17 @@ public class TaxiPassengerRadiuImageView extends AppCompatImageView {
|
||||
private int leftBottomRadius;
|
||||
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context) {
|
||||
public OCHRadiusImageView(Context context) {
|
||||
this(context, null);
|
||||
init(context, null);
|
||||
}
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context, AttributeSet attrs) {
|
||||
public OCHRadiusImageView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public TaxiPassengerRadiuImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public OCHRadiusImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
@@ -46,12 +47,12 @@ public class TaxiPassengerRadiuImageView extends AppCompatImageView {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
// 读取配置
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundCornerImageView);
|
||||
radius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_radius, defaultRadius);
|
||||
leftTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_left_top_radius, defaultRadius);
|
||||
rightTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_right_top_radius, defaultRadius);
|
||||
rightBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_right_bottom_radius, defaultRadius);
|
||||
leftBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_passenger_left_bottom_radius, defaultRadius);
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.OchRoundCornerImageView);
|
||||
radius = array.getDimensionPixelOffset(R.styleable.OchRoundCornerImageView_och_image_radius, defaultRadius);
|
||||
leftTopRadius = array.getDimensionPixelOffset(R.styleable.OchRoundCornerImageView_och_image_left_top_radius, defaultRadius);
|
||||
rightTopRadius = array.getDimensionPixelOffset(R.styleable.OchRoundCornerImageView_och_image_right_top_radius, defaultRadius);
|
||||
rightBottomRadius = array.getDimensionPixelOffset(R.styleable.OchRoundCornerImageView_och_image_right_bottom_radius, defaultRadius);
|
||||
leftBottomRadius = array.getDimensionPixelOffset(R.styleable.OchRoundCornerImageView_och_image_left_bottom_radius, defaultRadius);
|
||||
|
||||
|
||||
if (defaultRadius == leftTopRadius) {
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
|
||||
/**
|
||||
* Created by mmin18 on 9/27/16.
|
||||
*/
|
||||
public class OCHShapeBlurView extends OCHStockBlurView {
|
||||
Paint mPaint;
|
||||
RectF mRectF;
|
||||
private float mRadius;
|
||||
private int mTopColor; // default #aaffffff
|
||||
private int mBottomColor; // default #aaffffff
|
||||
|
||||
public OCHShapeBlurView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHRShapeBlurView);
|
||||
mRadius = a.getDimension(R.styleable.OCHRShapeBlurView_och_realtime_radius,
|
||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, context.getResources().getDisplayMetrics()));
|
||||
mTopColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_start_color, 0xAAFFFFFF);
|
||||
mBottomColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_end_color, 0xAAFFFFFF);
|
||||
a.recycle();
|
||||
mPaint = new Paint();
|
||||
mRectF = new RectF();
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom oval shape
|
||||
*/
|
||||
@Override
|
||||
protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) {
|
||||
if (blurredBitmap != null) {
|
||||
mRectF.right = getWidth();
|
||||
mRectF.bottom = getHeight();
|
||||
|
||||
mPaint.reset();
|
||||
mPaint.setAntiAlias(true);
|
||||
BitmapShader shader = new BitmapShader(blurredBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(mRectF.width() / blurredBitmap.getWidth(), mRectF.height() / blurredBitmap.getHeight());
|
||||
shader.setLocalMatrix(matrix);
|
||||
mPaint.setShader(shader);
|
||||
canvas.drawRoundRect(mRectF, mRadius,mRadius,mPaint);
|
||||
|
||||
mPaint.reset();
|
||||
mPaint.setAntiAlias(true);
|
||||
/* 设置渐变色 这个正方形的颜色是改变的 */
|
||||
Shader mShader = new LinearGradient(getWidth()/2, 0, getWidth()/2, getHeight(),
|
||||
new int[] {mTopColor,mBottomColor}, null, Shader.TileMode.CLAMP); // 一个材质,打造出一个线性梯度沿著一条线。
|
||||
mPaint.setShader(mShader);//0xBFE0E8FF,0xBF6AA2D7
|
||||
canvas.drawRoundRect(mRectF, mRadius,mRadius,mPaint);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.renderscript.Allocation;
|
||||
import android.renderscript.Element;
|
||||
import android.renderscript.RenderScript;
|
||||
import android.renderscript.ScriptIntrinsicBlur;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
public class OCHStockBlurView extends View {
|
||||
|
||||
private float mDownsampleFactor; // default 4
|
||||
private int mOverlayColor; // default #aaffffff
|
||||
private float mBlurRadius; // default 10dp (0 < r <= 25)
|
||||
private boolean onece;
|
||||
|
||||
private boolean mDirty;
|
||||
private Bitmap mBitmapToBlur, mBlurredBitmap;
|
||||
private Canvas mBlurringCanvas;
|
||||
private boolean mIsRendering;
|
||||
private Paint mPaint;
|
||||
private final Rect mRectSrc = new Rect(), mRectDst = new Rect();
|
||||
// mDecorView should be the root view of the activity (even if you are on a different window like a dialog)
|
||||
private View mDecorView;
|
||||
// If the view is on different root view (usually means we are on a PopupWindow),
|
||||
// we need to manually call invalidate() in onPreDraw(), otherwise we will not be able to see the changes
|
||||
private boolean mDifferentRoot;
|
||||
private static int RENDERING_COUNT;
|
||||
private static int BLUR_IMPL;
|
||||
|
||||
private RenderScript mRenderScript;
|
||||
private ScriptIntrinsicBlur mBlurScript;
|
||||
private Allocation mBlurInput, mBlurOutput;
|
||||
|
||||
public OCHStockBlurView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHRealtimeBlurView);
|
||||
mBlurRadius = a.getDimension(R.styleable.OCHRealtimeBlurView_och_realtime_blur_radius,
|
||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, context.getResources().getDisplayMetrics()));
|
||||
mDownsampleFactor = a.getFloat(R.styleable.OCHRealtimeBlurView_och_realtime_downsample_factor, 4);
|
||||
mOverlayColor = a.getColor(R.styleable.OCHRealtimeBlurView_och_realtime_overlay_color, 0xAAFFFFFF);
|
||||
onece = a.getBoolean(R.styleable.OCHRealtimeBlurView_och_realtime_onece,false);
|
||||
a.recycle();
|
||||
|
||||
mPaint = new Paint();
|
||||
}
|
||||
|
||||
public void setBlurRadius(float radius) {
|
||||
if (mBlurRadius != radius) {
|
||||
mBlurRadius = radius;
|
||||
mDirty = true;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDownsampleFactor(float factor) {
|
||||
if (factor <= 0) {
|
||||
throw new IllegalArgumentException("Downsample factor must be greater than 0.");
|
||||
}
|
||||
|
||||
if (mDownsampleFactor != factor) {
|
||||
mDownsampleFactor = factor;
|
||||
mDirty = true; // may also change blur radius
|
||||
releaseBitmap();
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverlayColor(int color) {
|
||||
if (mOverlayColor != color) {
|
||||
mOverlayColor = color;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseBitmap() {
|
||||
if (mBitmapToBlur != null) {
|
||||
mBitmapToBlur.recycle();
|
||||
mBitmapToBlur = null;
|
||||
}
|
||||
if (mBlurredBitmap != null) {
|
||||
mBlurredBitmap.recycle();
|
||||
mBlurredBitmap = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void release() {
|
||||
releaseBitmap();
|
||||
releaseBlur();
|
||||
}
|
||||
|
||||
protected boolean prepare() {
|
||||
if (mBlurRadius == 0) {
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
|
||||
float downsampleFactor = mDownsampleFactor;
|
||||
float radius = mBlurRadius / downsampleFactor;
|
||||
if (radius > 25) {
|
||||
downsampleFactor = downsampleFactor * radius / 25;
|
||||
radius = 25;
|
||||
}
|
||||
|
||||
final int width = getWidth();
|
||||
final int height = getHeight();
|
||||
|
||||
int scaledWidth = Math.max(1, (int) (width / downsampleFactor));
|
||||
int scaledHeight = Math.max(1, (int) (height / downsampleFactor));
|
||||
|
||||
boolean dirty = mDirty;
|
||||
|
||||
if (mBlurringCanvas == null || mBlurredBitmap == null
|
||||
|| mBlurredBitmap.getWidth() != scaledWidth
|
||||
|| mBlurredBitmap.getHeight() != scaledHeight) {
|
||||
dirty = true;
|
||||
releaseBitmap();
|
||||
|
||||
boolean r = false;
|
||||
try {
|
||||
mBitmapToBlur = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
|
||||
if (mBitmapToBlur == null) {
|
||||
return false;
|
||||
}
|
||||
mBlurringCanvas = new Canvas(mBitmapToBlur);
|
||||
|
||||
mBlurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888);
|
||||
if (mBlurredBitmap == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
r = true;
|
||||
} catch (OutOfMemoryError e) {
|
||||
// Bitmap.createBitmap() may cause OOM error
|
||||
// Simply ignore and fallback
|
||||
} finally {
|
||||
if (!r) {
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
if (prepareBlur(getContext(), mBitmapToBlur, radius)) {
|
||||
mDirty = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void blur(Bitmap bitmapToBlur, Bitmap blurredBitmap) {
|
||||
mBlurInput.copyFrom(bitmapToBlur);
|
||||
mBlurScript.setInput(mBlurInput);
|
||||
mBlurScript.forEach(mBlurOutput);
|
||||
mBlurOutput.copyTo(blurredBitmap);
|
||||
}
|
||||
|
||||
private final ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() {
|
||||
@Override
|
||||
public boolean onPreDraw() {
|
||||
final int[] locations = new int[2];
|
||||
Bitmap oldBmp = mBlurredBitmap;
|
||||
View decor = mDecorView;
|
||||
if (decor != null && isShown() && prepare()) {
|
||||
boolean redrawBitmap = mBlurredBitmap != oldBmp;
|
||||
oldBmp = null;
|
||||
decor.getLocationOnScreen(locations);
|
||||
int x = -locations[0];
|
||||
int y = -locations[1];
|
||||
|
||||
getLocationOnScreen(locations);
|
||||
x += locations[0];
|
||||
y += locations[1];
|
||||
|
||||
// just erase transparent
|
||||
mBitmapToBlur.eraseColor(mOverlayColor & 0xffffff);
|
||||
|
||||
int rc = mBlurringCanvas.save();
|
||||
mIsRendering = true;
|
||||
RENDERING_COUNT++;
|
||||
try {
|
||||
mBlurringCanvas.scale(1.f * mBitmapToBlur.getWidth() / getWidth(), 1.f * mBitmapToBlur.getHeight() / getHeight());
|
||||
mBlurringCanvas.translate(-x, -y);
|
||||
if (decor.getBackground() != null) {
|
||||
decor.getBackground().draw(mBlurringCanvas);
|
||||
}
|
||||
decor.draw(mBlurringCanvas);
|
||||
} catch (StopException e) {
|
||||
} finally {
|
||||
mIsRendering = false;
|
||||
RENDERING_COUNT--;
|
||||
mBlurringCanvas.restoreToCount(rc);
|
||||
}
|
||||
|
||||
blur(mBitmapToBlur, mBlurredBitmap);
|
||||
|
||||
if (redrawBitmap || mDifferentRoot) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
if(onece) {
|
||||
mDecorView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
protected View getActivityDecorView() {
|
||||
Context ctx = getContext();
|
||||
for (int i = 0; i < 4 && ctx != null && !(ctx instanceof Activity) && ctx instanceof ContextWrapper; i++) {
|
||||
ctx = ((ContextWrapper) ctx).getBaseContext();
|
||||
}
|
||||
if (ctx instanceof Activity) {
|
||||
return ((Activity) ctx).getWindow().getDecorView();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
mDecorView = getRootView();
|
||||
if (mDecorView != null) {
|
||||
mDecorView.getViewTreeObserver().addOnPreDrawListener(preDrawListener);
|
||||
mDifferentRoot = mDecorView.getRootView() != getRootView();
|
||||
if (mDifferentRoot) {
|
||||
mDecorView.postInvalidate();
|
||||
}
|
||||
} else {
|
||||
mDifferentRoot = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
if (mDecorView != null) {
|
||||
mDecorView.getViewTreeObserver().removeOnPreDrawListener(preDrawListener);
|
||||
}
|
||||
release();
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (mIsRendering) {
|
||||
// Quit here, don't draw views above me
|
||||
throw STOP_EXCEPTION;
|
||||
} else if (RENDERING_COUNT > 0) {
|
||||
// Doesn't support blurview overlap on another blurview
|
||||
} else {
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
drawBlurredBitmap(canvas, mBlurredBitmap, mOverlayColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom draw the blurred bitmap and color to define your own shape
|
||||
*
|
||||
* @param canvas
|
||||
* @param blurredBitmap
|
||||
* @param overlayColor
|
||||
*/
|
||||
protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) {
|
||||
if (blurredBitmap != null) {
|
||||
mRectSrc.right = blurredBitmap.getWidth();
|
||||
mRectSrc.bottom = blurredBitmap.getHeight();
|
||||
mRectDst.right = getWidth();
|
||||
mRectDst.bottom = getHeight();
|
||||
canvas.drawBitmap(blurredBitmap, mRectSrc, mRectDst, null);
|
||||
}
|
||||
mPaint.setColor(overlayColor);
|
||||
canvas.drawRect(mRectDst, mPaint);
|
||||
}
|
||||
|
||||
private static class StopException extends RuntimeException {
|
||||
}
|
||||
|
||||
private static StopException STOP_EXCEPTION = new StopException();
|
||||
|
||||
|
||||
public boolean prepareBlur(Context context, Bitmap buffer, float radius) {
|
||||
if (mRenderScript == null) {
|
||||
try {
|
||||
mRenderScript = RenderScript.create(context);
|
||||
mBlurScript = ScriptIntrinsicBlur.create(mRenderScript, Element.U8_4(mRenderScript));
|
||||
} catch (android.renderscript.RSRuntimeException e) {
|
||||
// In release mode, just ignore
|
||||
releaseBlur();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mBlurScript.setRadius(radius);
|
||||
|
||||
mBlurInput = Allocation.createFromBitmap(mRenderScript, buffer,
|
||||
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
|
||||
mBlurOutput = Allocation.createTyped(mRenderScript, mBlurInput.getType());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void releaseBlur() {
|
||||
if (mBlurInput != null) {
|
||||
mBlurInput.destroy();
|
||||
mBlurInput = null;
|
||||
}
|
||||
if (mBlurOutput != null) {
|
||||
mBlurOutput.destroy();
|
||||
mBlurOutput = null;
|
||||
}
|
||||
if (mBlurScript != null) {
|
||||
mBlurScript.destroy();
|
||||
mBlurScript = null;
|
||||
}
|
||||
if (mRenderScript != null) {
|
||||
mRenderScript.destroy();
|
||||
mRenderScript = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
55
OCH/mogo-och-common-module/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--圆角ImageView布局 -->
|
||||
<declare-styleable name="OchRoundCornerImageView">
|
||||
<attr name="och_image_radius" format="dimension" />
|
||||
<attr name="och_image_left_top_radius" format="dimension" />
|
||||
<attr name="och_image_right_top_radius" format="dimension" />
|
||||
<attr name="och_image_right_bottom_radius" format="dimension" />
|
||||
<attr name="och_image_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<!--阴影布局 -->
|
||||
<declare-styleable name="ShadowLayout">
|
||||
<!-- 阴影颜色-->
|
||||
<attr name="shadowColor" format="color"/>
|
||||
<!-- 圆角大小,默认无圆角0-->
|
||||
<attr name="shadowRadius" format="dimension"/>
|
||||
<!-- 模糊半径 -->
|
||||
<attr name="blurRadius" format="dimension" />
|
||||
<!-- 是否有点击效果-->
|
||||
<attr name="hasEffect" format="boolean"/>
|
||||
<attr name="bgColor" format="color"/>
|
||||
<!-- 水平位移-->
|
||||
<attr name="xOffset" format="dimension"/>
|
||||
<!--竖直位移 -->
|
||||
<attr name="yOffset" format="dimension"/>
|
||||
<!-- -->
|
||||
<attr name="shadow_position" format="enum">
|
||||
<enum name="normal" value="0" />
|
||||
<enum name="solid" value="1" />
|
||||
<enum name="outer" value="2" />
|
||||
<enum name="inner" value="3" />
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<!--CardView -->
|
||||
<declare-styleable name="OCHCardViewCorner">
|
||||
<attr name="och_card_left_top_radius" format="dimension" />
|
||||
<attr name="och_card_right_top_radius" format="dimension" />
|
||||
<attr name="och_card_right_bottom_radius" format="dimension" />
|
||||
<attr name="och_card_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="OCHRealtimeBlurView">
|
||||
<attr name="och_realtime_blur_radius" format="dimension" />
|
||||
<attr name="och_realtime_downsample_factor" format="float" />
|
||||
<attr name="och_realtime_overlay_color" format="color" />
|
||||
<attr name="och_realtime_onece" format="boolean" />
|
||||
</declare-styleable>
|
||||
<declare-styleable name="OCHRShapeBlurView">
|
||||
<attr name="och_realtime_start_color" format="color" />
|
||||
<attr name="och_realtime_end_color" format="color" />
|
||||
<attr name="och_realtime_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.common.module
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation rootProject.ext.dependencies.amapsearch
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
@@ -61,6 +62,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_call
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_v2x
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
}else {
|
||||
implementation project(":core:mogo-core-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
@@ -68,6 +70,7 @@ dependencies {
|
||||
implementation project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-function-call')
|
||||
implementation project(':core:function-impl:mogo-core-function-v2x')
|
||||
implementation project(':core:mogo-core-res')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.taxi.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 查询订单返回数据结构
|
||||
*/
|
||||
public class TaxiPassengerBaseRespBean extends BaseData {
|
||||
public Object data;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.passenger.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 验证手机号后四位同时流转订单状态
|
||||
*/
|
||||
public class TaxiPassengerCheckPhoneUpdateOrderReqBean {
|
||||
|
||||
public String orderNo;
|
||||
public String phone;
|
||||
|
||||
public TaxiPassengerCheckPhoneUpdateOrderReqBean(String orderNo,String phone) {
|
||||
this.orderNo = orderNo;
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,10 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
|
||||
public long startTime;
|
||||
//预计用车时间:预约单=下单时的预约用车时间;即时单=派单成功的时间+预估的达到上车点的时间
|
||||
public long bookingTime;
|
||||
|
||||
//乘客手机号
|
||||
public String passengerPhone;
|
||||
//订单多少乘客
|
||||
public String passengerNum;
|
||||
|
||||
|
||||
// !!!接口中暂无此字段,仅用于本地实现逻辑使用:起始站目的站距离km
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.passenger.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 验证手机号后四位同时流转订单状态
|
||||
*/
|
||||
public class TaxiPassengerScoreUpdateOrderReqBean {
|
||||
|
||||
public String orderNo;
|
||||
public int star;
|
||||
|
||||
public TaxiPassengerScoreUpdateOrderReqBean(String orderNo, int star) {
|
||||
this.orderNo = orderNo;
|
||||
this.star = star;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
public interface ITaxiPassengerCommonCallback {
|
||||
void onCommonCallback();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
public interface ITaxiPassengerCommonValueCallback<T> {
|
||||
void onCommonCallback(T t);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
public interface ITaxiPassengerScoreCallback {
|
||||
void onScoreCallback(int fraction,String orderNo);
|
||||
}
|
||||
@@ -26,9 +26,12 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
@@ -38,13 +41,14 @@ import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerAutopilotPlanningCa
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerNaviChangedCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceCallback;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.och.taxi.passenger.utils.TPCoordinateCalculateRouteUtil;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -478,6 +482,11 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
@@ -563,7 +572,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
calculateRouteLineSum(TPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routeList.getWayPointsList()));
|
||||
calculateRouteLineSum(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routeList.getWayPointsList()));
|
||||
updateRouteResult(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
@@ -649,7 +658,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
|
||||
queryOrderRouteList();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -669,10 +678,65 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
|
||||
public void calculateRouteLineSum(List<LatLng> points){
|
||||
float sumLength = TPCoordinateCalculateRouteUtil.calculateRouteSumLength(points);
|
||||
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(points);
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,(int) sumLength);
|
||||
}
|
||||
|
||||
public void checkPhoneAndUpdateStatus(String phoneTail,ITaxiPassengerCommonCallback commonCallback) {
|
||||
if (mCurrentOCHOrder == null) return;
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "--route--- checkPhoneAndUpdateStatus");
|
||||
TaxiPassengerServiceManager.getInstance().checkPhoneAndUpdateOrderStatus(mContext, mCurrentOCHOrder.orderNo,
|
||||
phoneTail, new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
if(commonCallback!=null) {
|
||||
commonCallback.onCommonCallback();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
ToastUtils.showLong("当前网络异常,请重新验证;若始终异常,请您在手机端取消行程,给您带来不便,十分抱歉!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtils.showLong("当前网络异常,请重新验证;若始终异常,请您在手机端取消行程,给您带来不便,十分抱歉!");
|
||||
CallerLogger.INSTANCE.e(TAG,"提交用户输入的手机后4位、并进行状态扭转 后台结果错误"+code+msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void arrivedAndScore(int score,String orderNo ,ITaxiPassengerCommonValueCallback<Boolean> commonCallback) {
|
||||
if (orderNo == null) return;
|
||||
TaxiPassengerServiceManager.getInstance().arrivedAndScore(mContext,orderNo,score,
|
||||
new TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean>() {
|
||||
@Override
|
||||
public void onSuccess(TaxiPassengerBaseRespBean data) {
|
||||
if(commonCallback!=null) {
|
||||
commonCallback.onCommonCallback(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
ToastUtils.showLong("网络错误请稍后再试");
|
||||
CallerLogger.INSTANCE.e(TAG,"对订单进行打分 1-5分 网络错误");
|
||||
if(commonCallback!=null) {
|
||||
commonCallback.onCommonCallback(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
CallerLogger.INSTANCE.e(TAG,"对订单进行打分 1-5分 后台结果错误"+code+msg);
|
||||
if(commonCallback!=null) {
|
||||
commonCallback.onCommonCallback(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void runOnUIThread(Runnable executor) {
|
||||
if (executor == null) {
|
||||
return;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.mogo.och.taxi.passenger.network;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerCheckPhoneUpdateOrderReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerQueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerScoreUpdateOrderReqBean;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -63,4 +66,23 @@ interface TaxiPassengerServiceApi {
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/serviceStatus/query" )
|
||||
@GET( "/autopilot-car-hailing/order/v2/driver/taxi/passenger/orderRoute" )
|
||||
Observable<TaxiPassengerQueryOrderRouteResp> queryOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("orderNo") String orderNo);
|
||||
|
||||
/**
|
||||
* 提交用户输入的手机后4位、并进行状态扭转
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/order/v2/vehicle/taxi/passenger/verification/phone" )
|
||||
Observable<TaxiPassengerBaseRespBean> checkPhoneAndUpdateOrderStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body TaxiPassengerCheckPhoneUpdateOrderReqBean data);
|
||||
|
||||
/**
|
||||
* 对订单进行打分 1-5分
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/evaluation/vehicle/taxi/passenger/add" )
|
||||
Observable<TaxiPassengerBaseRespBean> arrivedAndScore(@Header ("appId") String appId, @Header("ticket") String ticket, @Body TaxiPassengerScoreUpdateOrderReqBean data);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,12 +12,16 @@ 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.module.common.MogoApisHandler;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerBaseRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerCheckPhoneUpdateOrderReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRemainingResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryReqBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerQueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerScoreUpdateOrderReqBean;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -49,8 +53,12 @@ public class TaxiPassengerServiceManager {
|
||||
* @return
|
||||
*/
|
||||
private String getDriverAppSn(){
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
// return "X2020210525EFA93B5946FA38D4";
|
||||
if(DebugConfig.isDebug()){
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
}else {
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
}
|
||||
// return "X2020220425Q466X1F";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,4 +149,24 @@ public class TaxiPassengerServiceManager {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void checkPhoneAndUpdateOrderStatus(Context context, String orderNo,String phone ,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
|
||||
mOCHTaxiServiceApi.checkPhoneAndUpdateOrderStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerCheckPhoneUpdateOrderReqBean(orderNo,phone))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"));
|
||||
}
|
||||
public void arrivedAndScore(Context context, String orderNo,int star,TaxiPassengerServiceCallback<TaxiPassengerBaseRespBean> callback){
|
||||
mOCHTaxiServiceApi.arrivedAndScore(
|
||||
MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new TaxiPassengerScoreUpdateOrderReqBean(orderNo,star))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context, callback, "checkPhoneAndUpdateOrderStatus"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerADASStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerControllerStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerGeocodeSearchModel;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
@@ -121,7 +123,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
|
||||
if (mCurrentPassengerOrder == null){
|
||||
mCurrentPassengerOrder = order; //当前无订单
|
||||
updateOrderView(order);
|
||||
@@ -143,35 +145,66 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
|
||||
private void updateOrderView(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P+TAG,"updateOrderView = "+order.orderStatus);
|
||||
// 70 取消订单
|
||||
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == order.orderStatus){
|
||||
runOnUIThread(() -> mView.showOrHideServingOrderFragment(false));
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHidePressengerCheckPager(false, "",
|
||||
"", "", "", "");
|
||||
mView.showOrHideArrivedEndLayout(false,"","");
|
||||
});
|
||||
TaxiPassengerModel.getInstance().recoverNaviInfo();
|
||||
TaxiPassengerGeocodeSearchModel.getInstance(getContext()).destroyGeocodeSearch();
|
||||
return;
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStart.getCode() == order.orderStatus
|
||||
// 20 司机到达上车点
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStart.getCode() == order.orderStatus) {
|
||||
runOnUIThread(() -> {
|
||||
mView.preOrderThankPageTenlogic(order.startSiteAddr,
|
||||
order.endSiteAddr, order.passengerNum, order.carNumber, order.passengerPhone);
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 30 用户到达上车点 并通过了手机号后四位验证
|
||||
// 40 服务中
|
||||
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus
|
||||
|| TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
runOnUIThread(() -> mView.showOrHideServingOrderFragment(true));
|
||||
return;
|
||||
}
|
||||
// 50 到达终点 乘客可以评价
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus){
|
||||
TaxiPassengerModel.getInstance().recoverNaviInfo();
|
||||
TaxiPassengerGeocodeSearchModel.getInstance(getContext()).destroyGeocodeSearch();
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHideArrivedEndLayout(true, order.endSiteAddr);
|
||||
mView.showOrHideArrivedEndLayout(true, order.endSiteAddr,order.orderNo);
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 60 服务完成 页面
|
||||
if (TaxiPassengerOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHideArrivedEndLayout(false, "");
|
||||
});
|
||||
TaxiPassengerGeocodeSearchModel.getInstance(getContext()).destroyGeocodeSearch();
|
||||
mCurrentPassengerOrder = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void checkAndUpdateStatus(String phone){
|
||||
TaxiPassengerModel.getInstance().checkPhoneAndUpdateStatus(phone, new ITaxiPassengerCommonCallback() {
|
||||
@Override
|
||||
public void onCommonCallback() {
|
||||
mView.showOrHidePressengerCheckPager(false,"","","","","");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param score 分数
|
||||
*/
|
||||
public void arrivedAndScore(int score,String orderNo){
|
||||
TaxiPassengerModel.getInstance().arrivedAndScore(score,orderNo, aBoolean -> mView.showArrivedEndLayout2Thank(aBoolean));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/22
|
||||
*/
|
||||
public class GradientTextView extends AppCompatTextView {
|
||||
|
||||
private LinearGradient mLinearGradient;
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
private float mRadius;
|
||||
private float mdx;
|
||||
private float mdy;
|
||||
private int mColor;
|
||||
|
||||
public GradientTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public GradientTextView(Context context,
|
||||
AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
//设置默认的颜色
|
||||
mColorList = new int[]{0xFFFFFFFF, 0xFFFFFFF};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
|
||||
if (isVertrial) {
|
||||
mViewHeight = getMeasuredHeight();
|
||||
} else {
|
||||
mViewWidth = getMeasuredWidth();
|
||||
}
|
||||
mPaint = getPaint();
|
||||
String mTipText = getText().toString();
|
||||
|
||||
setStyle();
|
||||
|
||||
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
|
||||
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
* true表示纵向渐变,false变身横向渐变
|
||||
*
|
||||
* @param vertrial
|
||||
*/
|
||||
public void setVertrial(boolean vertrial) {
|
||||
isVertrial = vertrial;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置渐变的颜色
|
||||
*
|
||||
* @param mColorList
|
||||
*/
|
||||
public void setmColorList(int[] mColorList) {
|
||||
if (mColorList != null && mColorList.length < 2) {
|
||||
throw new RuntimeException("ClorList's length must be > 2");
|
||||
} else {
|
||||
|
||||
this.mColorList = mColorList;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyle() {
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
mPaint.setFilterBitmap(true);
|
||||
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
|
||||
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
mPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置投影层
|
||||
* @param radius
|
||||
* @param dx
|
||||
* @param dy
|
||||
* @param color
|
||||
*/
|
||||
public void setShadowLayerCustom(float radius, float dx, float dy, int color) {
|
||||
this.mRadius = radius;
|
||||
this.mdx = dx;
|
||||
this.mdy = dy;
|
||||
this.mColor = color;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package com.mogo.och.taxi.passenger.ui
|
||||
|
||||
import android.animation.*
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.AnimationDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import com.amap.api.navi.view.PoiInputSearchWidget
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerScoreCallback
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 评价View
|
||||
* Created on 2022/5/16
|
||||
*/
|
||||
class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
private lateinit var mArrivedEndStation: TextView
|
||||
private lateinit var tvFeel: TextView
|
||||
private lateinit var ochShadowLayout: OCHBorderShadowLayout
|
||||
private lateinit var ochThankShadowLayout: OCHBorderShadowLayout
|
||||
private lateinit var ivStarFirst: ImageView
|
||||
private lateinit var ivStarSecond: ImageView
|
||||
private lateinit var ivStarThird: ImageView
|
||||
private lateinit var ivStarFourth: ImageView
|
||||
private lateinit var ivStarFifth: ImageView
|
||||
private lateinit var ivAnimalList: ImageView
|
||||
private lateinit var svpFrame: SimpleVideoPlayer
|
||||
private var subscribe: Disposable?=null
|
||||
private var orderNo = ""
|
||||
|
||||
private val gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
|
||||
|
||||
var iTaxiPassengerScoreCallback: ITaxiPassengerScoreCallback?=null
|
||||
|
||||
var taxiPassengerCommonCallback: ITaxiPassengerCommonCallback?=null
|
||||
var left2Right: Animation = AnimationUtils.loadAnimation(
|
||||
context, R.anim.left_to_right
|
||||
)
|
||||
var right2Left: Animation = AnimationUtils.loadAnimation(
|
||||
context, R.anim.right_to_left
|
||||
)
|
||||
var alphaAnimation: Animation = AnimationUtils.loadAnimation(
|
||||
context, R.anim.alpha_hide_show
|
||||
)
|
||||
|
||||
private var allStartOrdered = mutableListOf<ImageView>()
|
||||
|
||||
var showThanks:Boolean = false
|
||||
|
||||
private fun initView(context: Context) {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "initView")
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_arrived_end_panel, this, true)
|
||||
mArrivedEndStation = findViewById(R.id.arrived_end_station)
|
||||
tvFeel = findViewById(R.id.tv_feel)
|
||||
ochShadowLayout = findViewById(R.id.och_shadow_layout)
|
||||
ochThankShadowLayout = findViewById(R.id.och_thank_shadow_layout)
|
||||
ivAnimalList = findViewById(R.id.iv_animal_list)
|
||||
svpFrame = findViewById(R.id.svp_frame)
|
||||
svpFrame.setBackgroundResource(R.drawable.tail_ani_0000)
|
||||
svpFrame.setIsTouchWiget(false)
|
||||
svpFrame.setIsTouchWigetFull(false)
|
||||
svpFrame.enableshowProgressDialog = false
|
||||
svpFrame.enableDoubleClick = false
|
||||
|
||||
allStartOrdered = mutableListOf()
|
||||
initScore()
|
||||
|
||||
findViewById<View>(R.id.tv_please_score).setOnClickListener(this)
|
||||
|
||||
// debug 弹出
|
||||
mArrivedEndStation.setOnLongClickListener {
|
||||
scoreSuccess()
|
||||
false
|
||||
}
|
||||
|
||||
val url = "android.resource://" + context.packageName + "/" + R.raw.end_video
|
||||
gsyVideoOptionBuilder.setUrl(url)
|
||||
.setCacheWithPlay(false)
|
||||
.setPlayTag("TaxiPassengerArrivedView")
|
||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||
override fun onAutoComplete(url: String?, vararg objects: Any?) {
|
||||
svpFrame.setBackgroundResource(R.drawable.tail_ani_0090)
|
||||
}
|
||||
})
|
||||
.build(svpFrame)
|
||||
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL)
|
||||
}
|
||||
|
||||
private fun initScore() {
|
||||
ivStarFirst = findViewById(R.id.iv_star_first)
|
||||
ivStarSecond = findViewById(R.id.iv_star_second)
|
||||
ivStarThird = findViewById(R.id.iv_star_third)
|
||||
ivStarFourth = findViewById(R.id.iv_star_fourth)
|
||||
ivStarFifth = findViewById(R.id.iv_star_fifth)
|
||||
ivStarFirst.setOnClickListener(this)
|
||||
ivStarSecond.setOnClickListener(this)
|
||||
ivStarThird.setOnClickListener(this)
|
||||
ivStarFourth.setOnClickListener(this)
|
||||
ivStarFifth.setOnClickListener(this)
|
||||
|
||||
allStartOrdered.add(ivStarFirst)
|
||||
allStartOrdered.add(ivStarSecond)
|
||||
allStartOrdered.add(ivStarThird)
|
||||
allStartOrdered.add(ivStarFourth)
|
||||
allStartOrdered.add(ivStarFifth)
|
||||
}
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
svpFrame.setBackgroundResource(R.drawable.tail_ani_0000)
|
||||
super.onDetachedFromWindow()
|
||||
subscribe?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.tv_please_score -> {
|
||||
iTaxiPassengerScoreCallback?.onScoreCallback(2,orderNo)
|
||||
}
|
||||
R.id.iv_star_first -> {commitAndStartAnimation(1,"不满意")}
|
||||
R.id.iv_star_second -> {commitAndStartAnimation(2,"不满意")}
|
||||
R.id.iv_star_third -> {commitAndStartAnimation(3,"一般")}
|
||||
R.id.iv_star_fourth -> {commitAndStartAnimation(4,"舒适")}
|
||||
R.id.iv_star_fifth -> {commitAndStartAnimation(5,"舒适")}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun commitAndStartAnimation(fraction: Int,title:String) {
|
||||
tvFeel.text = title
|
||||
startStartAnimation(fraction)
|
||||
allStartOrdered.forEach {
|
||||
it.isEnabled = false
|
||||
}
|
||||
}
|
||||
private var currentAnimarion = 0
|
||||
private var maxIndex = 0
|
||||
private fun startStartAnimation(fraction: Int) {
|
||||
currentAnimarion = 0
|
||||
maxIndex = fraction-1
|
||||
try {
|
||||
animation(fraction)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 星星动画
|
||||
*/
|
||||
private fun animation(fraction: Int) {
|
||||
|
||||
val showView = allStartOrdered[currentAnimarion]
|
||||
showView.setImageResource(R.drawable.taxi_p_passenger_star_check)
|
||||
val alpha = ObjectAnimator.ofFloat(showView, "alpha", 0.1f, 1f)
|
||||
.setDuration(120)
|
||||
alpha.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener{
|
||||
var isStart = false
|
||||
override fun onAnimationUpdate(animation: ValueAnimator?) {
|
||||
val animatedValue = animation?.getAnimatedValue("alpha")
|
||||
animatedValue as Float
|
||||
if(animatedValue>0.45&&!isStart){
|
||||
isStart = true
|
||||
//开始下一个
|
||||
if(currentAnimarion==maxIndex){
|
||||
return
|
||||
}
|
||||
currentAnimarion++
|
||||
animation(fraction)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
val keyframe1 = Keyframe.ofFloat(0f,1f)
|
||||
val keyframe3 = Keyframe.ofFloat(0.9f,1.2f)
|
||||
val keyframe4 = Keyframe.ofFloat(1f,1f)
|
||||
val holderX = PropertyValuesHolder.ofKeyframe(
|
||||
"scaleX", keyframe1, keyframe3, keyframe4
|
||||
)
|
||||
val holderY = PropertyValuesHolder.ofKeyframe(
|
||||
"scaleY", keyframe1, keyframe3, keyframe4
|
||||
)
|
||||
val scaleX = ObjectAnimator.ofPropertyValuesHolder(showView, holderX).setDuration(240)
|
||||
val scaleY = ObjectAnimator.ofPropertyValuesHolder(showView, holderY).setDuration(240)
|
||||
|
||||
|
||||
val set = AnimatorSet()
|
||||
set.play(scaleX).with(scaleY).with(alpha)
|
||||
if(currentAnimarion==maxIndex) {
|
||||
// 最后一个动画结束后提交积分
|
||||
set.addListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
super.onAnimationEnd(animation)
|
||||
iTaxiPassengerScoreCallback?.onScoreCallback(fraction,orderNo)
|
||||
}
|
||||
})
|
||||
}
|
||||
set.start()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置目的地重置星星状态
|
||||
*/
|
||||
fun setDataAndStartAnimation(endSiteAddr: String?,orderId:String) {
|
||||
mArrivedEndStation.text = endSiteAddr
|
||||
ochThankShadowLayout.visibility = View.GONE
|
||||
ivAnimalList.visibility = View.GONE
|
||||
|
||||
svpFrame.startButton.performClick()
|
||||
postDelayed({
|
||||
ochShadowLayout.visibility = View.VISIBLE
|
||||
ochShadowLayout.startAnimation(left2Right)
|
||||
},1928)
|
||||
|
||||
showThanks = false
|
||||
this.orderNo = orderId
|
||||
resetStar()
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论成功 向左移动并消失 消失后感谢页面透明度0-1 然后开始小手的动画
|
||||
*/
|
||||
fun scoreSuccess(){
|
||||
right2Left.setAnimationListener(object :PoiInputSearchWidget.AnimationListenerAdapter(){
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
ochShadowLayout.visibility = View.GONE
|
||||
ochThankShadowLayout.startAnimation(alphaAnimation)
|
||||
ivAnimalList.startAnimation(alphaAnimation)
|
||||
alphaAnimation.setAnimationListener(object : PoiInputSearchWidget.AnimationListenerAdapter(){
|
||||
override fun onAnimationStart(p0: Animation?) {
|
||||
ochThankShadowLayout.visibility = View.VISIBLE
|
||||
ivAnimalList.visibility = View.VISIBLE
|
||||
showThanks = true
|
||||
}
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
val animationDrawable = ivAnimalList.drawable as AnimationDrawable
|
||||
animationDrawable.start()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
ochShadowLayout.startAnimation(right2Left)
|
||||
|
||||
// 10s 后逻辑
|
||||
subscribe = Observable.timer(10000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
// 正在展示感谢页面
|
||||
taxiPassengerCommonCallback?.onCommonCallback()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 评论失败 重置状态
|
||||
*/
|
||||
fun scoreFail(){
|
||||
scoreSuccess()
|
||||
// tvFeel.text = ""
|
||||
// resetStar()
|
||||
}
|
||||
|
||||
private fun resetStar() {
|
||||
allStartOrdered.forEach {
|
||||
it.setImageResource(R.drawable.taxi_p_passenger_star)
|
||||
it.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaxiPassengerArrivedView"
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,11 @@ package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -28,6 +25,8 @@ import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.presenter.BaseTaxiPassengerPresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
@@ -48,8 +47,8 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
private TaxiPassengerV2XNotificationView mV2XNotificationView;
|
||||
|
||||
// private ConstraintLayout mArrivedEndCL;
|
||||
private View mArrivedEndView;
|
||||
private TextView mArrivedEndStation;
|
||||
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
|
||||
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
|
||||
|
||||
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
|
||||
|
||||
@@ -79,25 +78,9 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
mV2XNotificationView = new TaxiPassengerV2XNotificationView(getContext());
|
||||
CallerHmiManager.INSTANCE.setProxyNotificationView(mV2XNotificationView);
|
||||
|
||||
// mArrivedEndCL = findViewById(R.id.taxi_p_arrive_end_bg);
|
||||
mArrivedEndView = LayoutInflater.from(getContext()).inflate(R.layout.taxi_p_arrived_end_panel,null);
|
||||
mArrivedEndStation = mArrivedEndView.findViewById(R.id.arrived_end_station);
|
||||
|
||||
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
|
||||
mMapswitchBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//视角切换
|
||||
if (MogoMapUIController.getInstance()
|
||||
.getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateSwitchMapIcon();
|
||||
initListener();
|
||||
|
||||
onAutopilotStatusChanged(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
|
||||
@@ -108,6 +91,48 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSwitchMapIcon(){
|
||||
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
|
||||
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_long);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
|
||||
}
|
||||
}
|
||||
private void initListener(){
|
||||
mMapswitchBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//视角切换
|
||||
if (MogoMapUIController.getInstance()
|
||||
.getCurrentMapVisualAngle().isLongSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
|
||||
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
|
||||
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_long);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.iv_temp).setOnClickListener(view -> {
|
||||
//showOrHideArrivedEndLayout(true, "北京北京北京", "1527481606997577728");
|
||||
//showOrHidePressengerCheckPager(true, "开始站点开", "开始站点开始站点开始", "2", "京A888888", "18811539480");
|
||||
//CallerHmiManager.INSTANCE.showToolsView();
|
||||
});
|
||||
}
|
||||
|
||||
private void initArrivedView(){
|
||||
mArrivedEndView = new WeakReference<>(new TaxiPassengerArrivedView(getContext()));
|
||||
mArrivedEndView.get().setITaxiPassengerScoreCallback((fraction, orderNo) -> getPresenter().arrivedAndScore(fraction,orderNo));
|
||||
}
|
||||
|
||||
private void initCheckView() {
|
||||
mArrivedCheckView = new WeakReference<>(new TaxiPassengerCheckView(getContext()));
|
||||
mArrivedCheckView.get().setITaxiPassengerCommonValueCallback(phoneTail -> getPresenter().checkAndUpdateStatus(phoneTail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏鹰眼原有控件
|
||||
*/
|
||||
@@ -189,8 +214,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
}, 1000L);
|
||||
}
|
||||
|
||||
private boolean isStarting = false;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected BaseTaxiPassengerPresenter createPresenter() {
|
||||
@@ -241,16 +264,82 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
||||
|
||||
/**
|
||||
* 显示或者隐藏到达乘客站点的洁面
|
||||
* @param isShow
|
||||
* ① 取消订单 可有可无
|
||||
* ② 到达上车点 隐藏到达终点的页面(上一个订单没有评价)
|
||||
* ③ 到达目的地 显示到达终点的页面
|
||||
* ④ debug 使用
|
||||
* @param isShow true 展示 false 隐藏
|
||||
* @param arrivedEndStation 目的地
|
||||
* @param orderNo 订单No
|
||||
*/
|
||||
public void showOrHideArrivedEndLayout(boolean isShow, String arrivedEndStation){
|
||||
public void showOrHideArrivedEndLayout(boolean isShow, String arrivedEndStation,String orderNo){
|
||||
if (isShow){
|
||||
// mArrivedEndCL.setVisibility(View.VISIBLE);
|
||||
OverlayViewUtils.showOverlayView(getActivity(),mArrivedEndView);
|
||||
mArrivedEndStation.setText(arrivedEndStation);
|
||||
if(mArrivedEndView==null||mArrivedEndView.get()==null){
|
||||
initArrivedView();
|
||||
}
|
||||
OverlayViewUtils.showOverlayView(getActivity(),mArrivedEndView.get(),R.style.och_window_anim_alpha);
|
||||
mArrivedEndView.get().setDataAndStartAnimation(arrivedEndStation,orderNo);
|
||||
}else {
|
||||
// mArrivedEndCL.setVisibility(View.GONE);
|
||||
OverlayViewUtils.dismissOverlayView(mArrivedEndView);
|
||||
if(mArrivedEndView==null||mArrivedEndView.get()==null){
|
||||
return;
|
||||
}
|
||||
OverlayViewUtils.dismissOverlayView(mArrivedEndView.get());
|
||||
}
|
||||
}
|
||||
// 20 司机到达上车点
|
||||
public void preOrderThankPageTenlogic(String startSiteAddr,
|
||||
String endSiteAddr,
|
||||
String passengerNum,
|
||||
String carNumber,
|
||||
String phone){
|
||||
// 正在展示打分页面或者正在展示感谢页面
|
||||
showOrHideArrivedEndLayout(false, "","");
|
||||
showOrHidePressengerCheckPager(true, startSiteAddr,
|
||||
endSiteAddr, passengerNum, carNumber, phone);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ① 取消订单 到达上车点后乘客取消订单 隐藏乘客验证页面
|
||||
* ② 司机到达上车点 到达上车点 展示乘客验证页面
|
||||
* ③ 乘客到达上车点 手机号验证成功后 隐藏乘客验证页面
|
||||
* ④ debug 使用
|
||||
*/
|
||||
public void showOrHidePressengerCheckPager(boolean isShow, String startSiteAddr,
|
||||
String endSiteAddr,
|
||||
String passengerNum,
|
||||
String carNumber,
|
||||
String phone) {
|
||||
try {
|
||||
if (isShow) {
|
||||
if(mArrivedCheckView==null||mArrivedCheckView.get()==null){
|
||||
initCheckView();
|
||||
}
|
||||
mArrivedCheckView.get().setData(startSiteAddr, endSiteAddr, passengerNum, carNumber,phone);
|
||||
OverlayViewUtils.showOverlayView(getActivity(), mArrivedCheckView.get());
|
||||
} else {
|
||||
if(mArrivedCheckView==null||mArrivedCheckView.get()==null){
|
||||
return;
|
||||
}
|
||||
OverlayViewUtils.dismissOverlayView(mArrivedCheckView.get());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户评分后接口回调
|
||||
* @param isSuccess true 打分成功 false 打分失败
|
||||
*/
|
||||
public void showArrivedEndLayout2Thank(boolean isSuccess) {
|
||||
if(mArrivedEndView==null||mArrivedEndView.get()==null){
|
||||
initArrivedView();
|
||||
}
|
||||
if(isSuccess){
|
||||
mArrivedEndView.get().scoreSuccess();
|
||||
}else {
|
||||
mArrivedEndView.get().scoreFail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
package com.mogo.och.taxi.passenger.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.TextAppearanceSpan
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback
|
||||
|
||||
/**
|
||||
* V2X预警事件view:通过FloatWindow呈现,无需加入到自定义layout中
|
||||
*
|
||||
* Created on 2022/3/16
|
||||
*/
|
||||
class TaxiPassengerCheckView :RelativeLayout, View.OnClickListener {
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
var iTaxiPassengerCommonValueCallback: ITaxiPassengerCommonValueCallback<String>?=null
|
||||
|
||||
private lateinit var tvPassengerCount: TextView
|
||||
private lateinit var tvPassengerStart: TextView
|
||||
private lateinit var tvPassengerEnd: TextView
|
||||
private lateinit var tvTaxiNumber: TextView
|
||||
private lateinit var tvTaxiPassengerNumberfirst: TextView
|
||||
private lateinit var tvTaxiPassengerNumberSecond: TextView
|
||||
private lateinit var tvTaxiPassengerNumberThird: TextView
|
||||
private lateinit var tvTaxiPassengerNumberFourth: TextView
|
||||
|
||||
private var index = 0
|
||||
private var phone = ""
|
||||
private val numSelect = arrayOfNulls<Int>(4)
|
||||
private val numSelectTextView = arrayOfNulls<TextView>(4)
|
||||
|
||||
private fun initView(context: Context) {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "initView")
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_passenger_check_panel, this, true)
|
||||
tvPassengerCount = findViewById(R.id.tv_passenger_count)
|
||||
tvPassengerStart = findViewById(R.id.tv_passenger_start)
|
||||
tvPassengerEnd = findViewById(R.id.tv_passenger_end)
|
||||
tvTaxiNumber = findViewById(R.id.tv_taxi_number)
|
||||
tvTaxiPassengerNumberfirst = findViewById(R.id.tv_taxi_passenger_number_first)
|
||||
tvTaxiPassengerNumberSecond = findViewById(R.id.tv_taxi_passenger_number_second)
|
||||
tvTaxiPassengerNumberThird = findViewById(R.id.tv_taxi_passenger_number_third)
|
||||
tvTaxiPassengerNumberFourth = findViewById(R.id.tv_taxi_passenger_number_fourth)
|
||||
keyBoardLogic()
|
||||
numSelectTextView[0] = tvTaxiPassengerNumberfirst
|
||||
numSelectTextView[1] = tvTaxiPassengerNumberSecond
|
||||
numSelectTextView[2] = tvTaxiPassengerNumberThird
|
||||
numSelectTextView[3] = tvTaxiPassengerNumberFourth
|
||||
}
|
||||
|
||||
private fun keyBoardLogic() {
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_one).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_two).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_three).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_four).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_five).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_six).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_seven).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_eight).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_nine).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_zero).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_back).setOnClickListener(this)
|
||||
findViewById<TextView>(R.id.tv_taxi_passenger_number_submit).setOnClickListener(this)
|
||||
|
||||
tvTaxiPassengerNumberfirst.setOnClickListener(this)
|
||||
tvTaxiPassengerNumberSecond.setOnClickListener(this)
|
||||
tvTaxiPassengerNumberThird.setOnClickListener(this)
|
||||
tvTaxiPassengerNumberFourth.setOnClickListener(this)
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.tv_taxi_passenger_number_one -> {showNumver(1)}
|
||||
R.id.tv_taxi_passenger_number_two -> {showNumver(2)}
|
||||
R.id.tv_taxi_passenger_number_three-> {showNumver(3)}
|
||||
R.id.tv_taxi_passenger_number_four-> {showNumver(4)}
|
||||
R.id.tv_taxi_passenger_number_five -> {showNumver(5)}
|
||||
R.id.tv_taxi_passenger_number_six -> {showNumver(6)}
|
||||
R.id.tv_taxi_passenger_number_seven -> {showNumver(7)}
|
||||
R.id.tv_taxi_passenger_number_eight -> {showNumver(8)}
|
||||
R.id.tv_taxi_passenger_number_nine -> {showNumver(9)}
|
||||
R.id.tv_taxi_passenger_number_zero -> {showNumver(0)}
|
||||
R.id.tv_taxi_passenger_number_back -> {deleteNumver()}
|
||||
R.id.tv_taxi_passenger_number_first -> {selectIndex(0)}
|
||||
R.id.tv_taxi_passenger_number_second -> {selectIndex(1)}
|
||||
R.id.tv_taxi_passenger_number_third -> {selectIndex(2)}
|
||||
R.id.tv_taxi_passenger_number_fourth -> {selectIndex(3)}
|
||||
R.id.tv_taxi_passenger_number_submit -> {checkAndCommit()}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAndCommit() {
|
||||
val numberStr = "${numSelect[0]}${numSelect[1]}${numSelect[2]}${numSelect[3]}"
|
||||
if(!phone.endsWith(numberStr)){
|
||||
ToastUtils.showLong("请输入正确的手机尾号")
|
||||
return
|
||||
}
|
||||
iTaxiPassengerCommonValueCallback?.onCommonCallback(numberStr)
|
||||
}
|
||||
|
||||
private fun selectIndex(i: Int) {
|
||||
index = i
|
||||
changeStyle()
|
||||
}
|
||||
|
||||
private fun showNumver(number: Int) {
|
||||
if (index in 0..3) {
|
||||
numSelect[index] = number
|
||||
numSelectTextView[index]!!.text = number.toString()
|
||||
if(index!=3){
|
||||
index++
|
||||
}
|
||||
changeStyle()
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteNumver() {
|
||||
if (index in 0..3) {
|
||||
if(numSelect[index]==null){
|
||||
if(index!=0){
|
||||
index--
|
||||
}
|
||||
changeStyle()
|
||||
//return
|
||||
}
|
||||
numSelect[index] = null
|
||||
numSelectTextView[index]!!.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeStyle() {
|
||||
numSelectTextView.forEachIndexed { indexIn, textView ->
|
||||
if(indexIn==index){
|
||||
numSelectTextView[index]!!.setBackgroundResource(R.drawable.bg_taxi_p_checked_input_background)
|
||||
numSelectTextView[index]!!.setTextColor(resources.getColor(R.color.taxi_p_check_keyboard_input_field_checked))
|
||||
numSelectTextView[index]!!.setShadowLayer(0f,0f,0f,
|
||||
resources.getColor(R.color.taxi_p_check_keyboard_input_field_checked_text_shadow))
|
||||
}else{
|
||||
numSelectTextView[indexIn]!!.setBackgroundResource(R.drawable.bg_taxi_p_check_input_background)
|
||||
numSelectTextView[indexIn]!!.setTextColor(resources.getColor(R.color.taxi_p_check_keyboard_input_field))
|
||||
numSelectTextView[indexIn]!!.setShadowLayer(20f,0f,2f,
|
||||
resources.getColor(R.color.taxi_p_check_keyboard_input_field_checked_text_shadow))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setData(
|
||||
startSiteAddr: String?,
|
||||
endSiteAddr: String?,
|
||||
passengerNum: String?,
|
||||
carNumber: String?,
|
||||
phone: String?
|
||||
) {
|
||||
this.phone = phone?:""
|
||||
val sb = SpannableStringBuilder("乘客数:$passengerNum 位") // 包装字体内容
|
||||
sb.setSpan(
|
||||
TextAppearanceSpan("default",
|
||||
Typeface.NORMAL,100,
|
||||
resources.getColorStateList(R.color.taxi_p_check_passenger_number) ,null ),
|
||||
4, 5, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
|
||||
tvPassengerCount.text = sb
|
||||
tvPassengerStart.text = "起 点 : $startSiteAddr"
|
||||
tvPassengerEnd.text = "终 点 : $endSiteAddr"
|
||||
tvTaxiNumber.text = "蘑菇 " + carNumber + "为您服务"
|
||||
for(i in numSelect.indices){
|
||||
numSelect[i] = null
|
||||
}
|
||||
numSelectTextView.forEach {
|
||||
it?.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaxiPassengerCheckView"
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,10 +226,12 @@ public class TaxiPassengerMapDirectionView
|
||||
//设置线段纹理
|
||||
PolylineOptions polylineOptions = new PolylineOptions();
|
||||
polylineOptions.addAll(mCoordinatesLatLng);
|
||||
polylineOptions.colorValues(colorList); // 1FC3FF -> 57ABFF
|
||||
polylineOptions.useGradient(true);
|
||||
polylineOptions.width(10);
|
||||
//polylineOptions.colorValues(colorList); // 1FC3FF -> 57ABFF
|
||||
//加上这个属性,表示使用渐变线
|
||||
//polylineOptions.useGradient(true);
|
||||
polylineOptions.width(15);
|
||||
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
|
||||
polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions);
|
||||
|
||||
@@ -22,6 +22,10 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.common.module.wigets.OCHRadiusImageView;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerMapViewCallback;
|
||||
@@ -30,7 +34,6 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.presenter.TaxiPassengerServingOrderPresenter;
|
||||
import com.mogo.och.taxi.passenger.utils.TPRouteDataTestUtils;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -45,7 +48,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
private final String TAG = TaxiPassengerServingOrderFragment.class.getSimpleName();
|
||||
|
||||
private GradientTextView mTPSpeedTv;
|
||||
private OCHGradientTextView mTPSpeedTv;
|
||||
private TextView mTPSpeedTvShadowBg;
|
||||
|
||||
private TextView mTPOrderStatus;
|
||||
@@ -64,7 +67,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
private AppCompatSeekBar mProgressSeekBar;
|
||||
private TextView mProgessDes;
|
||||
|
||||
private TaxiPassengerRadiuImageView mSpeedLayoutBg;
|
||||
private OCHRadiusImageView mSpeedLayoutBg;
|
||||
|
||||
private int mLimitingVelocity = 0;// 返回的道路限速值
|
||||
|
||||
@@ -298,7 +301,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
remainDis = String.valueOf(Math.round(meters));
|
||||
}else {
|
||||
disUnit = "公里";
|
||||
remainDis = TaxiPassengerUtils.formatLong((double) meters / 1000);
|
||||
remainDis = NumberFormatUtil.formatLong((double) meters / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +309,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
Calendar beforeTime = Calendar.getInstance();
|
||||
beforeTime.add(Calendar.MINUTE,time);
|
||||
String arriveTime = TaxiPassengerUtils.formatCalendarToString(beforeTime,TaxiPassengerUtils.TAXI_HH_mm);
|
||||
String arriveTime = DateTimeUtil.formatCalendarToString(beforeTime,DateTimeUtil.TAXI_HH_mm);
|
||||
updateOrderDisAndTimeView(remainDis, disUnit,time, arriveTime);
|
||||
updateDriveProcessLoading(new Long(meters).intValue());
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.mogo.och.taxi.passenger.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
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.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.passenger.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -22,8 +21,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
private ImageView mLightIconBG;
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context) {
|
||||
this(context, null, 0);
|
||||
@@ -42,6 +42,7 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true);
|
||||
mLightIconIV = findViewById(R.id.taxi_p_traffic_light_iv);
|
||||
mLightTimeTV = findViewById(R.id.taxi_p_traffic_light_time_tv);
|
||||
mLightIconBG = findViewById(R.id.taxi_p_traffic_light_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,6 +77,7 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int redNum, int yellowNum, int greenNum) {
|
||||
super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum);
|
||||
resetView();
|
||||
switch (mCurrentLightId) {
|
||||
case 1:
|
||||
changeCountdownRed(redNum);
|
||||
@@ -99,11 +101,13 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownRed(redNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (redNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_red_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_red_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(redNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -114,11 +118,13 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownGreen(greenNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (greenNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_green_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_green_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(greenNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -129,11 +135,13 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
super.changeCountdownYellow(yellowNum);
|
||||
UiThreadHandler.post(() -> {
|
||||
if (yellowNum > 0) {
|
||||
resetView();
|
||||
mLightTimeTV.setVertrial(true);
|
||||
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up),
|
||||
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down)});
|
||||
mLightTimeTV.setText(String.valueOf(yellowNum));
|
||||
} else {
|
||||
disableCountdown();
|
||||
mLightTimeTV.setText("");
|
||||
}
|
||||
});
|
||||
@@ -165,4 +173,29 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void disableCountdown() {
|
||||
super.disableCountdown();
|
||||
UiThreadHandler.post(() ->{
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams){
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_icon_size);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(GONE);
|
||||
mLightIconBG.getLayoutParams().width = (int)getResources().getDimension(R.dimen.dp_124);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetView(){
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams instanceof MarginLayoutParams) {
|
||||
MarginLayoutParams lp = (MarginLayoutParams) layoutParams;
|
||||
lp.width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_layout_width);
|
||||
setLayoutParams(lp);
|
||||
mLightTimeTV.setVisibility(VISIBLE);
|
||||
mLightIconBG.getLayoutParams().width = (int) getResources().getDimension(R.dimen.taxi_p_traffic_light_bg_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.utils;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/26
|
||||
*/
|
||||
public class PinYinUtil {
|
||||
/**
|
||||
* 得到中文字符串首字母
|
||||
* @param str 需要转化的中文字符串
|
||||
* @return 大写首字母缩写的字符串
|
||||
*/
|
||||
public static String getPinYinHeadChar(String str) {
|
||||
str = str.replaceAll("[\\p{P}‘’“”|+=¥$<>^~~]", "");
|
||||
StringBuilder convert = new StringBuilder();
|
||||
for (int j = 0; j < str.length(); j++) {
|
||||
char word = str.charAt(j);
|
||||
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
|
||||
if (pinyinArray != null) {
|
||||
convert.append(pinyinArray[0].charAt(0));
|
||||
} else {
|
||||
if (!"".equals(String.valueOf(word).trim())){
|
||||
convert.append(word);
|
||||
}
|
||||
}
|
||||
}
|
||||
return convert.toString().trim().toUpperCase();
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.och.taxi.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 TPCoordinateCalculateRouteUtil {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.mogo.och.taxi.passenger.utils;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/8/20
|
||||
*/
|
||||
public class TaxiPassengerUtils {
|
||||
|
||||
public static final String TAXI_HH_mm = "HH:mm";
|
||||
public static final String TAXI_MM_dd = "MM-dd";
|
||||
public static final String TAXI_MM_dd_HH_mm = "MM-dd HH:mm";
|
||||
public static final String TAXI_yyyy_MM_dd = "yyyy-MM-dd";
|
||||
public static final String TAXI_yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
|
||||
|
||||
public static String formatCalendarToString(Calendar calendar, String format){
|
||||
if (calendar == null) return "";
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(calendar.getTime());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static boolean compareDateIsCurrentDay(Calendar targetCalendar){
|
||||
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
|
||||
String currentDay = formatCalendarToString(currentCale, TaxiPassengerUtils.TAXI_yyyy_MM_dd);
|
||||
if (currentDay.equals(formatCalendarToString(targetCalendar, TaxiPassengerUtils.TAXI_yyyy_MM_dd))){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Calendar formatLongToCalendar(long time){
|
||||
Calendar calendar = null;
|
||||
try {
|
||||
calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return calendar;
|
||||
}
|
||||
public static String formatLongToString(long time, String format){
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static String getYMDTime(long time){//格式为 2021.8.21
|
||||
try {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
return calendar.get(Calendar.YEAR)+"."+month+"."+ calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param seconds 60
|
||||
* @return 1 时
|
||||
*/
|
||||
public static String secondsToHourStr(long seconds){//秒数转成相应的 小时分钟数
|
||||
if (seconds >= 3600){
|
||||
int hours = (int)seconds/3600;
|
||||
return String.valueOf(hours);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param seconds 60
|
||||
* @return 1 时
|
||||
*/
|
||||
public static String secondsToMinuteStr(long seconds){//秒数转成相应的 小时分钟数
|
||||
int minute = (int)(seconds % 3600)/60;
|
||||
return String.valueOf(minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有小数两位, 没有小数保留整数
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public static String formatLong(double d) {
|
||||
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
|
||||
double num = bg.doubleValue();
|
||||
if (Math.round(num) - num == 0) {
|
||||
return String.valueOf((long) num);
|
||||
}
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000" android:fromAlpha="0" android:toAlpha="1" />
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000" android:fromAlpha="1" android:toAlpha="0" />
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" android:startOffset="500" >
|
||||
<translate
|
||||
android:duration="142"
|
||||
android:fromXDelta="-110%"
|
||||
android:toXDelta="0"/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="142" />
|
||||
</set>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" android:startOffset="500" >
|
||||
<translate
|
||||
android:duration="142"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-110%"/>
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="142" />
|
||||
</set>
|
||||
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 372 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 915 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 17 KiB |