去掉showNotice的自动驾驶状态判断

This commit is contained in:
tongchenfei
2021-02-02 14:16:55 +08:00
parent 97314a67d3
commit 358fe04e78
8 changed files with 54 additions and 12 deletions

1
.idea/gradle.xml generated
View File

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

View File

@@ -1,5 +1,7 @@
package com.mogo.och.bus.fragment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -34,6 +36,8 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
private OchBusStationAdapter adapter;
private int stationSizeLevel = 2;
@Override
protected void initViews() {
super.initViews();
@@ -45,6 +49,20 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
rvStationList.setAdapter(adapter);
rvStationList.setLayoutManager(new LinearLayoutManager(getContext()));
tvStationNotice.setOnClickListener(view->{
// todo debug code
switch (stationSizeLevel) {
case 2:
break;
case 3:
break;
default:
break;
}
});
Logger.d(TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus());
switch (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()) {
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
@@ -103,6 +121,21 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
// 获取小巴数据失败
return;
}
// todo 根据车站数量调整面板高度分为23>3
View panelView = getPanelView();
ViewGroup.LayoutParams params = panelView.getLayoutParams();
switch (stationList.size()) {
case 2:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_two_station_panel_height);
break;
case 3:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_three_station_panel_height);
break;
default:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_station_panel_height);
break;
}
panelView.setLayoutParams(params);
// 渲染小巴路线数据
adapter.refreshStationList(stationList);
int currPos = -1;

View File

@@ -26,7 +26,7 @@
android:layout_marginStart="@dimen/module_mogo_och_bus_station_panel_padding_left"
android:layout_marginTop="@dimen/module_mogo_och_bus_station_panel_guide_offset_top"
android:layout_marginEnd="@dimen/module_mogo_och_bus_station_panel_padding_right"
android:background="#FF51649D"
android:background="#FF151B37"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_bus_current_station_name" />

View File

@@ -10,15 +10,15 @@
android:layout_height="30px"
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_icon"
android:layout_marginTop="10px"/>
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name"
android:layout_marginTop="15px"/>
<com.mogo.och.bus.view.VerticalDashLineView
android:id="@+id/module_mogo_och_bus_station_top_dash"
android:layout_width="1px"
android:layout_height="30px"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_icon"
android:layout_marginBottom="10px"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
android:layout_marginBottom="15px"
app:layout_constraintLeft_toLeftOf="@id/module_mogo_och_bus_station_icon"
app:layout_constraintRight_toRightOf="@id/module_mogo_och_bus_station_icon" />
<ImageView
@@ -29,6 +29,7 @@
android:src="@drawable/module_mogo_och_bus_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintVertical_bias="0.4"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />
<TextView
android:id="@+id/module_mogo_och_bus_station_name"
@@ -49,6 +50,7 @@
android:text="起点"
android:textColor="@color/module_mogo_och_bus_station_notice_text_color"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:layout_marginEnd="10px"
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_station_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_station_name" />

View File

@@ -4,7 +4,7 @@
<color name="module_mogo_och_bus_current_station_notice_text_color">#FFFFFFFF</color>
<color name="module_mogo_och_bus_arrived_station_name_text_color">#FFFFFFFF</color>
<color name="module_mogo_och_bus_not_arrive_station_name_text_color">#FF51649D</color>
<color name="module_mogo_och_bus_station_notice_text_color">#FF8299EB</color>
<color name="module_mogo_och_bus_station_notice_text_color">#7F8299EB</color>
<color name="module_mogo_och_bus_not_arrive_dash_color">#51649D</color>
<color name="module_mogo_och_bus_arriving_start_dash_color">#427d8e</color>

View File

@@ -3,6 +3,8 @@
<!-- 本套资源适配分体机xhdpi -->
<dimen name="module_mogo_och_bus_station_panel_width">464px</dimen>
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
<dimen name="module_mogo_och_bus_two_station_panel_height">148px</dimen>
<dimen name="module_mogo_och_bus_three_station_panel_height">248px</dimen>
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>

View File

@@ -44,7 +44,7 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
protected int getLayoutId() {
return R.layout.module_mogo_och_base_fragment;
}
private View panelView;
@Override
protected void initViews() {
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
@@ -53,7 +53,7 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
fivNoticeHead = findViewById(R.id.module_mogo_och_notice_head);
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
fivNoticeHead.setAnimRes(sHappy1);
@@ -112,9 +112,6 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
public void showNotice(String notice) {
getActivity().runOnUiThread(() -> {
tvNotice.setText(notice);
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) {
return;
}
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
tvNotice.setVisibility(View.VISIBLE);
fivNoticeHead.setVisibility(View.VISIBLE);
@@ -155,6 +152,10 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
});
}
public View getPanelView(){
return panelView;
}
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
return null;
}

View File

@@ -131,7 +131,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
Logger.d(TAG, "websocket remove listener success");
}
}
private long timeRecord = 0;
@Override
public void sendMsg(Object body, IMogoOnWebSocketMessageListener listener) {
Logger.d(TAG, "websocket sendMsg body = " + body);
@@ -149,6 +149,7 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
}
String msg = GsonUtil.jsonFromObject(webSocketData);
Logger.d(TAG,"sendMsg : " + msg);
timeRecord = System.currentTimeMillis();
handlerThread.sendMsg(msg);
}
}
@@ -208,6 +209,8 @@ public class WebSocketManager implements IMogoWebSocketManager, ISocketMsgSettin
}
}
} else if (msgType == MSG_TYPE_ACK.getMsgType()) {
long delta = System.currentTimeMillis() - timeRecord;
Logger.d("TimeRecord", "send->ack: " + delta);
if (webSocketData.getUtcTime() > 0) {
serverTime = webSocketData.getUtcTime();
receiveMsgTime = SystemClock.elapsedRealtime();