优化显示逻辑

This commit is contained in:
wangcongtao
2021-03-30 16:01:54 +08:00
parent c81d1673d7
commit 4e78853d0e
10 changed files with 75 additions and 62 deletions

View File

@@ -154,12 +154,10 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
}
if ( isArriveEndStation ) {
// showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" );
showSlidePanle( "单程结束" );
} else if ( isArriveAtStartStation ) {
showSlidePanle( "准备出发" );
} else if ( isArriveAtStation ) {
// showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" );
showSlidePanle( "乘客已上车,准备出发" );
}
@@ -191,7 +189,7 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
@Override
public void moveToEnd() {
mPresenter.autoDriveToNextStation();
mPresenter.autoDriveToNextStation(false);
}
public void onAutopilotEnableChange( boolean isEnable ) {
@@ -210,9 +208,9 @@ public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPrese
public void changeOperationStatus( boolean launch ) {
if ( launch ) {
tvOperationStatus.setText( "关闭" );
tvOperationStatus.setText( "收车" );
} else {
tvOperationStatus.setText( "开启" );
tvOperationStatus.setText( "出车" );
}
}
}

View File

@@ -73,21 +73,6 @@ class OchBusOrderModel {
}
};
/**
* 小巴达到站点,推送需要下车的乘客列表
*/
private IMogoOnMessageListener< OchBusArriveAtStationMsg > mOnBusArriveAtStationMsg = new IMogoOnMessageListener< OchBusArriveAtStationMsg >() {
@Override
public Class< OchBusArriveAtStationMsg > target() {
return OchBusArriveAtStationMsg.class;
}
@Override
public void onMsgReceived( OchBusArriveAtStationMsg obj ) {
onArriveAtStation();
}
};
/**
* 站点信息变更推送
*/

View File

@@ -12,7 +12,6 @@ import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.HostConst;
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
@@ -45,7 +44,6 @@ import okhttp3.MediaType;
import okhttp3.RequestBody;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_ARRIVING;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_IDLE;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_LEAVING;
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED;
@@ -105,11 +103,10 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
public void queryBusRoutes() {
double lat = 40.1974932972;
double lon = 116.7354579447;
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( getContext() ).getLastKnowLocation();
if ( lastLocation != null ) {
// lat = lastLocation.getLatitude();
// lon = lastLocation.getLongitude();
}
// lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
// lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
OchBusRoutesRequest request = new OchBusRoutesRequest( Utils.getSn(), lat, lon );
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
mService.querySiteByCoordinate( requestBody )
@@ -153,6 +150,8 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
* @param site
*/
private void renderBusStationsStatus( List< OchBusStation > site ) {
int lastStopStation = getNextStopStation();
stationList.clear();
stationList.addAll( site );
for ( int i = 0; i < stationList.size(); i++ ) {
@@ -174,6 +173,29 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
mView.hideSlidePanel();
mView.hideNotice();
}
resetNextStopStation( lastStopStation );
}
/**
* 重置下一站
*
* @param lastStopStation
*/
private void resetNextStopStation( int lastStopStation ) {
int nextStopStation = getNextStopStation();
if ( nextStopStation < 0 ) {
return;
}
if ( lastStopStation <= nextStopStation || nextStopStation <= currentStationIndex ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()
== IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING ) {
// 自动驾驶中动态设置下一个停靠站点
autoDriveToNextStation( true );
}
}
/**
@@ -201,7 +223,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
public void restartAutopilot() {
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
if ( isGoingToNextStation ) {
autoDriveToNextStation();
autoDriveToNextStation( true );
}
}
@@ -247,7 +269,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
/**
* 开启自动驾驶到下一站
*/
public void autoDriveToNextStation() {
public void autoDriveToNextStation( boolean isRestart ) {
if ( currentStationIndex >= stationList.size() - 1 ) {
// 当前站是最后一站,结束当前行程
travelOver();
@@ -262,6 +284,7 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING );
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
currentAutopilot.isSpeakVoice = !isRestart;
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() );
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() );
currentAutopilot.vehicleType = VEHICLE_TYPE;
@@ -385,20 +408,25 @@ public class OchBusPresenter extends Presenter< OchBusFragment > implements IMog
return;
}
String station = stationList.get( currentStationIndex ).getSiteName();
String msg = null;
StringBuilder builder = new StringBuilder( "已到达" );
if ( station.endsWith( "" ) ) {
builder.append( station );
}
if ( o == null || o.result == null || o.result.info == null || o.result.info.isEmpty() ) {
msg = "已到达" + station + "站,请带好随身物品,下车请注意安全";
return;
}
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : o.result.info ) {
if ( leaveAwayPassenger == null ) {
continue;
//
} else {
builder.append( ",请尾号为" );
for ( QueryLeaveAwayPassengersResponse.LeaveAwayPassenger leaveAwayPassenger : o.result.info ) {
if ( leaveAwayPassenger == null ) {
continue;
}
String tailNum = leaveAwayPassenger.userPhone.substring( leaveAwayPassenger.userPhone.length() - 4 );
builder.append( tailNum ).append( "," );
}
String tailNum = leaveAwayPassenger.userPhone.substring( leaveAwayPassenger.userPhone.length() - 4 );
builder.append( "的乘客下车" );
}
AIAssist.getInstance( getContext() ).speakTTSVoice( msg );
builder.append( ",带好随身物品,下车请注意安全" );
AIAssist.getInstance( getContext() ).speakTTSVoice( builder.toString() );
}
/**

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/module_mogo_och_autopilot_text_color_checked" android:state_checked="true" />
<item android:color="@color/module_mogo_och_autopilot_text_color_normal"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="20px"
android:bottomRightRadius="45px"
android:topLeftRadius="45px"
android:topRightRadius="20px" />
<gradient
android:angle="315"
android:endColor="#FF28376B"
android:startColor="#FF405591" />
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
</item>
</selector>
</shape>

View File

@@ -5,8 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="@dimen/module_mogo_och_margin_left"
android:paddingTop="@dimen/module_mogo_och_margin_top"
android:paddingEnd="@dimen/module_mogo_och_margin_right"
android:paddingBottom="@dimen/module_mogo_och_margin_bottom">
<CheckedTextView
@@ -15,17 +13,17 @@
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
android:background="@drawable/module_mogo_och_autopilot_status_bg"
android:drawableLeft="@drawable/module_mogo_och_base_autopilot_status_icon_selector"
android:drawableLeft="@drawable/module_och_bus_ic_autopilot"
android:gravity="center"
android:paddingLeft="35px"
android:text="自动驾驶"
android:textAlignment="center"
android:textColor="@color/module_mogo_och_autopilot_text_color_selector"
android:textColor="@color/module_mogo_och_autopilot_text_color_normal"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"/>
tools:visibility="visible" />
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
@@ -40,7 +38,6 @@
android:id="@+id/module_mogo_och_operation_status"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginBottom="10px"
android:background="@drawable/module_mogo_och_operation_status_bg"
android:gravity="center"
android:text="开启"

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 此资源适配分体机 xhdpi -->
<dimen name="module_mogo_och_margin_left">55px</dimen>
<dimen name="module_mogo_och_margin_left">40px</dimen>
<dimen name="module_mogo_och_margin_right">40px</dimen>
<dimen name="module_mogo_och_margin_bottom">40px</dimen>
<dimen name="module_mogo_och_margin_bottom">46px</dimen>
<dimen name="module_mogo_och_margin_top">24px</dimen>
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">400px</dimen>
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">351px</dimen>
<dimen name="module_mogo_och_station_panel_container_margin_top_with_call">492px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>

View File

@@ -16,6 +16,10 @@ class RemoteControlAutoPilotParameters {
public AutoPilotLonLat endLatLon;
public float speedLimit;
public int vehicleType;// 运营类型
/**
* 是否播放adas的 开始自动驾驶 语音
*/
public boolean isSpeakVoice = true;
public static class AutoPilotLonLat {
public double lat;