小巴ui fix

This commit is contained in:
tongchenfei
2021-02-02 15:57:21 +08:00
parent 358fe04e78
commit 8a7bc28954
3 changed files with 90 additions and 12 deletions

View File

@@ -19,6 +19,8 @@ import com.mogo.och.view.SlidePanelView;
import com.mogo.service.adas.IMogoAdasOCHCallback;
import com.mogo.utils.logger.Logger;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
@@ -51,16 +53,87 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
tvStationNotice.setOnClickListener(view->{
// todo debug code
List<OchBusStation> stationList = new ArrayList<>();
OchBusStation station;
switch (stationSizeLevel) {
case 2:
stationSizeLevel++;
station = new OchBusStation();
station.setSiteName("第一站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第二站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
break;
case 3:
stationSizeLevel++;
station = new OchBusStation();
station.setSiteName("第一站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第二站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第三站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
break;
case 4:
stationSizeLevel++;
station = new OchBusStation();
station.setSiteName("第一站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第二站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第三站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第四站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
break;
default:
stationSizeLevel = 2;
station = new OchBusStation();
station.setSiteName("第一站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第二站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第三站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第四站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第五站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第五站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
station = new OchBusStation();
station.setSiteName("第五站");
station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
stationList.add(station);
break;
}
refreshBusStations(stationList);
});
Logger.d(TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus());
@@ -121,21 +194,20 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
// 获取小巴数据失败
return;
}
// todo 根据车站数量调整面板高度分为23>3
View panelView = getPanelView();
ViewGroup.LayoutParams params = panelView.getLayoutParams();
// 根据车站数量调整面板高度分为23>3
ViewGroup.LayoutParams params = rvStationList.getLayoutParams();
switch (stationList.size()) {
case 2:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_two_station_panel_height);
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_two_station_list_height);
break;
case 3:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_three_station_panel_height);
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_three_station_list_height);
break;
default:
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_station_panel_height);
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_station_list_height);
break;
}
panelView.setLayoutParams(params);
rvStationList.setLayoutParams(params);
// 渲染小巴路线数据
adapter.refreshStationList(stationList);
int currPos = -1;

View File

@@ -2,8 +2,9 @@
<com.mogo.och.bus.view.NoTouchConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/module_mogo_och_bus_station_panel_width"
android:layout_height="@dimen/module_mogo_och_bus_station_panel_height"
android:layout_height="wrap_content"
android:clickable="true"
android:maxHeight="@dimen/module_mogo_och_bus_station_panel_height"
android:background="@drawable/module_och_bus_panel_bkg">

View File

@@ -3,8 +3,13 @@
<!-- 本套资源适配分体机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_two_station_panel_height">211px</dimen>
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
<dimen name="module_mogo_och_bus_station_list_height">220px</dimen>
<dimen name="module_mogo_och_bus_two_station_list_height">98px</dimen>
<dimen name="module_mogo_och_bus_three_station_list_height">159px</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>