This commit is contained in:
wangcongtao
2021-01-21 19:12:24 +08:00
parent c40126aaf2
commit a60e69ad64
14 changed files with 266 additions and 63 deletions

1
.idea/gradle.xml generated
View File

@@ -89,7 +89,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -40,6 +40,7 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxconstraintlayout
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogooch

View File

@@ -9,6 +9,8 @@ public
*/
interface IMogoOCHTaxiArriveCallback {
void onTheWay2StartStation();
/**
* 到达起始站
*/

View File

@@ -2,6 +2,7 @@ package com.mogo.och.taxi.ui;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -38,6 +39,11 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
return fragment;
}
private TextView mOrderStatus;
private TextView mStartStationName;
private TextView mEndStationName;
private TextView mDistance;
@Override
public int getStationPanelViewId() {
return R.layout.module_och_taxi_panel;
@@ -46,6 +52,11 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
@Override
protected void initViews() {
super.initViews();
mOrderStatus = findViewById( R.id.module_och_taxi_order_status );
mStartStationName = findViewById( R.id.module_och_taxi_order_start_station );
mEndStationName = findViewById( R.id.module_och_taxi_order_end_station );
mDistance = findViewById( R.id.module_och_taxi_order_distance );
if ( MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
@@ -90,22 +101,29 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
}
private void initOrderStatus() {
if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
mStartStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().startStation );
mEndStationName.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().endStation );
mDistance.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().travelDistance + " km" );
}
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
Logger.d( TAG, "已经达到终点" );
slidePanelView.setVisibility( View.VISIBLE );
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) );
return;
}
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
mOrderStatus.setText( "已到达乘客下车地点" );
} else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
Logger.d( TAG, "已经去往终点" );
slidePanelView.setVisibility( View.GONE );
return;
}
if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
mOrderStatus.setText( "去往下车地点" );
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
Logger.d( TAG, "已经达到起点" );
slidePanelView.setVisibility( View.VISIBLE );
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
return;
mOrderStatus.setText( "已到达上车地点,等待乘客上车" );
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
Logger.d( TAG, "去往上车站点" );
slidePanelView.setVisibility( View.GONE );
mOrderStatus.setText( "收到新订单,正在前往上车地点" );
}
}
@@ -115,6 +133,12 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
initOrderStatus();
}
@Override
public void onTheWay2StartStation() {
Logger.d( TAG, "去往上车站点" );
initOrderStatus();
}
@Override
public void onArriveAtEndStation() {
Logger.d( TAG, "通知达到终点" );

View File

@@ -94,6 +94,11 @@ class OCHTaxiUiController implements IMogoOCHTaxiArriveCallback {
this.mOCHTaxiArriveCallback = OCHTaxiArriveCallback;
}
@Override
public void onTheWay2StartStation() {
}
@Override
public void onArriveAtStartStation() {
runOnUIThread( () -> {

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="17px" />
<solid android:color="#AD3D4E81" />
</shape>
</item>
<item
android:bottom="3px"
android:left="3px"
android:right="3px"
android:top="3px">
<shape>
<corners android:radius="17px" />
<gradient
android:endColor="#202D4E"
android:startColor="#2C3862" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:centerColor="#080F25"
android:endColor="#121A35"
android:startColor="#131D42" />
<corners
android:bottomLeftRadius="17px"
android:bottomRightRadius="17px"
android:topLeftRadius="0px"
android:topRightRadius="0px" />
</shape>

View File

@@ -1,27 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/module_och_taxi_panel_width"
android:layout_height="@dimen/module_och_taxi_panel_height"
android:background="@drawable/module_och_taxi_panel_bkg"
android:orientation="vertical">
<TextView
android:id="@+id/orderInfo"
android:id="@+id/module_och_taxi_order_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="kong"
android:textColor="#FFFFFF"
android:textSize="20px" />
android:layout_marginLeft="30px"
android:layout_marginTop="24px"
android:text="已到达上车站点,等待乘客上车"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="24px"
android:textStyle="bold" />
<Button
android:id="@+id/autoPilot"
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开启自动驾驶" />
android:layout_height="2px"
android:layout_marginLeft="30px"
android:layout_marginTop="23px"
android:layout_marginRight="30px"
android:background="#151B37" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="146px"
android:paddingLeft="30px"
android:paddingTop="23px"
android:paddingRight="30px"
android:paddingBottom="23px">
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_och_taxi_green_dot"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
<TextView
android:id="@+id/module_och_taxi_order_start_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5px"
android:text="后路站"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="26px"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_taxi_order_start_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上车站点"
android:textColor="#8198E8"
android:textSize="20px"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_start_station" />
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_och_taxi_dot_line"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<ImageView
android:id="@+id/blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_och_taxi_blue_dot"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
<TextView
android:id="@+id/module_och_taxi_order_end_station"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="后路站1"
android:textColor="@color/module_och_order_status_textColor"
android:textSize="26px"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/module_och_taxi_order_start_station"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
<TextView
android:id="@+id/module_och_taxi_order_end_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下车站点"
android:textColor="#8198E8"
android:textSize="20px"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_och_taxi_order_end_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_taxi_order_end_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="80px"
android:layout_marginLeft="3px"
android:layout_marginRight="3px"
android:background="@drawable/module_och_taxi_panel_distance_bkg">
<TextView
android:id="@+id/module_och_taxi_order_distance_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="27px"
android:text="预计里程"
android:textColor="#8198E8"
android:textSize="20px"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
<TextView
android:id="@+id/module_och_taxi_order_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="27px"
android:text="3.2 km"
android:textColor="#1FA7FF"
android:textSize="28px"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/greenDot" />
</FrameLayout>
<Button
android:id="@+id/complete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="乘客到站下车" />
</LinearLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_och_taxi_panel_width">464px</dimen>
<dimen name="module_och_taxi_panel_height">310px</dimen>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_och_order_status_textColor">#FFFFFF</color>
</resources>

View File

@@ -2,7 +2,9 @@ package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.utils.CoordinateUtils;
@@ -21,8 +23,14 @@ public class CloudLocationInfo implements Parcelable {
private long satelliteTime;
private double alt;
private double speed;
private int vehicleType = 0;
public CloudLocationInfo() {
if ( DebugConfig.getProductFlavor().contains( "taxi" ) ) {
vehicleType = 9;
} else if ( DebugConfig.getProductFlavor().contains( "bus" ) ) {
vehicleType = 10;
}
}
public CloudLocationInfo( CloudLocationInfo info ) {
@@ -35,7 +43,7 @@ public class CloudLocationInfo implements Parcelable {
this.speed = info.speed;
}
public void convertCoor2GCJ02(){
public void convertCoor2GCJ02() {
double[] amapCoord = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
if ( amapCoord != null ) {
this.lat = amapCoord[0];
@@ -43,44 +51,6 @@ public class CloudLocationInfo implements Parcelable {
}
}
protected CloudLocationInfo( Parcel in ) {
lat = in.readDouble();
lon = in.readDouble();
heading = in.readDouble();
systemTime = in.readLong();
satelliteTime = in.readLong();
alt = in.readDouble();
speed = in.readDouble();
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeDouble( lat );
dest.writeDouble( lon );
dest.writeDouble( heading );
dest.writeLong( systemTime );
dest.writeLong( satelliteTime );
dest.writeDouble( alt );
dest.writeDouble( speed );
}
@Override
public int describeContents() {
return 0;
}
public static final Creator< CloudLocationInfo > CREATOR = new Creator< CloudLocationInfo >() {
@Override
public CloudLocationInfo createFromParcel( Parcel in ) {
return new CloudLocationInfo( in );
}
@Override
public CloudLocationInfo[] newArray( int size ) {
return new CloudLocationInfo[size];
}
};
public double getLat() {
return lat;
}
@@ -172,4 +142,44 @@ public class CloudLocationInfo implements Parcelable {
public int hashCode() {
return Objects.hash( lat, lon );
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeDouble( this.lat );
dest.writeDouble( this.lon );
dest.writeDouble( this.heading );
dest.writeLong( this.systemTime );
dest.writeLong( this.satelliteTime );
dest.writeDouble( this.alt );
dest.writeDouble( this.speed );
dest.writeInt( this.vehicleType );
}
protected CloudLocationInfo( Parcel in ) {
this.lat = in.readDouble();
this.lon = in.readDouble();
this.heading = in.readDouble();
this.systemTime = in.readLong();
this.satelliteTime = in.readLong();
this.alt = in.readDouble();
this.speed = in.readDouble();
this.vehicleType = in.readInt();
}
public static final Creator< CloudLocationInfo > CREATOR = new Creator< CloudLocationInfo >() {
@Override
public CloudLocationInfo createFromParcel( Parcel source ) {
return new CloudLocationInfo( source );
}
@Override
public CloudLocationInfo[] newArray( int size ) {
return new CloudLocationInfo[size];
}
};
}