Merge remote-tracking branch 'origin/dev2' into dev2
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -89,7 +89,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,6 +9,8 @@ public
|
||||
*/
|
||||
interface IMogoOCHTaxiArriveCallback {
|
||||
|
||||
void onTheWay2StartStation();
|
||||
|
||||
/**
|
||||
* 到达起始站
|
||||
*/
|
||||
|
||||
@@ -305,6 +305,7 @@ class MogoOCHTaxiModel {
|
||||
*/
|
||||
public void setOnTheWay2EndStation( boolean isOnTheWay2EndStation ) {
|
||||
this.mIsOnTheWay2EndStation = isOnTheWay2EndStation;
|
||||
OCHTaxiUiController.getInstance().onTheWay2EndStation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.BaseOchFragment;
|
||||
import com.mogo.och.taxi.IMogoOCHTaxiArriveCallback;
|
||||
import com.mogo.och.taxi.MogoOCHTaxiModel;
|
||||
import com.mogo.och.taxi.OCHOrderStatus;
|
||||
import com.mogo.och.taxi.OCHOrderStatusCallback;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.view.SlidePanelView;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -24,7 +25,7 @@ public
|
||||
*
|
||||
* 网约车-出租车UI
|
||||
*/
|
||||
class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > implements OCHTaxiView,
|
||||
class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > implements OCHTaxiView,
|
||||
IMogoStatusChangedListener, IMogoOCHTaxiArriveCallback {
|
||||
|
||||
public static final String TAG = "OCHTaxiFragment";
|
||||
@@ -38,45 +39,23 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private TextView orderInfo;
|
||||
private Button autoPilot;
|
||||
private TextView mOrderStatus;
|
||||
private TextView mStartStationName;
|
||||
private TextView mEndStationName;
|
||||
private TextView mDistance;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_och_taxi_fragment;
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.module_och_taxi_panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
orderInfo = findViewById( R.id.orderInfo );
|
||||
autoPilot = findViewById( R.id.autoPilot );
|
||||
orderInfo.setText( MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().toString() );
|
||||
autoPilot.setOnClickListener( view -> {
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
Logger.w( TAG, "已到达终点" );
|
||||
return;
|
||||
}
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
MogoOCHTaxiModel.getInstance().setOnTheWay2EndStation( true );
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.OnTheWayToEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
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()
|
||||
@@ -122,28 +101,49 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
}
|
||||
|
||||
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, "已经达到终点" );
|
||||
return;
|
||||
}
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) );
|
||||
mOrderStatus.setText( "已到达乘客下车地点" );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "已经去往终点" );
|
||||
return;
|
||||
}
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
mOrderStatus.setText( "去往下车地点" );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "已经达到起点" );
|
||||
return;
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
mOrderStatus.setText( "已到达上车地点,等待乘客上车" );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
Logger.d( TAG, "去往上车站点" );
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
mOrderStatus.setText( "收到新订单,正在前往上车地点" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtStartStation() {
|
||||
Logger.d( TAG, "通知达到起点" );
|
||||
initOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTheWay2StartStation() {
|
||||
Logger.d( TAG, "去往上车站点" );
|
||||
initOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAtEndStation() {
|
||||
Logger.d( TAG, "通知达到终点" );
|
||||
onAutopilotStatusChanged( false );
|
||||
initOrderStatus();
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.ArriveAtEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
@@ -166,6 +166,8 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
@Override
|
||||
public void onTheWay2EndStation() {
|
||||
Logger.d( TAG, "通知去往终点" );
|
||||
onAutopilotStatusChanged( true );
|
||||
initOrderStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,4 +179,56 @@ class OCHTaxiFragment extends MvpFragment< OCHTaxiView, OCHTaxiPresenter > imple
|
||||
.unregisterStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
|
||||
OCHTaxiUiController.getInstance().setOCHTaxiArriveCallback( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return this::onSlidePanelMoveToEnd;
|
||||
}
|
||||
|
||||
private void onSlidePanelMoveToEnd() {
|
||||
// 已到达终点,需要结束订单
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.Completed, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
MogoOCHTaxiModel.getInstance().clearCurrentOCHOrder();
|
||||
OCHTaxiUiController.getInstance().removeFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
return;
|
||||
// 已到达起点,前往下一站并开启自动驾驶
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation()
|
||||
&& !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
MogoOCHTaxiModel.getInstance().startAutoPilot();
|
||||
MogoOCHTaxiModel.getInstance().setOnTheWay2EndStation( true );
|
||||
MogoOCHTaxiModel.getInstance().updateOCHOrderStatus( OCHOrderStatus.OnTheWayToEndStation, new OCHOrderStatusCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object data ) {
|
||||
Logger.d( TAG, "更新状态成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
Logger.d( TAG, "更新状态失败" );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 |
@@ -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>
|
||||
@@ -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>
|
||||
@@ -1,21 +0,0 @@
|
||||
<?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"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/orderInfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="kong"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20px" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/autoPilot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开启自动驾驶" />
|
||||
</LinearLayout>
|
||||
147
OCH/mogo-och-taxi/src/main/res/layout/module_och_taxi_panel.xml
Normal file
147
OCH/mogo-och-taxi/src/main/res/layout/module_och_taxi_panel.xml
Normal file
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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/module_och_taxi_order_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="30px"
|
||||
android:layout_marginTop="24px"
|
||||
android:text="已到达上车站点,等待乘客上车"
|
||||
android:textColor="@color/module_och_order_status_textColor"
|
||||
android:textSize="24px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
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>
|
||||
|
||||
</LinearLayout>
|
||||
5
OCH/mogo-och-taxi/src/main/res/values-xhdpi/dimens.xml
Normal file
5
OCH/mogo-och-taxi/src/main/res/values-xhdpi/dimens.xml
Normal 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>
|
||||
4
OCH/mogo-och-taxi/src/main/res/values/colors.xml
Normal file
4
OCH/mogo-och-taxi/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_och_order_status_textColor">#FFFFFF</color>
|
||||
</resources>
|
||||
5
OCH/mogo-och-taxi/src/main/res/values/strings.xml
Normal file
5
OCH/mogo-och-taxi/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_och_taxi_arrive_at_start_station">乘客已上车,准备出发</string>
|
||||
<string name="module_och_taxi_arrive_at_end_station">到达站点,乘客已下车</string>
|
||||
</resources>
|
||||
@@ -22,7 +22,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> {
|
||||
private SlidePanelView slidePanelView;
|
||||
protected SlidePanelView slidePanelView;
|
||||
private TextView tvNotice;
|
||||
private CheckedTextView ctvAutopilotStatus;
|
||||
private FrameLayout flStationPanelContainer;
|
||||
|
||||
@@ -24,6 +24,7 @@ class MapStyleController {
|
||||
|
||||
private MapStyleController() {
|
||||
mVrAreaFilters.add( new ShunYiArea() );
|
||||
mVrAreaFilters.add( new OCHArea() );
|
||||
}
|
||||
|
||||
public static MapStyleController getInstance() {
|
||||
@@ -85,7 +86,21 @@ class MapStyleController {
|
||||
}
|
||||
|
||||
public interface VrAreaFilter {
|
||||
boolean isVrArea( MogoLocation location );
|
||||
default boolean isVrArea( MogoLocation location ) {
|
||||
if ( location == null ) {
|
||||
return false;
|
||||
}
|
||||
return location.getLat() > getLeftBottomLat() && location.getLon() > getLeftBottomLon()
|
||||
&& location.getLat() < getRightTopLat() && location.getLon() < getRightTopLon();
|
||||
}
|
||||
|
||||
double getLeftBottomLat();
|
||||
|
||||
double getLeftBottomLon();
|
||||
|
||||
double getRightTopLat();
|
||||
|
||||
double getRightTopLon();
|
||||
}
|
||||
|
||||
public static class ShunYiArea implements VrAreaFilter {
|
||||
@@ -97,12 +112,46 @@ class MapStyleController {
|
||||
private final double rightTopLon = 116.74804;
|
||||
|
||||
@Override
|
||||
public boolean isVrArea( MogoLocation location ) {
|
||||
if ( location == null ) {
|
||||
return false;
|
||||
}
|
||||
return location.getLat() > leftBottomLat && location.getLon() > leftBottomLon
|
||||
&& location.getLat() < rightTopLat && location.getLon() < rightTopLon;
|
||||
public double getLeftBottomLat() {
|
||||
return leftBottomLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return leftBottomLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return rightTopLat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return rightTopLon;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OCHArea implements VrAreaFilter {
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLat() {
|
||||
return 39.97645;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLeftBottomLon() {
|
||||
return 116.41673;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLat() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getRightTopLon() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user