Merge remote-tracking branch 'origin/dev_robotaxi-d-app-module_270_220510_2.7.0' into dev_robotaxi-d-app-module_270_220510_2.7.0
This commit is contained in:
@@ -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;
|
||||
@@ -355,7 +355,7 @@ public class BusPassengerModel {
|
||||
};
|
||||
|
||||
public void dynamicCalculateRouteInfo() {
|
||||
List<LatLng> lastPoints = BPCoordinateCalculateRouteUtil
|
||||
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
|
||||
|
||||
float lastSumLength = 0;
|
||||
@@ -364,7 +364,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 +377,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);
|
||||
}
|
||||
|
||||
@@ -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,11 +6,10 @@
|
||||
|
||||
<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_width="@dimen/dp_432"
|
||||
android:layout_height="@dimen/dp_432"
|
||||
android:layout_marginLeft="@dimen/dp_90"
|
||||
android:layout_marginTop="@dimen/dp_112"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<ImageView
|
||||
@@ -20,6 +19,7 @@
|
||||
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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -11,6 +11,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;
|
||||
@@ -45,8 +46,8 @@ 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.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
@@ -217,13 +218,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 +266,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
1
OCH/mogo-och-common-module/.gitignore
vendored
Normal file
1
OCH/mogo-och-common-module/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
54
OCH/mogo-och-common-module/build.gradle
Normal file
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
0
OCH/mogo-och-common-module/consumer-rules.pro
Normal file
21
OCH/mogo-och-common-module/proguard-rules.pro
vendored
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
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.bus.passenger.ui
|
||||
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";
|
||||
@@ -44,9 +44,6 @@ public class BorderShadowLayout extends LinearLayout {
|
||||
//阴影颜色
|
||||
private int shadowColor = Color.parseColor("#333333");
|
||||
|
||||
//阴影类型,0:默认为单边 1:单边 2:邻边 3:四边所有
|
||||
private int shadowType;
|
||||
|
||||
//阴影半径
|
||||
private float shadowRadius = 0f;
|
||||
|
||||
@@ -70,22 +67,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);
|
||||
@@ -247,9 +244,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) {
|
||||
37
OCH/mogo-och-common-module/src/main/res/values/attrs.xml
Normal file
37
OCH/mogo-och-common-module/src/main/res/values/attrs.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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"/>
|
||||
|
||||
</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>
|
||||
</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
|
||||
|
||||
Binary file not shown.
@@ -29,6 +29,7 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
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.TaxiPassengerOrderQueryRemainingResp;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrdersInServiceQueryRespBean;
|
||||
@@ -44,7 +45,6 @@ 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;
|
||||
@@ -563,7 +563,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());
|
||||
}
|
||||
}
|
||||
@@ -669,7 +669,7 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ 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,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public TaxiPassengerTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerRadiuImageView
|
||||
<com.mogo.och.common.module.wigets.OCHRadiusImageView
|
||||
android:id="@+id/taxi_p_speed_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -33,8 +33,8 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:taxi_passenger_left_top_radius="@dimen/dp_48"
|
||||
app:taxi_passenger_right_top_radius="@dimen/dp_48" />
|
||||
app:och_image_left_top_radius="@dimen/dp_48"
|
||||
app:och_image_right_top_radius="@dimen/dp_48" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/taxi_p_order_stations"
|
||||
@@ -341,7 +341,7 @@
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/taxi_p_speed_shadow_color"
|
||||
android:textSize="@dimen/taxi_p_speed_size"/>
|
||||
<com.mogo.och.taxi.passenger.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_p_speed_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mogo.och.common.module.wigets.OCHCornerCustomCardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:taxi_right_bottom_radius="@dimen/dp_40"
|
||||
app:taxi_left_bottom_radius="@dimen/dp_40"
|
||||
app:och_card_right_bottom_radius="@dimen/dp_40"
|
||||
app:och_card_left_bottom_radius="@dimen/dp_40"
|
||||
android:background="@color/taxi_p_map_bg">
|
||||
|
||||
<com.amap.api.maps.TextureMapView
|
||||
@@ -14,4 +14,4 @@
|
||||
android:background="@color/taxi_p_map_bg"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
</com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView>
|
||||
</com.mogo.och.common.module.wigets.OCHCornerCustomCardView>
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_p_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/taxi_p_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="TaxiPassengerRoundCorner">
|
||||
<attr name="taxi_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="RoundCornerImageView">
|
||||
<attr name="taxi_passenger_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_passenger_left_bottom_radius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -53,6 +53,9 @@ 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
|
||||
|
||||
Binary file not shown.
@@ -1,65 +0,0 @@
|
||||
package com.mogo.och.taxi.callback
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -31,6 +31,8 @@ import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.taxi.bean.DriverServiceDataRespBean;
|
||||
import com.mogo.och.taxi.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabRespBean;
|
||||
@@ -52,10 +54,8 @@ import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderTypeEnum;
|
||||
import com.mogo.och.taxi.network.TaxiServiceCallback;
|
||||
import com.mogo.och.taxi.network.TaxiServiceManager;
|
||||
import com.mogo.och.taxi.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsUtil;
|
||||
import com.mogo.och.taxi.utils.OrderUtil;
|
||||
import com.mogo.och.taxi.utils.PinYinUtil;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -1072,8 +1072,7 @@ public class TaxiModel {
|
||||
*/
|
||||
public void updateOrderRoute(List<MessagePad.Location> models) {
|
||||
if (null == mCurrentOCHOrder) return;
|
||||
List<OrderRouteUpdateReqBean.Result> points =
|
||||
CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjList(mContext,models);
|
||||
List<OrderRouteUpdateReqBean.Result> points = coordinateConverterWgsToGcjList(mContext,models);
|
||||
TaxiServiceManager.getInstance().updateOrderRoute(mContext, mCurrentOCHOrder.orderNo
|
||||
, points, new TaxiServiceCallback<BaseData>() {
|
||||
@Override
|
||||
@@ -1088,6 +1087,18 @@ public class TaxiModel {
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算全路径长度,以及实时更新剩余距离,剩余时间,预计时间
|
||||
* @param models
|
||||
|
||||
@@ -28,6 +28,8 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil;
|
||||
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
@@ -36,7 +38,6 @@ import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.model.NaviToDestinationModel;
|
||||
import com.mogo.och.taxi.utils.TaxiDateTimeUtil;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -204,8 +205,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
mOrderServerStatus.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
mOrderServerStatus.setClickable(true);
|
||||
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
|
||||
String currentHM = TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_HH_mm);
|
||||
String currentDay = TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
String currentHM = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm);
|
||||
String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
String strHtml11 = "<font color=\"#CAD6FF\">已于</font><br>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big><big>" + currentHM + "</big></big></font></b>"
|
||||
+ "<font color=\"#CAD6FF\">" + " " + "到达乘客上车地点</font>";
|
||||
@@ -217,13 +218,13 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
mStationTv32.setText(order.endSiteAddr);
|
||||
currentCale.add(Calendar.MINUTE, 10);
|
||||
String strHtml13 = "";
|
||||
if (currentDay.equals(TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_yyyy_MM_dd))) {
|
||||
if (currentDay.equals(DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd))) {
|
||||
strHtml13 = "<font color=\"#CAD6FF\">免费等待至 </font>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big>" + TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_HH_mm) + "</big></b></font>";
|
||||
+ "<b><font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm) + "</big></b></font>";
|
||||
|
||||
} else {
|
||||
strHtml13 = "<font color=\"#CAD6FF\">免费等待至</font>"
|
||||
+ "<font color=\"#FFFFFF\"><big>" + TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_MM_dd_HH_mm) + "</big></font>";
|
||||
+ "<font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_MM_dd_HH_mm) + "</big></font>";
|
||||
}
|
||||
mDistanceAndTime3.setText(Html.fromHtml(strHtml13));
|
||||
} else if (TaxiModel.getInstance().checkCurrentOCHOrder()) {
|
||||
@@ -248,17 +249,17 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
// + "<font color=\"#CAD6FF\">接乘客</font>";
|
||||
mStationTv31.setText(order.startSiteAddr);
|
||||
Calendar currentCale = DateTimeUtils.getCurrentDateTime();
|
||||
Calendar startCale = TaxiDateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
String currentDay = TaxiDateTimeUtil.formatCalendarToString(currentCale, TaxiDateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
String startDay = TaxiDateTimeUtil.formatCalendarToString(startCale, TaxiDateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
Calendar startCale = DateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
String startDay = DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
String strHtml1 = "";
|
||||
if (currentDay.equals(startDay)) {
|
||||
strHtml1 = "<font color=\"#CAD6FF\">乘客将于</font><br>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big><big>" + TaxiDateTimeUtil.formatCalendarToString(startCale, TaxiDateTimeUtil.TAXI_HH_mm) + "</big></big></font></b>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big><big>" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_HH_mm) + "</big></big></font></b>"
|
||||
+ "<font color=\"#CAD6FF\"> 用车</font>";
|
||||
} else {
|
||||
strHtml1 = "<font color=\"#CAD6FF\">乘客将于</font><br>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big><big>" + TaxiDateTimeUtil.formatCalendarToString(startCale, TaxiDateTimeUtil.TAXI_MM_dd_HH_mm) + "</big></big></font></b>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big><big>" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_MM_dd_HH_mm) + "</big></big></font></b>"
|
||||
+ "<font color=\"#CAD6FF\"> 用车</font>";
|
||||
}
|
||||
mOrderOtherContent3.setText(Html.fromHtml(strHtml1));
|
||||
@@ -300,7 +301,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
dis = String.valueOf(Math.round(meters));
|
||||
}else {
|
||||
disUnit = "公里";
|
||||
dis = TaxiDateTimeUtil.formatLong((double)meters / 1000);
|
||||
dis = NumberFormatUtil.formatLong((double)meters / 1000);
|
||||
}
|
||||
}
|
||||
String strHtml2 = "<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> "+disUnit+"</font>"
|
||||
@@ -333,7 +334,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
|
||||
|
||||
if (routeInfo.distanceToEnd > 0){
|
||||
|
||||
dis = TaxiDateTimeUtil.formatLong( (double) distance/ 1000);
|
||||
dis = NumberFormatUtil.formatLong( (double) distance/ 1000);
|
||||
}
|
||||
|
||||
String strHtml2 = "<font color=\"#CAD6FF\">距离 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> 公里</font>"
|
||||
|
||||
@@ -15,13 +15,13 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.presenter.TaxiPresenter;
|
||||
import com.mogo.och.taxi.utils.PinYinUtil;
|
||||
import com.mogo.och.taxi.utils.TPRouteDataTestUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@@ -11,9 +11,9 @@ import android.widget.TextView;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.utils.TaxiDateTimeUtil;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
@@ -90,14 +90,14 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On
|
||||
}
|
||||
public void updateGrabOrder(OrderQueryRespBean.Result order){
|
||||
mGrabResultAnimView.setVisibility(View.GONE);
|
||||
Calendar calendar = TaxiDateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
if (TaxiDateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
mOrderReserverTime.setText("用车时间:今天 "+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,今天"+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_HH_mm)+"从"
|
||||
Calendar calendar = DateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
if (DateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
mOrderReserverTime.setText("用车时间:今天 "+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)+"从"
|
||||
+order.startSiteAddr+"到"+order.endSiteAddr);
|
||||
}else {
|
||||
mOrderReserverTime.setText("用车时间:"+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_MM_dd_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,"+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_MM_dd)+"从"
|
||||
mOrderReserverTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd_HH_mm));
|
||||
getOchTaxiFragment().showNotice("预约单,"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd)+"从"
|
||||
+order.startSiteAddr+"到"+order.endSiteAddr);
|
||||
}
|
||||
mOrderStartStation.setText(order.startSiteAddr);
|
||||
|
||||
@@ -13,8 +13,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.utils.TaxiDateTimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -98,8 +98,8 @@ public class TaxiOperationDatasFragment extends BaseTaxiUIFragment {
|
||||
if (holder instanceof OperationDataViewHolder) {
|
||||
OperationDataViewHolder viewHolder = (OperationDataViewHolder) holder;
|
||||
if (0 == mType){
|
||||
String hourData = TextUtils.isEmpty(TaxiDateTimeUtil.secondsToHourStr(datas.get(position))) ? "0": TaxiDateTimeUtil.secondsToHourStr(datas.get(position));
|
||||
String minuteData = TaxiDateTimeUtil.secondsToMinuteStr(datas.get(position));
|
||||
String hourData = TextUtils.isEmpty(DateTimeUtil.secondsToHourStr(datas.get(position))) ? "0": DateTimeUtil.secondsToHourStr(datas.get(position));
|
||||
String minuteData = DateTimeUtil.secondsToMinuteStr(datas.get(position));
|
||||
String data = "<font><b><big><big><big>" + hourData + "</big></big></big></b> 时 </font>" + "<font><b><big><big><big>" + minuteData + "</big></big></big></b> 分</font>";
|
||||
viewHolder.operationDataTv.setText(Html.fromHtml(data));
|
||||
viewHolder.operationDataTitle.setText("今日在线时长");
|
||||
|
||||
@@ -31,11 +31,11 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderTypeEnum;
|
||||
import com.mogo.och.taxi.utils.TaxiDateTimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -302,7 +302,7 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
if (null == queryRespBean) return;
|
||||
if (holder instanceof DayGroupViewHolder){
|
||||
DayGroupViewHolder groupViewHolder = (DayGroupViewHolder)holder;
|
||||
groupViewHolder.dayGroupTv.setText(TaxiDateTimeUtil.getYMDTime(queryRespBean.createTime));
|
||||
groupViewHolder.dayGroupTv.setText(DateTimeUtil.getYMDTime(queryRespBean.createTime));
|
||||
bindOrderDetailData(queryRespBean,groupViewHolder.orderTimeTv,groupViewHolder.startStationTv,groupViewHolder.endStationTv,
|
||||
groupViewHolder.orderStatusBt,groupViewHolder.orderTypeBt,groupViewHolder.orderNumTv);
|
||||
if (isNoLineItem(position)){
|
||||
@@ -343,9 +343,9 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
if (position == 0){
|
||||
return DAY_GROUP_ITEM;
|
||||
}
|
||||
String currentDate = TaxiDateTimeUtil.getYMDTime(orders.get(position).createTime);//获取当前订单时间
|
||||
String currentDate = DateTimeUtil.getYMDTime(orders.get(position).createTime);//获取当前订单时间
|
||||
int prevIndex = position - 1;
|
||||
String preDate = TaxiDateTimeUtil.getYMDTime(orders.get(prevIndex).createTime);
|
||||
String preDate = DateTimeUtil.getYMDTime(orders.get(prevIndex).createTime);
|
||||
boolean isDifferent = !preDate.equals(currentDate);//前一个订单的日期跟第二个订单的日期是否一致
|
||||
return isDifferent ? DAY_GROUP_ITEM : ORDER_DETAIL_ITEM;//一样订单详情, 不一样新添加分组
|
||||
}
|
||||
@@ -354,9 +354,9 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
if (position == orders.size() -1){
|
||||
return false;
|
||||
}else {
|
||||
String currentDate = TaxiDateTimeUtil.getYMDTime(orders.get(position).createTime);//获取当前订单时间
|
||||
String currentDate = DateTimeUtil.getYMDTime(orders.get(position).createTime);//获取当前订单时间
|
||||
int nextIndex = position + 1;
|
||||
String preDate = TaxiDateTimeUtil.getYMDTime(orders.get(nextIndex).createTime);
|
||||
String preDate = DateTimeUtil.getYMDTime(orders.get(nextIndex).createTime);
|
||||
boolean isDifferent = preDate.equals(currentDate);//订单跟后一个订单是否是同一天
|
||||
return isDifferent;//一样有划分线, 不一样没有划分线
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class TaxiPersonalDialogFragment extends DialogFragment implements View.O
|
||||
Button orderStatusBt, Button orderTypeBt, TextView orderNumTv){
|
||||
Calendar calendar= Calendar.getInstance();
|
||||
calendar.setTimeInMillis(queryRespBean.createTime);
|
||||
orderTimeTv.setText(TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_HH_mm));
|
||||
orderTimeTv.setText(DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm));
|
||||
startStationTv.setText(queryRespBean.startSiteAddr);
|
||||
endStationTv.setText(queryRespBean.endSiteAddr);
|
||||
orderStatusBt.setText(getOrderStatus(queryRespBean.orderStatus,orderStatusBt));
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/9/29
|
||||
*/
|
||||
public class TaxiRadiusImageView extends AppCompatImageView {
|
||||
private float width, height;
|
||||
private int defaultRadius = 0;
|
||||
private int radius;
|
||||
private int leftTopRadius;
|
||||
private int rightTopRadius;
|
||||
private int rightBottomRadius;
|
||||
private int leftBottomRadius;
|
||||
|
||||
|
||||
public TaxiRadiusImageView(Context context) {
|
||||
this(context, null);
|
||||
init(context, null);
|
||||
}
|
||||
|
||||
public TaxiRadiusImageView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public TaxiRadiusImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
// 读取配置
|
||||
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.RoundCornerImageView);
|
||||
radius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_radius, defaultRadius);
|
||||
leftTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_left_top_radius, defaultRadius);
|
||||
rightTopRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_right_top_radius, defaultRadius);
|
||||
rightBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_right_bottom_radius, defaultRadius);
|
||||
leftBottomRadius = array.getDimensionPixelOffset(R.styleable.RoundCornerImageView_taxi_left_bottom_radius, defaultRadius);
|
||||
|
||||
|
||||
if (defaultRadius == leftTopRadius) {
|
||||
leftTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightTopRadius) {
|
||||
rightTopRadius = radius;
|
||||
}
|
||||
if (defaultRadius == rightBottomRadius) {
|
||||
rightBottomRadius = radius;
|
||||
}
|
||||
if (defaultRadius == leftBottomRadius) {
|
||||
leftBottomRadius = radius;
|
||||
}
|
||||
array.recycle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
width = getWidth();
|
||||
height = getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
//这里做下判断,只有图片的宽高大于设置的圆角距离的时候才进行裁剪
|
||||
int maxLeft = Math.max(leftTopRadius, leftBottomRadius);
|
||||
int maxRight = Math.max(rightTopRadius, rightBottomRadius);
|
||||
int minWidth = maxLeft + maxRight;
|
||||
int maxTop = Math.max(leftTopRadius, rightTopRadius);
|
||||
int maxBottom = Math.max(leftBottomRadius, rightBottomRadius);
|
||||
int minHeight = maxTop + maxBottom;
|
||||
if (width >= minWidth && height > minHeight) {
|
||||
Path path = new Path();
|
||||
//右上,右下,左下,左上
|
||||
path.moveTo(leftTopRadius, 0);
|
||||
path.lineTo(width - rightTopRadius, 0);
|
||||
path.quadTo(width, 0, width, rightTopRadius);
|
||||
|
||||
path.lineTo(width, height - rightBottomRadius);
|
||||
path.quadTo(width, height, width - rightBottomRadius, height);
|
||||
|
||||
path.lineTo(leftBottomRadius, height);
|
||||
path.quadTo(0, height, 0, height - leftBottomRadius);
|
||||
|
||||
path.lineTo(0, leftTopRadius);
|
||||
path.quadTo(0, 0, leftTopRadius, 0);
|
||||
|
||||
canvas.clipPath(path);
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,10 +15,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.utils.TaxiDateTimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
@@ -129,11 +128,11 @@ public class TaxiReserveOrdersFragment extends BaseTaxiUIFragment {
|
||||
if (datas != null && datas.size() >0 ){
|
||||
ToBeServedOrdersViewHolder viewHolder = (ToBeServedOrdersViewHolder)holder;
|
||||
OrderQueryRespBean.Result order = datas.get(position);
|
||||
Calendar calendar = TaxiDateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
if (TaxiDateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
viewHolder.orderTime.setText("用车时间:今天"+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_HH_mm));
|
||||
Calendar calendar = DateTimeUtil.formatLongToCalendar(order.bookingTime);
|
||||
if (DateTimeUtil.compareDateIsCurrentDay(calendar)){
|
||||
viewHolder.orderTime.setText("用车时间:今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm));
|
||||
}else {
|
||||
viewHolder.orderTime.setText("用车时间:"+ TaxiDateTimeUtil.formatCalendarToString(calendar, TaxiDateTimeUtil.TAXI_MM_dd_HH_mm));
|
||||
viewHolder.orderTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd_HH_mm));
|
||||
}
|
||||
viewHolder.orderCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,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.common.module.wigets.OCHGradientTextView;
|
||||
import com.mogo.och.taxi.R;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -19,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class TaxiTrafficLightView extends IViewTrafficLight {
|
||||
|
||||
private ImageView mLightIconIV;
|
||||
private GradientTextView mLightTimeTV;
|
||||
private OCHGradientTextView mLightTimeTV;
|
||||
private int mCurrentLightId;
|
||||
|
||||
public TaxiTrafficLightView(@Nullable Context context) {
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
package com.mogo.och.taxi.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 TaxiDateTimeUtil {
|
||||
|
||||
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, TaxiDateTimeUtil.TAXI_yyyy_MM_dd);
|
||||
if (currentDay.equals(formatCalendarToString(targetCalendar, TaxiDateTimeUtil.TAXI_yyyy_MM_dd))){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Calendar formatLongToCalendar(long time){
|
||||
Calendar calendar = null;
|
||||
try {
|
||||
calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return calendar;
|
||||
}
|
||||
public static String formatLongToString(long time, String format){
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
|
||||
return dateFormat.format(time);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
public static String getYMDTime(long time){//格式为 2021.8.21
|
||||
try {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
return calendar.get(Calendar.YEAR)+"."+month+"."+ calendar.get(Calendar.DAY_OF_MONTH);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param seconds 60
|
||||
* @return 1 时
|
||||
*/
|
||||
public static String secondsToHourStr(long seconds){//秒数转成相应的 小时分钟数
|
||||
if (seconds >= 3600){
|
||||
int hours = (int)seconds/3600;
|
||||
return String.valueOf(hours);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param seconds 60
|
||||
* @return 1 时
|
||||
*/
|
||||
public static String secondsToMinuteStr(long seconds){//秒数转成相应的 小时分钟数
|
||||
int minute = (int)(seconds % 3600)/60;
|
||||
return String.valueOf(minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有小数两位, 没有小数保留整数
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
public static String formatLong(double d) {
|
||||
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
|
||||
double num = bg.doubleValue();
|
||||
if (Math.ceil(num) - num == 0) {
|
||||
return String.valueOf((long) num);
|
||||
}
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
@@ -155,13 +155,13 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.ui.TaxiRadiusImageView
|
||||
<com.mogo.och.common.module.wigets.OCHRadiusImageView
|
||||
android:id="@+id/grab_result_anim"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/grab_failure_anmi_flow"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:taxi_right_bottom_radius="60px"/>
|
||||
app:och_image_right_bottom_radius="60px"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.taxi.ui.BorderShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -64,4 +64,4 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</com.mogo.och.taxi.ui.BorderShadowLayout>
|
||||
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
|
||||
@@ -22,7 +22,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.och.taxi.ui.GradientTextView
|
||||
<com.mogo.och.common.module.wigets.OCHGradientTextView
|
||||
android:id="@+id/taxi_traffic_light_time_tv"
|
||||
android:layout_width="@dimen/taxi_traffic_light_time_view_width"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="RoundCornerImageView">
|
||||
<attr name="taxi_radius" format="dimension" />
|
||||
<attr name="taxi_left_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_top_radius" format="dimension" />
|
||||
<attr name="taxi_right_bottom_radius" format="dimension" />
|
||||
<attr name="taxi_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"/>
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -43,34 +43,34 @@ public class TapPositionView extends ConstraintLayout {
|
||||
if (tabP != null && tabR != null && tabN != null && tabD != null) {
|
||||
switch (gear) {
|
||||
case GEAR_NONE:
|
||||
tabP.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabR.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabR.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
break;
|
||||
case GEAR_P:
|
||||
tabP.setTextColor(Color.parseColor("#0043FF"));
|
||||
tabR.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#FFFFFFFF"));
|
||||
tabR.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
break;
|
||||
case GEAR_R:
|
||||
tabR.setTextColor(Color.parseColor("#0043FF"));
|
||||
tabP.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabR.setTextColor(Color.parseColor("#FFFFFFFF"));
|
||||
tabP.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
break;
|
||||
case GEAR_N:
|
||||
tabN.setTextColor(Color.parseColor("#0043FF"));
|
||||
tabR.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabN.setTextColor(Color.parseColor("#FFFFFFFF"));
|
||||
tabR.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
break;
|
||||
case GEAR_D:
|
||||
tabD.setTextColor(Color.parseColor("#0043FF"));
|
||||
tabN.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabR.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#6E8EC9"));
|
||||
tabD.setTextColor(Color.parseColor("#FFFFFFFF"));
|
||||
tabN.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabR.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
tabP.setTextColor(Color.parseColor("#FF6E8EC9"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="270"
|
||||
android:endColor="#00044CFF"
|
||||
android:startColor="#FF45D3FF"
|
||||
android:type="radial"
|
||||
android:centerX="0.5"
|
||||
android:centerY="0"
|
||||
android:gradientRadius="@dimen/dp_46"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -2,11 +2,11 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/background">
|
||||
<shape
|
||||
android:innerRadius="@dimen/dp_85"
|
||||
android:innerRadius="@dimen/dp_120"
|
||||
android:shape="ring"
|
||||
android:thickness="4px"
|
||||
android:thickness="7.2px"
|
||||
android:useLevel="false">
|
||||
<solid android:color="#BBCFF6" />
|
||||
<solid android:color="#1EBBCFF6" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_36"/>
|
||||
<gradient android:angle="315" android:endColor="#E6E9EFFC" android:startColor="#E6E9EFFC" />
|
||||
<corners android:radius="@dimen/dp_46"/>
|
||||
<gradient android:angle="315" android:endColor="#FF31486E" android:startColor="#FF31486E" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -5,14 +5,26 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_steering_wheel">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/autopilot_iv"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_60"
|
||||
android:src="@drawable/bg_auto"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/blue_circle"
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_width="@dimen/dp_260"
|
||||
android:layout_height="@dimen/dp_260"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="@dimen/dp_60"
|
||||
android:layout_marginTop="@dimen/dp_38"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:layout_marginLeft="@dimen/dp_85"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginRight="@dimen/dp_85"
|
||||
android:indeterminateDrawable="@drawable/bg_steering_outer"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -26,8 +38,8 @@
|
||||
android:layout_marginRight="-10px"
|
||||
android:gravity="right"
|
||||
android:text="-18°"
|
||||
android:textColor="#415479"
|
||||
android:textSize="@dimen/dp_26"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_37"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintRight_toLeftOf="@+id/blue_circle"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -40,35 +52,25 @@
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:gravity="left"
|
||||
android:text="18°"
|
||||
android:textColor="#415479"
|
||||
android:textSize="@dimen/dp_26"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/dp_37"
|
||||
app:layout_constraintLeft_toRightOf="@+id/autopilot_iv"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.CircularProgressView
|
||||
android:id="@+id/steering_circular"
|
||||
android:layout_width="@dimen/dp_180"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_width="@dimen/dp_260"
|
||||
android:layout_height="@dimen/dp_260"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_36"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:outlineAmbientShadowColor="#1EBBCFF6"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:progWidth="8px"
|
||||
app:progress="0" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/autopilot_iv"
|
||||
android:layout_width="@dimen/dp_186"
|
||||
android:layout_height="@dimen/dp_186"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:src="@drawable/bg_auto"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_40"
|
||||
@@ -84,7 +86,8 @@
|
||||
android:id="@+id/tap_position"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
||||
@@ -84,5 +84,5 @@ include ':OCH:mogo-och-bus-passenger'
|
||||
include ':OCH:mogo-och-taxi'
|
||||
include ':OCH:mogo-och-taxi-passenger'
|
||||
include ':OCH:mogo-och-noop'
|
||||
|
||||
include(':OCH:mogo-och-common-module')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user