[Taxi passenger V1.1.0] taxi passenger UI 走查

This commit is contained in:
wangmingjun
2022-03-22 20:19:46 +08:00
parent 4662ec2f19
commit 1aafa1b3ce
19 changed files with 125 additions and 198 deletions

View File

@@ -49,7 +49,7 @@ public class TaxiPassengerServiceManager {
*/
private String getDriverAppSn(){
return CallerTelematicManager.INSTANCE.getServerToken();
// return "X202021061514D29A1C2A926002";
// return "X2020211111NG0XNFK";
}
/**
@@ -92,26 +92,6 @@ public class TaxiPassengerServiceManager {
.subscribe(getSubscribeImpl(context, callback, "queryOrderById"));
}
// /**
// * 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
// * @param context
// * @param lon
// * @param lat
// * @param callback
// */
// public void runCarHeartbeat(Context context, double lon, double lat,
// TaxiPassengerServiceCallback<BaseData> callback) {
// if ( mOCHTaxiServiceApi == null ) {
// mOCHTaxiServiceApi = MogoApisHandler.getInstance().getApis().getNetworkApi()
// .create(TaxiPassengerServiceApi.class, baseUrl);
// }
// mOCHTaxiServiceApi.runCarHeartbeat(new TaxiPassengerCarHeartbeatReqBean(
// MoGoAiCloudClientConfig.getInstance().getSn(), lon, lat))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(getSubscribeImpl(context, callback, "runCarHeartbeat"));
// }
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
Context context, TaxiPassengerServiceCallback<T> callback, String apiName) {
return new SubscribeImpl<T>(RequestOptions.create(context)) {

View File

@@ -0,0 +1,51 @@
package com.mogo.och.taxi.passenger.ui;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSeekBar;
/**
* @author: wangmingjun
* @date: 2022/3/21
*/
public class CustomSeekBar extends AppCompatSeekBar {
private boolean touch = false; //是否支持拖动, 默认为不可以
public CustomSeekBar(@NonNull Context context) {
super(context);
}
public CustomSeekBar(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public CustomSeekBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected synchronized void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
public void setTouch(boolean touch) {
this.touch = touch;
}
/**
* onTouchEvent 处理
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
if (touch) {
return super.onTouchEvent(event);
}
return false;
}
}

View File

@@ -1,57 +0,0 @@
package com.mogo.och.taxi.passenger.ui;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Shader;
import android.text.style.ReplacementSpan;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* 文字渐变
* @author: wangmingjun
* @date: 2022/3/8
*/
public class LinearGradientFontSpan extends ReplacementSpan {
private int mStartColor;
private int mEndColor;
private int mSize;
private Shader.TileMode mDirection;
public LinearGradientFontSpan(int startColor, int endColor, Shader.TileMode direction){
this.mStartColor = startColor;
this.mEndColor = endColor;
this.mDirection = direction;
}
@Override
public int getSize(@NonNull Paint paint, CharSequence text, int start, int end
, @Nullable Paint.FontMetricsInt fm) {
mSize = (int) paint.measureText(text,start,end);
//字体高度设置 需要
Paint.FontMetricsInt metricsInt = paint.getFontMetricsInt();
if (fm != null){
fm.top = metricsInt.top;
fm.ascent = metricsInt.ascent;
fm.descent = metricsInt.descent;
fm.bottom = metricsInt.bottom;
}
return mSize;
}
@Override
public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x,
int top, int y, int bottom, @NonNull Paint paint) {
LinearGradient linearGradient = new LinearGradient(0,0,0,paint.descent() - paint.ascent(),mStartColor,mEndColor
, mDirection);//渐变方向
paint.setShader(linearGradient);
canvas.drawText(text,start,end,x,y,paint);
}
}

View File

@@ -2,6 +2,8 @@ package com.mogo.och.taxi.passenger.ui;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
import android.graphics.LinearGradient;
import android.graphics.Shader;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
@@ -53,7 +55,7 @@ public class TaxiPassengerServingOrderFragment extends
private final String TAG = TaxiPassengerServingOrderFragment.class.getSimpleName();
private TextView mTPSpeedTv;
private GradientTextView mTPSpeedTv;
private TextView mTPOrderStatus;
private TextView mTPOrderStartStation;
@@ -97,7 +99,7 @@ public class TaxiPassengerServingOrderFragment extends
protected void initViews() {
mTPSpeedTv = findViewById(R.id.taxi_p_speed_tv);
mTPSpeedTv.setText(getSpeedTextStyle("0", true));
mTPSpeedTv.setVertrial(true);
mTPOrderStatus = findViewById(R.id.taxi_p_order_status_tv);
mTPOrderStartStation = findViewById(R.id.taxi_p_order_status_start_station_tv);
@@ -473,32 +475,18 @@ 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.setText(getSpeedTextStyle(String.valueOf(speed), false));
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.setText(String.valueOf(speed));
mSpeedLayoutBg.setImageResource(R.drawable.taxi_p_speed_light_red_bg);
} else {
mTPSpeedTv.setText(getSpeedTextStyle(String.valueOf(speed), true));
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.setText(String.valueOf(speed));
mSpeedLayoutBg.setImageResource(R.drawable.taxi_p_speed_light_green_bg);
}
}
/**
* 设置速度的颜色
*
* @param content
* @param isNormal 正常状态 true, 超速状态
* @return
*/
private SpannableStringBuilder getSpeedTextStyle(String content, boolean isNormal) {
if (isNormal) {
return TaxiPassengerUtils.getGradientFontSpan(content
, 0xFFCEEEFF, 0xFFA1DAFF);
} else {//超速
return TaxiPassengerUtils.getGradientFontSpan(content
, 0xFFFE2505, 0xFFFF6F62);
}
}
private void runOnUIThread(Runnable executor) {
if (executor == null) {
return;
@@ -530,4 +518,13 @@ public class TaxiPassengerServingOrderFragment extends
mMapArrowIcon.startAnimation(rotateAnimation);
lastBearing = bearing;
}
public void setGradientText(int startColor, int endColor){
Shader shader = new LinearGradient(
0, 0, 0, mTPSpeedTv.getLineHeight(),
getResources().getColor(startColor),
getResources().getColor(endColor),
Shader.TileMode.REPEAT);
mTPSpeedTv.getPaint().setShader(shader);
}
}

View File

@@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
private ImageView mLightIconIV;
private TextView mLightTimeTV;
private GradientTextView mLightTimeTV;
private int mCurrentLightId;
public TaxiPassengerTrafficLightView(@Nullable Context context) {
@@ -99,12 +99,9 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
super.changeCountdownRed(redNum);
UiThreadHandler.post(() -> {
if (redNum > 0) {
Shader shader = new LinearGradient(
0, 0, 0, mLightTimeTV.getLineHeight(),
getResources().getColor(R.color.taxi_p_traffic_light_red_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_red_color_down),
Shader.TileMode.REPEAT);
mLightTimeTV.getPaint().setShader(shader);
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_red_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_red_color_down)});
mLightTimeTV.setText(String.valueOf(redNum));
} else {
mLightTimeTV.setText("");
@@ -117,12 +114,9 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
super.changeCountdownGreen(greenNum);
UiThreadHandler.post(() -> {
if (greenNum > 0) {
Shader shader = new LinearGradient(
0, 0, 0, mLightTimeTV.getLineHeight(),
getResources().getColor(R.color.taxi_p_traffic_light_green_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_green_color_down),
Shader.TileMode.REPEAT);
mLightTimeTV.getPaint().setShader(shader);
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_green_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_green_color_down)});
mLightTimeTV.setText(String.valueOf(greenNum));
} else {
mLightTimeTV.setText("");
@@ -135,12 +129,9 @@ public class TaxiPassengerTrafficLightView extends IViewTrafficLight {
super.changeCountdownYellow(yellowNum);
UiThreadHandler.post(() -> {
if (yellowNum > 0) {
Shader shader = new LinearGradient(
0, 0, 0, mLightTimeTV.getLineHeight(),
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down),
Shader.TileMode.REPEAT);
mLightTimeTV.getPaint().setShader(shader);
mLightTimeTV.setVertrial(true);
mLightTimeTV.setmColorList(new int[]{getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_up),
getResources().getColor(R.color.taxi_p_traffic_light_yellow_color_down)});
mLightTimeTV.setText(String.valueOf(yellowNum));
} else {
mLightTimeTV.setText("");

View File

@@ -1,12 +1,6 @@
package com.mogo.och.taxi.passenger.utils;
import android.graphics.Shader;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.och.taxi.passenger.ui.LinearGradientFontSpan;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -95,18 +89,4 @@ public class TaxiPassengerUtils {
int minute = (int)(seconds % 3600)/60;
return String.valueOf(minute);
}
/**
* 设置textview 文字渐变
* @param content
* @param startColor
* @param endColor
* @return
*/
public static SpannableStringBuilder getGradientFontSpan(String content, int startColor, int endColor){
SpannableStringBuilder builder = new SpannableStringBuilder(content);
LinearGradientFontSpan span = new LinearGradientFontSpan(startColor,endColor, Shader.TileMode.REPEAT);
builder.setSpan(span,0,builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return builder;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -9,11 +9,10 @@
android:layout_height="wrap_content"
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="@dimen/dp_40"
app:cardElevation="@dimen/dp_15"
app:cardPreventCornerOverlap="false"
app:cardElevation="@dimen/dp_20"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_12"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -109,13 +108,11 @@
android:id="@+id/taxi_p_order_remain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24px"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_48"
android:paddingRight="@dimen/dp_44"
android:weightSum="3"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/taxi_p_order_stations">
app:layout_constraintTop_toBottomOf="@+id/taxi_p_order_stations"
app:layout_constraintBottom_toTopOf="@+id/taxi_p_order_map_view">
<RelativeLayout
android:id="@+id/taxi_p_order_rl1"
@@ -261,7 +258,8 @@
android:layout_width="match_parent"
android:layout_height="@dimen/taxi_p_order_map_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
app:layout_constraintLeft_toLeftOf="parent"
android:background="@android:color/transparent"/>
<View
android:layout_width="match_parent"
@@ -269,15 +267,15 @@
android:background="@drawable/taxi_p_panel_bottom_bg"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.appcompat.widget.AppCompatSeekBar
<com.mogo.och.taxi.passenger.ui.CustomSeekBar
android:id="@+id/taxi_p_seekbar"
android:layout_width="@dimen/dp_250"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_25"
android:layout_marginBottom="20px"
android:fadingEdge="horizontal"
android:focusable="true"
android:maxHeight="@dimen/dp_14"
android:minHeight="@dimen/dp_14"
android:maxHeight="@dimen/dp_25"
android:minHeight="@dimen/dp_25"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:progressDrawable="@drawable/taxi_p_seekbar_calculator_layer"
@@ -291,10 +289,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:paddingRight="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:textColor="@android:color/white"
android:textSize="@dimen/taxi_p_progress_des_size"
android:textStyle="italic"
android:layout_marginBottom="@dimen/dp_5"
android:typeface="monospace"
app:layout_constraintBottom_toTopOf="@+id/taxi_p_seekbar"
app:layout_constraintLeft_toLeftOf="parent" />
@@ -303,7 +302,7 @@
android:id="@+id/taxi_p_arrow_nor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_44"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:src="@drawable/taxi_p_arrow_nor"
app:layout_constraintBottom_toBottomOf="parent"
@@ -315,24 +314,25 @@
android:layout_width="@dimen/taxi_p_order_panel_width"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="@dimen/dp_20"
android:elevation="10dp"
android:layout_marginLeft="@dimen/dp_36"
android:elevation="15dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
<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_30"
android:shadowColor="@color/taxi_p_speed_color"
android:shadowDx="0"
android:shadowDy="1"
android:shadowRadius="1"
android:includeFontPadding="false"
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:textSize="@dimen/taxi_p_speed_size"
android:textStyle="bold"/>
android:textStyle="bold"
android:textSize="@dimen/taxi_p_speed_size"/>
<TextView
android:id="@+id/taxi_p_speed_tv1"
@@ -348,7 +348,7 @@
android:id="@+id/taxi_p_order_status_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_32"
android:layout_marginRight="@dimen/dp_40"
android:gravity="right"
android:text="@string/taxi_p_arrive_to_start"
android:textColor="@android:color/white"

View File

@@ -100,7 +100,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_150"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_10"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

View File

@@ -22,12 +22,13 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
<com.mogo.och.taxi.passenger.ui.GradientTextView
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"
android:textSize="@dimen/taxi_p_traffic_light_time_size"
android:textStyle="bold"
android:text="300"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center" />

View File

@@ -17,17 +17,22 @@
<color name="taxi_p_route_line_start">#1FC3FF</color>
<color name="taxi_p_route_line_end">#57ABFF</color>
<color name="taxi_p_traffic_light_red_color_up">#FFA28B</color>
<color name="taxi_p_traffic_light_red_color_down">#DA1100</color>
<color name="taxi_p_traffic_light_green_color_up">#60FFD3</color>
<color name="taxi_p_traffic_light_green_color_down">#006D43</color>
<color name="taxi_p_traffic_light_yellow_color_up">#FFE198</color>
<color name="taxi_p_traffic_light_yellow_color_down">#FF9B00</color>
<color name="taxi_p_traffic_light_red_color_up">#FFFFA28B</color>
<color name="taxi_p_traffic_light_red_color_down">#FFDA1100</color>
<color name="taxi_p_traffic_light_green_color_up">#FF60FFD3</color>
<color name="taxi_p_traffic_light_green_color_down">#FF006D43</color>
<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_arrive_end_bg_line_color">#F8B70A</color>
<color name="taxi_p_arrive_end_tip_color">#C6D9FA</color>
<color name="taxi_p_speed_color">#D1193D66</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>
</resources>

View File

@@ -98,7 +98,7 @@
<dimen name="taxi_p_traffic_light_bg_margin_left">15px</dimen>
<dimen name="taxi_p_traffic_light_bg_margin_top">17px</dimen>
<dimen name="taxi_p_traffic_light_icon_size">154px</dimen>
<dimen name="taxi_p_traffic_light_time_view_width">127px</dimen>
<dimen name="taxi_p_traffic_light_time_view_width">130px</dimen>
<dimen name="taxi_p_traffic_light_time_size">60px</dimen>
<dimen name="taxi_p_v2x_notification_view_margin_left">31px</dimen>

View File

@@ -549,34 +549,13 @@ public class OCHTaxiFragment extends BaseOchTaxiTabFragment<OCHTaxiFragment, OCH
builder.setLongitude(s.getDouble("lon"));
list.add(builder.build());
}
List<MessagePad.Location> list1 = CoordinateConverterFrom84ForList(getContext(), list);
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list1);
MogoOCHTaxiModelNew.getInstance().updateOrderRoute(list);
} catch (JSONException e) {
e.printStackTrace();
}
});
}
public List<MessagePad.Location> CoordinateConverterFrom84ForList(Context mContext, List<MessagePad.Location> mogoLatLngList) {
List<MessagePad.Location> list = new ArrayList<>();
for (MessagePad.Location m : mogoLatLngList) {
LatLng mogoLatLng = CoordinateConverterFrom84(mContext, m);
MessagePad.Location.Builder builder = MessagePad.Location.newBuilder();
builder.setLatitude(mogoLatLng.latitude);
builder.setLongitude(mogoLatLng.longitude);
list.add(builder.build());
}
return list;
}
public LatLng CoordinateConverterFrom84(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 void clickTestBar() {
View testBar = findViewById(R.id.module_och_taxi_order_status_change_test_bar);
if (testBar.getVisibility() == View.VISIBLE) {