[Taxi passenger V1.1.0] Taxi passenger UI调整

This commit is contained in:
wangmingjun
2022-03-23 20:46:56 +08:00
parent dd076a1017
commit b280481882
13 changed files with 80 additions and 81 deletions

View File

@@ -49,7 +49,7 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
private IOCHTaxiPassengerNaviChangedCallback mNaviChangedCallback;
private AtomicInteger errorCount = new AtomicInteger(0);
// private AtomicInteger errorCount = new AtomicInteger(0); //只要订单在 如果算错就重新算,不再有次数限制
private boolean isPlay;
private volatile int mFirstcalculateDriveRoute = 0;
@@ -147,19 +147,19 @@ public class TaxiPassengerNaviToDestinationModel implements AMapNaviListener {
@Override
public void onCalculateRouteSuccess(AMapCalcRouteResult aMapCalcRouteResult) {
errorCount.set(0);
// errorCount.set(0);
}
@Override
public void onCalculateRouteFailure(AMapCalcRouteResult result) {
//路线计算失败
//多路径算路成功回调
if (errorCount.get() < 20){
errorCount.getAndIncrement();
// if (errorCount.get() < 20){
// errorCount.getAndIncrement();
if (mNaviChangedCallback != null){
mNaviChangedCallback.reInitNaviAmap(isPlay,true);
}
}
// }
if (!NetworkUtils.isConnected(mContext) || result.getErrorCode() == 2){
if (mNaviChangedCallback != null){
mNaviChangedCallback.reInitNaviAmap(isPlay,false);

View File

@@ -17,7 +17,6 @@ public class GradientTextView extends AppCompatTextView {
private LinearGradient mLinearGradient;
private Paint mPaint;
// private Paint strokPaint;
private int mViewWidth = 0;//文字的宽度
private int mViewHeight = 0;//文字的高度
private Rect mTextBound = new Rect();
@@ -49,26 +48,15 @@ public class GradientTextView extends AppCompatTextView {
} else {
mViewWidth = getMeasuredWidth();
}
// strokPaint = getPaint();
mPaint = getPaint();
String mTipText = getText().toString();
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
//前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mcolorList表示渐变的颜色数组
mLinearGradient = new LinearGradient(0, 0, mViewWidth, mViewHeight, mColorList, null, Shader.TileMode.CLAMP);
mPaint.setShader(mLinearGradient);
// if (mViewWidth == 0) {
// measure(0, 0);
// mViewWidth = (int) (getMeasuredWidth() + strokPaint.getStrokeWidth() * 2);
// setWidth(mViewWidth);
// }
// float y = getBaseline();
// float x = (mViewWidth - strokPaint.measureText(mTipText)) / 2;
//
setStyle();
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
// //画出投影
// canvas.drawText(mTipText, x, y, strokPaint);
//画出文字
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
}
@@ -89,38 +77,24 @@ public class GradientTextView extends AppCompatTextView {
*/
public void setmColorList(int[] mColorList) {
if (mColorList != null && mColorList.length < 2) {
throw new RuntimeException("mClorList's length must be > 2");
throw new RuntimeException("ClorList's length must be > 2");
} else {
this.mColorList = mColorList;
}
}
/**
* @param strokeColor
* @param strokewidth
* @param shader
*/
// public void setStyle(int strokeColor, float strokewidth, Shader shader) {
// strokPaint.setAntiAlias(true);
// // 设定是否使用图像抖动处理,会使绘制出来的图片颜色更加平滑和饱满,图像更加清晰
// strokPaint.setDither(true);
// // 如果该项设置为true则图像在动画进行中会滤掉对Bitmap图像的优化操作加快显示
// // 速度本设置项依赖于dither和xfermode的设置
// strokPaint.setFilterBitmap(true);
//
// strokPaint.setStrokeWidth(strokewidth);
// strokPaint.setColor(strokeColor);
// // 设置绘制时各图形的结合方式,如平滑效果等
// strokPaint.setStrokeJoin(Paint.Join.ROUND);
// // 当画笔样式为STROKE或FILL_OR_STROKE时设置笔刷的图形样式如圆形样式
// // Cap.ROUND,或方形样式Cap.SQUARE
// strokPaint.setStrokeCap(Paint.Cap.ROUND);
// strokPaint.setStyle(Paint.Style.STROKE);
//
// float textsize = getTextSize();
// strokPaint.setTextSize(textsize);
// }
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);
}
/**
* 设置投影层

View File

@@ -197,11 +197,10 @@ public class TaxiPassengerMapDirectionView
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBounds(boundsBuilder.build(), 100));
// cameraPosition = new CameraPosition.Builder().bearing(location.getBearing()).build();
// mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
} else {
//设置希望展示的地图缩放级别
CameraPosition cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
mAMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
@@ -229,7 +228,7 @@ public class TaxiPassengerMapDirectionView
polylineOptions.addAll(mCoordinatesLatLng);
polylineOptions.colorValues(colorList); // 1FC3FF -> 57ABFF
polylineOptions.useGradient(true);
polylineOptions.width(9);
polylineOptions.width(5);
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);

View File

@@ -8,7 +8,6 @@ import android.location.Location;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
@@ -56,6 +55,7 @@ public class TaxiPassengerServingOrderFragment extends
private final String TAG = TaxiPassengerServingOrderFragment.class.getSimpleName();
private GradientTextView mTPSpeedTv;
private TextView mTPSpeedTvShadowBg;
private TextView mTPOrderStatus;
private TextView mTPOrderStartStation;
@@ -99,7 +99,11 @@ public class TaxiPassengerServingOrderFragment extends
protected void initViews() {
mTPSpeedTv = findViewById(R.id.taxi_p_speed_tv);
mTPSpeedTvShadowBg = findViewById(R.id.taxi_p_speed_tv_bg);
mTPSpeedTv.setVertrial(true);
mTPSpeedTv.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_speed_normal_color1),getResources().getColor(R.color.taxi_p_speed_normal_color2)});
mTPSpeedTv.setText(String.valueOf(0));
mTPSpeedTvShadowBg.setText(String.valueOf(0));
mTPOrderStatus = findViewById(R.id.taxi_p_order_status_tv);
mTPOrderStartStation = findViewById(R.id.taxi_p_order_status_start_station_tv);
@@ -317,7 +321,7 @@ public class TaxiPassengerServingOrderFragment extends
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mMapDirectionView = findViewById(R.id.taxi_p_order_map_view);
mMapDirectionView = mRootView.findViewById(R.id.taxi_p_order_map_view);
mMapDirectionView.onCreateView(savedInstanceState);
mMapDirectionView.setTaxiPassengerMapViewCallback(this);
}
@@ -475,14 +479,16 @@ public class TaxiPassengerServingOrderFragment extends
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
CallerLogger.INSTANCE.d(M_TAXI_P + TAG,"mLimitingVelocity = "+mLimitingVelocity);
if (mLimitingVelocity > 0 && speed >= mLimitingVelocity) {
mTPSpeedTv.setmColorList(new int[]{getResources().getColor(R.color.taxi_speed_warn_color1),getResources().getColor(R.color.taxi_speed_warn_color2)});
// mTPSpeedTv.setShadowLayerCustom(4,1,1,getResources().getColor(R.color.taxi_p_speed_shadow_color));
mTPSpeedTv.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_speed_warn_color1),getResources().getColor(R.color.taxi_p_speed_warn_color2)});
mTPSpeedTv.setText(String.valueOf(speed));
mTPSpeedTvShadowBg.setText(String.valueOf(speed));
mSpeedLayoutBg.setImageResource(R.drawable.taxi_p_speed_light_red_bg);
} else {
mTPSpeedTv.setmColorList(new int[]{getResources().getColor(R.color.taxi_speed_normal_color1),getResources().getColor(R.color.taxi_speed_normal_color2)});
// mTPSpeedTv.setShadowLayerCustom(4,1,1,getResources().getColor(R.color.taxi_p_speed_shadow_color));
mTPSpeedTv.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_speed_normal_color1),getResources().getColor(R.color.taxi_p_speed_normal_color2)});
mTPSpeedTv.setText(String.valueOf(speed));
mTPSpeedTvShadowBg.setText(String.valueOf(speed));
mSpeedLayoutBg.setImageResource(R.drawable.taxi_p_speed_light_green_bg);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -257,9 +257,9 @@
android:id="@+id/taxi_p_order_map_view"
android:layout_width="match_parent"
android:layout_height="@dimen/taxi_p_order_map_height"
android:background="@color/taxi_p_map_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@android:color/transparent"/>
app:layout_constraintLeft_toLeftOf="parent" />
<View
android:layout_width="match_parent"
@@ -278,6 +278,7 @@
android:minHeight="@dimen/dp_25"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:thumbOffset="5px"
android:progressDrawable="@drawable/taxi_p_seekbar_calculator_layer"
android:splitTrack="false"
android:thumb="@drawable/taxi_p_seekbar_point_icon"
@@ -317,22 +318,35 @@
android:layout_marginLeft="@dimen/dp_36"
android:elevation="15dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="parent"
android:gravity="bottom">
<com.mogo.och.taxi.passenger.ui.GradientTextView
android:id="@+id/taxi_p_speed_tv"
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:includeFontPadding = "false"
android:shadowRadius="10"
android:shadowDx="5"
android:shadowDy="5"
android:shadowColor="@color/taxi_p_speed_shadow_color"
android:letterSpacing="-0.05"
android:text="0"
android:textStyle="bold"
android:textSize="@dimen/taxi_p_speed_size"/>
android:layout_height="wrap_content">
<TextView
android:id="@+id/taxi_p_speed_tv_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_8"
android:includeFontPadding = "false"
android:letterSpacing="-0.05"
android:text="0"
android:textStyle="bold"
android:textColor="@color/taxi_p_speed_shadow_color"
android:textSize="@dimen/taxi_p_speed_size"/>
<com.mogo.och.taxi.passenger.ui.GradientTextView
android:id="@+id/taxi_p_speed_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:includeFontPadding = "false"
android:letterSpacing="-0.05"
android:text="0"
android:textStyle="bold"
android:textSize="@dimen/taxi_p_speed_size"/>
</FrameLayout>
<TextView
android:id="@+id/taxi_p_speed_tv1"
@@ -341,6 +355,7 @@
android:layout_marginLeft="@dimen/dp_12"
android:text="KM/h"
android:includeFontPadding="false"
android:layout_marginBottom="@dimen/dp_15"
android:textColor="@android:color/white"
android:textSize="26px" />
@@ -349,6 +364,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_15"
android:gravity="right"
android:text="@string/taxi_p_arrive_to_start"
android:textColor="@android:color/white"

View File

@@ -4,12 +4,14 @@
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:taxi_left_bottom_radius="@dimen/dp_40"
android:background="@color/taxi_p_map_bg">
<com.amap.api.maps.TextureMapView
android:id="@+id/taxi_p_order_amap_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/taxi_p_map_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</com.mogo.och.taxi.passenger.ui.TaxiPassengerCardView>

View File

@@ -24,15 +24,17 @@
<color name="taxi_p_traffic_light_yellow_color_up">#FFFFE198</color>
<color name="taxi_p_traffic_light_yellow_color_down">#FFFF9B00</color>
<color name="taxi_p_v2x_notification_bg_color">#80000000</color>
<color name="taxi_p_v2x_notification_bg_color">#1A000000</color>
<color name="taxi_p_arrive_end_bg_line_color">#F8B70A</color>
<color name="taxi_p_arrive_end_tip_color">#C6D9FA</color>
<color name="taxi_p_speed_shadow_color">#D1193D66</color>
<color name="taxi_speed_warn_color1">#FE2505</color>
<color name="taxi_speed_warn_color2">#FF6F62</color>
<color name="taxi_speed_normal_color1">#CEEEFF</color>
<color name="taxi_speed_normal_color2">#A1DAFF</color>
<color name="taxi_p_speed_shadow_color">#08000000</color>
<color name="taxi_p_speed_warn_color1">#FE2505</color>
<color name="taxi_p_speed_warn_color2">#FF6F62</color>
<color name="taxi_p_speed_normal_color1">#CEEEFF</color>
<color name="taxi_p_speed_normal_color2">#A1DAFF</color>
<color name="taxi_p_map_bg">#00000000</color>
</resources>

View File

@@ -25,7 +25,7 @@
android:paddingTop="6px"
android:textColor="#FFFFFF"
android:id="@+id/module_mogo_och_speed_tv"
android:text="65"
android:text="0"
android:textSize="74px"
/>