[2.11.0] bus司机端路线面板优化
@@ -14,6 +14,7 @@ public class BusRoutesResult {
|
||||
private int lineType; //线路类型,0:环形
|
||||
private String description;
|
||||
private int status;
|
||||
private long taskTime; //线路时间班次
|
||||
|
||||
//线路轨迹相关字段
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
@@ -44,12 +45,17 @@ public class BusRoutesResult {
|
||||
this.sites = sites;
|
||||
}
|
||||
|
||||
public long getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
|
||||
@@ -9,6 +9,12 @@ import java.util.List;
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface IRefreshBusStationsCallback {
|
||||
void refreshBusStations(String lineName,List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
|
||||
void updateBusTaskStatus(String lineName,String lintTime,
|
||||
List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived);
|
||||
|
||||
void clearBusStationsMarkers();
|
||||
|
||||
void updateEmptyUi();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -25,17 +27,17 @@ import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.presenter.BusPresenter;
|
||||
import com.mogo.och.bus.ui.BusStationCommonItem;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
@@ -46,18 +48,24 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private static final String TAG = "BusFragment";
|
||||
|
||||
private TextView mCurrentStationName;
|
||||
private TextView mNextStationName;
|
||||
private TextView mCurrentTag;
|
||||
private TextView mNextTag;
|
||||
// private TextView mCurrentStationName;
|
||||
// private TextView mNextStationName;
|
||||
// private TextView mCurrentTag;
|
||||
// private TextView mNextTag;
|
||||
private TextView mSwitchLine; //切换路线
|
||||
private TextView mLineName;
|
||||
private int mCurrentStation = 0;
|
||||
private TextView mTaskTime;
|
||||
private Group groupStationsPanel;
|
||||
private ConstraintLayout noDataView;
|
||||
// private int mCurrentStation = 0;
|
||||
|
||||
// private View mBus;
|
||||
|
||||
private BusStationBean startStation = null;
|
||||
private BusStationBean endStation = null;
|
||||
private BusStationCommonItem firstStationItem;
|
||||
private BusStationCommonItem secondStationItem;
|
||||
private BusStationCommonItem thirdStationItem;
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
@@ -67,22 +75,20 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
// mBus = findViewById(R.id.module_och_bus_tag);
|
||||
mCurrentStationName = findViewById(R.id.module_och_bus_current_station);
|
||||
mCurrentTag = findViewById(R.id.module_och_bus_current_station_anchor);
|
||||
mNextStationName = findViewById(R.id.module_och_bus_order_end_station);
|
||||
mNextTag = findViewById(R.id.module_och_bus_next_station_anchor);
|
||||
// mCurrentStationName = findViewById(R.id.module_och_bus_current_station);
|
||||
// mCurrentTag = findViewById(R.id.module_och_bus_current_station_anchor);
|
||||
// mNextStationName = findViewById(R.id.module_och_bus_order_end_station);
|
||||
// mNextTag = findViewById(R.id.module_och_bus_next_station_anchor);
|
||||
mSwitchLine = findViewById(R.id.switch_line_btn);
|
||||
mSwitchLine.setTag(0);
|
||||
mLineName = findViewById(R.id.module_och_bus_line_name);
|
||||
|
||||
//调用测试面板
|
||||
mCurrentStationName.setOnLongClickListener(v -> {
|
||||
debugTestBar();
|
||||
showHideTestBar();
|
||||
return true;
|
||||
});
|
||||
// }
|
||||
firstStationItem = findViewById(R.id.bus_panel_first_station);
|
||||
secondStationItem = findViewById(R.id.bus_panel_second_station);
|
||||
thirdStationItem = findViewById(R.id.bus_panel_third_station);
|
||||
mTaskTime = findViewById(R.id.bus_task_time_tv);
|
||||
groupStationsPanel = findViewById(R.id.group_stations_panel);
|
||||
noDataView = findViewById(R.id.no_line_data_view);
|
||||
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
@@ -122,78 +128,64 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据站点列表信息刷新车站面板,滑块面板
|
||||
*
|
||||
* @param stationList 车站列表信息
|
||||
* @param currentStation 当前站点
|
||||
* @param nextStation 下个站点
|
||||
* @param isArrived 是否都站
|
||||
*/
|
||||
public void refreshBusStations(String lineName,List<BusStationBean> stationList
|
||||
, int currentStation, int nextStation, boolean isArrived) {
|
||||
mCurrentStation = currentStation;
|
||||
public void hideStationsPanel(){
|
||||
groupStationsPanel.setVisibility(View.GONE);
|
||||
noDataView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void showStationsPanel(){
|
||||
groupStationsPanel.setVisibility(View.VISIBLE);
|
||||
noDataView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void updateLineEmptyUI(){
|
||||
hideStationsPanel();
|
||||
}
|
||||
|
||||
public void updateBusTaskStatus(String lineName, String lineTime,
|
||||
List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived){
|
||||
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
renderCurrentStationStatus(lineName,stationList, currentStation, nextStation, isArrived);
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新刷新站点信息 isArrived 是否到站
|
||||
*/
|
||||
private void renderCurrentStationStatus(String lineName,List<BusStationBean> stationList, int currentStation
|
||||
, int nextStation, boolean isArrived) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "MapMaker ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived);
|
||||
String currentStationName = null;
|
||||
String nextStationName = null;
|
||||
|
||||
boolean isArriveEndStation = false;
|
||||
boolean isArriveAtStation = false;
|
||||
boolean isArriveAtStartStation = false;
|
||||
|
||||
mLineName.setText(lineName);
|
||||
|
||||
// 获取当前站点的名称
|
||||
currentStationName = stationList.get(currentStation).getName();
|
||||
private void updateBusStationStatus(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
|
||||
startStation = stationList.get(0);
|
||||
endStation = stationList.get(stationList.size() - 1);
|
||||
|
||||
// 是否到达起点
|
||||
if (currentStation == 0) {
|
||||
isArriveAtStartStation = true;
|
||||
mCurrentTag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
|
||||
//切换路线和结束路线按钮切换
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived){
|
||||
showOrHideSwitchLineBtn(true);
|
||||
}else {
|
||||
showOrHideSwitchLineBtn(false);
|
||||
}
|
||||
|
||||
if (arrivingOrArrivedIndex == 0){
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
|
||||
isArriveAtStation = true;
|
||||
mCurrentTag.setText(getResources().getString(R.string.bus_arrive_to_current_tag));
|
||||
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_next_tag));
|
||||
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
|
||||
isArriveEndStation = true;
|
||||
nextStationName = "--";
|
||||
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
|
||||
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
|
||||
}else if (arrivingOrArrivedIndex == stationList.size() - 1){
|
||||
if (isArrived) {
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
@@ -201,47 +193,158 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取下一站点名称
|
||||
if (nextStation > currentStation && nextStation <= stationList.size() - 1) {
|
||||
nextStationName = stationList.get(nextStation).getName();
|
||||
}
|
||||
|
||||
// 是否到达终点
|
||||
if ( nextStation == stationList.size() - 1 || nextStation == -1) {
|
||||
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
|
||||
}else {
|
||||
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_next_tag));
|
||||
}
|
||||
|
||||
if (currentStation == 0 && isArrived){
|
||||
showOrHideSwitchLineBtn(true);
|
||||
}else {
|
||||
showOrHideSwitchLineBtn(false);
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}
|
||||
|
||||
// 重置滑动按钮文字
|
||||
if (isArriveEndStation) {
|
||||
if (arrivingOrArrivedIndex == stationList.size() -1 && isArrived) {
|
||||
showSlidePanle("单程结束");
|
||||
} else if (isArriveAtStartStation) {
|
||||
showSlidePanle("滑动出发");
|
||||
} else if (isArriveAtStation) {
|
||||
} else if (isArrived){
|
||||
showSlidePanle("滑动出发");
|
||||
}
|
||||
|
||||
mCurrentStationName.setText(currentStationName);
|
||||
mNextStationName.setText(nextStationName);
|
||||
if (stationList.size() > 2){ //只有两个站点
|
||||
updateMoreThanTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}else {
|
||||
updateTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}
|
||||
|
||||
updateBusTestBarInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 有两个以上站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private void updateMoreThanTwoStationsUI(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
secondStationItem.setStationTag("");
|
||||
thirdStationItem.setStationTag("");
|
||||
secondStationItem.setVisibility(View.VISIBLE);
|
||||
thirdStationItem.showOrHideStationArrowBg(false);
|
||||
|
||||
if (arrivingOrArrivedIndex == 0){
|
||||
firstStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_start));
|
||||
}
|
||||
if (arrivingOrArrivedIndex + 1 == stationList.size() - 1
|
||||
|| arrivingOrArrivedIndex + 2 == stationList.size() - 1){ //确认是否显示 "终"
|
||||
thirdStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_end));
|
||||
}
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived){
|
||||
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
|
||||
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(0).getName());
|
||||
secondStationItem.setStationName(stationList.get(1).getName());
|
||||
thirdStationItem.setStationName(stationList.get(2).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(1);
|
||||
secondStationItem.setStationPointBg(2);
|
||||
thirdStationItem.setStationPointBg(2);
|
||||
|
||||
firstStationItem.setStationArrowBg(2);
|
||||
secondStationItem.setStationArrowBg(2);
|
||||
|
||||
}else if (arrivingOrArrivedIndex == stationList.size() - 1){
|
||||
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
|
||||
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
|
||||
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -2).getName());
|
||||
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
|
||||
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(0);
|
||||
secondStationItem.setStationPointBg(0);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
if (isArrived){
|
||||
secondStationItem.setStationArrowBg(0);
|
||||
}else {
|
||||
secondStationItem.setStationArrowBg(1);
|
||||
}
|
||||
|
||||
}else {
|
||||
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
|
||||
secondStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
|
||||
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
|
||||
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
|
||||
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex + 1).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(0);
|
||||
secondStationItem.setStationPointBg(1);
|
||||
thirdStationItem.setStationPointBg(2);
|
||||
secondStationItem.setStationArrowBg(2);
|
||||
if (isArrived){
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
}else {
|
||||
firstStationItem.setStationArrowBg(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 只有两个站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private void updateTwoStationsUI(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
|
||||
secondStationItem.setVisibility(View.GONE);
|
||||
secondStationItem.showOrHideStationArrowBg(false);
|
||||
|
||||
firstStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_start));
|
||||
thirdStationItem.setStationTag(getResources().getString(R.string.bus_station_txt_tag_end));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(0).getName());
|
||||
thirdStationItem.setStationName(stationList.get(1).getName());
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived){//到站
|
||||
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
|
||||
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_arrived_station_name_text_color));
|
||||
firstStationItem.setStationPointBg(1);
|
||||
firstStationItem.setStationArrowBg(2);
|
||||
thirdStationItem.setStationPointBg(0);
|
||||
|
||||
}else {
|
||||
firstStationItem.setStationNameColor(getResources().getColor(R.color.bus_station_tag_txt_un_color));
|
||||
thirdStationItem.setStationNameColor(getResources().getColor(R.color.bus_line_station_color_selected));
|
||||
if (isArrived){ //到终点
|
||||
firstStationItem.setStationPointBg(0);
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
|
||||
}else { //到终点途中
|
||||
firstStationItem.setStationPointBg(0);
|
||||
firstStationItem.setStationArrowBg(1);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showOrHideSwitchLineBtn(boolean isShow) {
|
||||
if (isShow){//显示切换路线
|
||||
// mSwitchLine.setVisibility(View.VISIBLE);
|
||||
mSwitchLine.setTag(0);
|
||||
mSwitchLine.setText(getResources().getString(R.string.bus_switch_line_btn));
|
||||
}else {//显示结束路线
|
||||
// mSwitchLine.setVisibility(View.GONE);
|
||||
mSwitchLine.setTag(1);
|
||||
mSwitchLine.setText(getResources().getString(R.string.bus_close_line_btn));
|
||||
}
|
||||
@@ -307,12 +410,10 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
if (launch) {
|
||||
// 出车的时候重制站点状态
|
||||
mPresenter.queryBusRoutes();
|
||||
// tvOperationStatus.setText("收车");
|
||||
tvArrived.setVisibility(View.VISIBLE);
|
||||
showPanel();
|
||||
} else {
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
// tvOperationStatus.setText("出车");
|
||||
tvArrived.setVisibility(View.GONE);
|
||||
hideSlidePanel();
|
||||
hidPanel();
|
||||
@@ -410,7 +511,25 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
|
||||
startActivity(intent);
|
||||
}else {//结束路线
|
||||
mPresenter.resetCurrentLineStatus();
|
||||
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
|
||||
OCHCommitDialog closeLineConfirmDialog = builder
|
||||
.title(getString(R.string.bus_dialog_title))
|
||||
.tips(getString(R.string.bus_dialog_tips))
|
||||
.confirmStr(getString(R.string.bus_dialog_confirm))
|
||||
.cancelStr(getString(R.string.bus_dialog_cancel))
|
||||
.build(getContext());
|
||||
closeLineConfirmDialog.setClickListener(new OCHCommitDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
mPresenter.resetCurrentLineStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
|
||||
}
|
||||
});
|
||||
closeLineConfirmDialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -54,6 +55,7 @@ import com.mogo.och.bus.presenter.BusModelLoopManager;
|
||||
import com.mogo.och.bus.util.BusAnalyticsManager;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -429,20 +431,76 @@ public class BusOrderModel {
|
||||
|| data.getResult() == null
|
||||
|| data.getResult().getSites() == null
|
||||
|| data.getResult().getSites().isEmpty() ) {
|
||||
//当为空时,显示无绑定路线图
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据:空 " );
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.updateEmptyUi();
|
||||
}
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "获取到小巴路线数据: " + data );
|
||||
renderBusStationsStatus( data.getResult());
|
||||
updateBusStatus( data.getResult());
|
||||
}
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
// 重复请求小巴路线,直至成功
|
||||
queryBusStationDelay();
|
||||
//改为任务,为空不再去一直取
|
||||
// queryBusStationDelay();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新正在运行的任务UI
|
||||
* @param stations
|
||||
*/
|
||||
private void updateBusTaskStatus(List<BusStationBean> stations) {
|
||||
|
||||
int arrivingOrArrivedStationIndex = 0;//已经到站或者即将到站的索引呢
|
||||
|
||||
for (int i =0 ; i< stations.size(); i++){
|
||||
BusStationBean station = stations.get(i);
|
||||
|
||||
if (i == 0){ // 首发站 显示在最上面
|
||||
if (station.getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !station.isLeaving()){ //到达第一站
|
||||
arrivingOrArrivedStationIndex = i;
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
BusStationBean preStation = stations.get(i-1);
|
||||
if ((station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())
|
||||
|| (station.getDrivingStatus() == STATION_STATUS_ARRIVING
|
||||
&& preStation.isLeaving())){
|
||||
//到站未离开 | 即将到站 显示在最中间
|
||||
arrivingOrArrivedStationIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BusStationBean arrivingOrArrivedStation = stations.get(arrivingOrArrivedStationIndex);
|
||||
|
||||
String lineTime = DateTimeUtil.formatLongToString(
|
||||
busRoutesResult.getTaskTime(),
|
||||
DateTimeUtil.TAXI_HH_mm);
|
||||
|
||||
if (arrivingOrArrivedStationIndex == 0 ||
|
||||
arrivingOrArrivedStation.getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !arrivingOrArrivedStation.isLeaving()){
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.updateBusTaskStatus(busRoutesResult.getName(),lineTime,
|
||||
stationList,arrivingOrArrivedStationIndex,true);
|
||||
}
|
||||
}else {
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.updateBusTaskStatus(busRoutesResult.getName(),lineTime,
|
||||
stationList,arrivingOrArrivedStationIndex,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置路线站点状态--结束路线,当前路线恢复到始发站
|
||||
*/
|
||||
@@ -517,20 +575,21 @@ public class BusOrderModel {
|
||||
clientPkFileName = "sn"
|
||||
)
|
||||
private void leaveStationSuccess(BusRoutesResult result, boolean isRestart) {
|
||||
renderBusStationsStatus(result);
|
||||
// if (slidePannelHideCallback != null) {
|
||||
// slidePannelHideCallback.hideSlidePanel();
|
||||
// }
|
||||
|
||||
updateBusStatus(result);
|
||||
|
||||
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||
if (isRestart || CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
startAutopilot(isRestart);
|
||||
}
|
||||
|
||||
if (isGoingToNextStation) {
|
||||
// 为了避免恢复自动驾驶时重复的接口请求
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "欢迎乘坐’蘑菇车联‘无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
|
||||
}
|
||||
|
||||
@@ -546,10 +605,6 @@ public class BusOrderModel {
|
||||
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
|
||||
|
||||
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
// == CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
|
||||
// ToastUtils.showShort("自动驾驶状态为不可用!");
|
||||
// }
|
||||
AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
parameters.isSpeakVoice = !isRestart;
|
||||
parameters.routeID = busRoutesResult.getLineId();
|
||||
@@ -601,7 +656,7 @@ public class BusOrderModel {
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation success");
|
||||
if (!isRestart){
|
||||
renderArriveBusStation();
|
||||
arrivedBusStationSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,13 +672,16 @@ public class BusOrderModel {
|
||||
});
|
||||
}
|
||||
|
||||
private void renderArriveBusStation() {
|
||||
private void arrivedBusStationSuccess() {
|
||||
List<BusStationBean> site = busRoutesResult.getSites();
|
||||
if (site != null && site.size() > 0){
|
||||
backgroundCurrentStationIndex ++;
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.refreshBusStations(busRoutesResult.getName(),stationList, backgroundCurrentStationIndex
|
||||
, getNextStopStation(),true);
|
||||
String lineTime = DateTimeUtil.formatLongToString(
|
||||
busRoutesResult.getTaskTime(),
|
||||
DateTimeUtil.TAXI_HH_mm);
|
||||
refreshBusStationsCallback.updateBusTaskStatus(busRoutesResult.getName(),lineTime,
|
||||
stationList, backgroundCurrentStationIndex ,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -739,7 +797,6 @@ public class BusOrderModel {
|
||||
}else {
|
||||
ToastUtils.showShort("出车收车状态查询:"+failMsg);
|
||||
}
|
||||
// queryOperationStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -759,20 +816,21 @@ public class BusOrderModel {
|
||||
/**
|
||||
* 渲染站点信息
|
||||
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||
* 车机端展示 离开站为当前站点,前往站为下一站, 下一站到站后在置为当前站
|
||||
* 车机端展示 三站: 中间为即将到到达或者刚到达的站
|
||||
* @param result
|
||||
*/
|
||||
private void renderBusStationsStatus(BusRoutesResult result) {
|
||||
private void updateBusStatus(BusRoutesResult result) {
|
||||
if (result == null) return;
|
||||
busRoutesResult = result;
|
||||
List<BusStationBean> site = result.getSites();
|
||||
currentLineId = result.getLineId();
|
||||
stationList.clear();
|
||||
stationList.addAll( site );
|
||||
|
||||
for ( int i = 0; i < stationList.size(); i++ ) {
|
||||
BusStationBean s = stationList.get( i );
|
||||
|
||||
CallerLogger.INSTANCE.d( M_BUS + "renderBusStationsStatus--",
|
||||
CallerLogger.INSTANCE.d( M_BUS + "updateBusStationsStatus--",
|
||||
"Index="+ i+" ,name = "+s.getName()+" ,"+s.isLeaving()+","+s.getDrivingStatus());
|
||||
|
||||
// 是否正在开往下一站
|
||||
@@ -790,7 +848,7 @@ public class BusOrderModel {
|
||||
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG,
|
||||
"渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex
|
||||
+" isLeaving()="+currentStation.isLeaving());
|
||||
+" isLeaving()="+currentStation.isLeaving());
|
||||
|
||||
//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态
|
||||
// ,订单开始站下在始发站的状态流转有问题
|
||||
@@ -808,15 +866,13 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)");
|
||||
}
|
||||
|
||||
if (refreshBusStationsCallback != null){
|
||||
refreshBusStationsCallback.refreshBusStations(result.getName(),stationList
|
||||
, backgroundCurrentStationIndex, getNextStopStation(),!currentStation.isLeaving());
|
||||
}
|
||||
|
||||
if ( currentStation.isLeaving() && slidePannelHideCallback != null) {
|
||||
slidePannelHideCallback.hideSlidePanel();
|
||||
}
|
||||
|
||||
//更新bus路线面板
|
||||
updateBusTaskStatus(stationList);
|
||||
|
||||
//需放在currentStationIndex赋值之后
|
||||
BusTrajectoryManager.getInstance().syncTrajectoryInfo();
|
||||
}
|
||||
|
||||
@@ -123,20 +123,44 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void refreshBusStations(String lineName,List<BusStationBean> stationList
|
||||
// , int currentStation, int nextStation, boolean isArrived) {
|
||||
// mStationList.clear();
|
||||
// mStationList.addAll(stationList);
|
||||
// mCurrentStation = currentStation;
|
||||
//// functionDemoModeChange();
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
// if (mView != null) {
|
||||
// runOnUIThread(() -> mView.refreshBusStations(lineName,
|
||||
// stationList, currentStation, nextStation, isArrived));
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void refreshBusStations(String lineName,List<BusStationBean> stationList
|
||||
, int currentStation, int nextStation, boolean isArrived) {
|
||||
public void updateBusTaskStatus(String lineName,String lineTime,
|
||||
List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
mStationList.clear();
|
||||
mStationList.addAll(stationList);
|
||||
mCurrentStation = currentStation;
|
||||
// functionDemoModeChange();
|
||||
if (arrivingOrArrivedIndex == 0 || isArrived){
|
||||
mCurrentStation = arrivingOrArrivedIndex;
|
||||
}else {
|
||||
mCurrentStation = arrivingOrArrivedIndex -1;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
|
||||
if (mView != null) {
|
||||
runOnUIThread(() -> mView.refreshBusStations(lineName,
|
||||
stationList, currentStation, nextStation, isArrived));
|
||||
runOnUIThread(() -> mView.updateBusTaskStatus(lineName,lineTime,
|
||||
stationList, arrivingOrArrivedIndex, isArrived));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEmptyUi() {
|
||||
runOnUIThread(() -> mView.updateLineEmptyUI());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBusStationsMarkers() {
|
||||
runOnUIThread(() -> mView.clearBusStationsMarkers());
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.och.bus.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import com.mogo.och.bus.R
|
||||
import kotlinx.android.synthetic.main.bus_stations_common_item.view.*
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/15
|
||||
*/
|
||||
class BusStationCommonItem @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr){
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.bus_stations_common_item,this,true)
|
||||
}
|
||||
|
||||
fun setStationName(name: String){
|
||||
busStationNameTv.text = name
|
||||
}
|
||||
|
||||
fun setStationNameColor(color: Int){
|
||||
busStationNameTv.setTextColor(color)
|
||||
}
|
||||
|
||||
fun setStationPointBg(type: Int){ // 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
when(type){
|
||||
0 -> busCircleIv.setImageResource(R.drawable.icon_point_grey_bus)
|
||||
1 -> busCircleIv.setImageResource(R.drawable.icon_point_green_bus)
|
||||
2 -> busCircleIv.setImageResource(R.drawable.icon_point_blue_bus)
|
||||
}
|
||||
}
|
||||
|
||||
fun setStationArrowBg(type: Int){// 0:灰色 过站 1:绿色 前往下一站 2:蓝色 未到站
|
||||
when(type){
|
||||
0 -> busArrowBg.setImageResource(R.drawable.icon_arrow_grey_bus)
|
||||
1 -> busArrowBg.setImageResource(R.drawable.icon_arrow_green_bus)
|
||||
2 -> busArrowBg.setImageResource(R.drawable.icon_arrow_blue_bus)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setStationTag(tag: String){ // 0:起 1:终
|
||||
if (tag.isNullOrEmpty()){
|
||||
busTagTxt.visibility = GONE
|
||||
}else{
|
||||
busTagTxt.text = tag
|
||||
busTagTxt.visibility = VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun showOrHideStationArrowBg(isShow:Boolean){
|
||||
if (isShow){
|
||||
busArrowBg.visibility = VISIBLE
|
||||
}else{
|
||||
busArrowBg.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/bus_no_line_icon.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_arrow_blue_bus.png
Executable file
|
After Width: | Height: | Size: 377 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_arrow_green_bus.png
Executable file
|
After Width: | Height: | Size: 400 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_arrow_grey_bus.png
Executable file
|
After Width: | Height: | Size: 402 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_no_bus_line.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_point_blue_bus.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_point_green_bus.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1440/icon_point_grey_bus.png
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/bus_no_line_icon.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_arrow_blue_bus.png
Executable file
|
After Width: | Height: | Size: 377 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_arrow_green_bus.png
Executable file
|
After Width: | Height: | Size: 400 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_arrow_grey_bus.png
Executable file
|
After Width: | Height: | Size: 402 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_no_bus_line.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_point_blue_bus.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_point_green_bus.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi-2560x1600/icon_point_grey_bus.png
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/bus_no_line_icon.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_arrow_blue_bus.png
Executable file
|
After Width: | Height: | Size: 377 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_arrow_green_bus.png
Executable file
|
After Width: | Height: | Size: 400 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_arrow_grey_bus.png
Executable file
|
After Width: | Height: | Size: 402 B |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_no_bus_line.png
Executable file
|
After Width: | Height: | Size: 13 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_point_blue_bus.png
Executable file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_point_green_bus.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
OCH/mogo-och-bus/src/main/res/drawable-xhdpi/icon_point_grey_bus.png
Executable file
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_20"></corners>
|
||||
<solid android:color="@color/bus_task_time_bg_color"></solid>
|
||||
</shape>
|
||||
28
OCH/mogo-och-bus/src/main/res/layout/bus_no_line_view.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/no_line_data_view">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_line_data_iv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bus_no_line_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
<TextView
|
||||
android:id="@+id/no_order_data_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#CAD6FF"
|
||||
android:textSize="34px"
|
||||
android:layout_marginTop="34px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/no_line_data_iv"
|
||||
android:text="暂无服务订单"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<TextView
|
||||
android:id="@+id/busStationNameTv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/bus_arrived_station_name_text_color"
|
||||
android:includeFontPadding = "false"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="marquee"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:layout_marginRight="@dimen/dp_75"
|
||||
android:layout_marginLeft="@dimen/dp_54"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/busCircleIv"
|
||||
app:layout_constraintRight_toRightOf="@+id/busTagTxt"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/busCircleIv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_point_blue_bus"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/busStationNameTv"/>
|
||||
<ImageView
|
||||
android:id="@+id/busArrowBg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:src="@drawable/icon_arrow_blue_bus"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/busCircleIv"
|
||||
app:layout_constraintRight_toRightOf="@+id/busCircleIv"
|
||||
app:layout_constraintTop_toBottomOf="@+id/busCircleIv"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/busTagTxt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/bus_station_tag_txt_size"
|
||||
android:textColor="@color/bus_station_tag_txt_un_color"
|
||||
android:text="@string/bus_station_txt_tag_start"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/busCircleIv"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/busCircleIv"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_line_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_68"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
@@ -24,25 +24,23 @@
|
||||
android:textSize="38px"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/module_och_bus_tag"-->
|
||||
<!-- android:layout_width="@dimen/dp_109"-->
|
||||
<!-- android:layout_height="@dimen/dp_42"-->
|
||||
<!-- android:layout_gravity="right"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_10"-->
|
||||
<!-- android:layout_marginRight="@dimen/dp_60"-->
|
||||
<!-- android:background="@drawable/bus_panel_anchor_bkg"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="小巴车"-->
|
||||
<!-- android:textColor="#FFF"-->
|
||||
<!-- android:textSize="@dimen/module_mogo_och_autopilot_order_tag_height"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_line_name"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/module_och_bus_line_name" />-->
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/bus_task_time_tv"/>
|
||||
<TextView
|
||||
android:id="@+id/bus_task_time_tv"
|
||||
android:layout_width="200px"
|
||||
android:layout_height="42px"
|
||||
android:layout_marginRight="@dimen/dp_68"
|
||||
android:textColor="#FFF"
|
||||
android:text="--: --"
|
||||
android:textSize="28px"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bus_task_time_bg"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_line_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_line_name">
|
||||
|
||||
</TextView>
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
@@ -65,111 +63,63 @@
|
||||
app:layout_constraintRight_toRightOf="@+id/line1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="14px"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:text="当前站点:"
|
||||
android:textColor="#CAD6FF"
|
||||
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station"
|
||||
<com.mogo.och.bus.ui.BusStationCommonItem
|
||||
android:id="@+id/bus_panel_first_station"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_next_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:text="下一站:"
|
||||
android:textColor="#CAD6FF"
|
||||
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_order_end_station"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginLeft="@dimen/dp_68"
|
||||
app:layout_constraintRight_toRightOf="@+id/bus_task_time_tv"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/line2"/>
|
||||
<com.mogo.och.bus.ui.BusStationCommonItem
|
||||
android:id="@+id/bus_panel_second_station"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_goneMarginTop="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginRight="@dimen/dp_60"
|
||||
android:layout_marginBottom="@dimen/dp_30"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
app:layout_goneMarginBottom="@dimen/dp_40"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/switch_line_btn"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
|
||||
tools:text="后路站1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/greenDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginLeft="@dimen/dp_68"
|
||||
app:layout_constraintRight_toRightOf="@+id/bus_task_time_tv"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_panel_first_station"/>
|
||||
<com.mogo.och.bus.ui.BusStationCommonItem
|
||||
android:id="@+id/bus_panel_third_station"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14px"
|
||||
android:src="@drawable/bus_icon_arrived_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_line_name"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dotLine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bus_dot_line"
|
||||
app:layout_constraintBottom_toTopOf="@+id/blueDot"
|
||||
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/bus_icon_arriving_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
|
||||
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginLeft="@dimen/dp_68"
|
||||
app:layout_constraintRight_toRightOf="@+id/bus_task_time_tv"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_panel_second_station"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch_line_btn"
|
||||
android:layout_width="@dimen/bus_switch_line_btn_width_1"
|
||||
android:layout_height="@dimen/bus_switch_line_btn_height_1"
|
||||
android:layout_marginLeft="@dimen/dp_28"
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
app:layout_goneMarginTop="@dimen/dp_400"
|
||||
android:background="@drawable/bus_switch_line_btn"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_switch_line_btn"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_panel_third_station"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<include layout="@layout/bus_no_line_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_stations_panel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="module_och_bus_line_name,bus_task_time_tv,
|
||||
line1,line2,bus_panel_first_station,bus_panel_second_station,bus_panel_third_station"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -86,7 +86,7 @@
|
||||
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_m_t">30px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_width">618px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
|
||||
|
||||
|
||||
@@ -138,4 +138,5 @@
|
||||
<dimen name="bus_traffic_light_icon_size">154px</dimen>
|
||||
<dimen name="bus_traffic_light_time_view_width">130px</dimen>
|
||||
<dimen name="bus_traffic_light_time_size">60px</dimen>
|
||||
<dimen name="bus_station_tag_txt_size">27px</dimen>
|
||||
</resources>
|
||||
@@ -86,7 +86,7 @@
|
||||
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_order_m_t">30px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_width">618px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
|
||||
|
||||
|
||||
@@ -136,4 +136,5 @@
|
||||
<dimen name="bus_traffic_light_icon_size">154px</dimen>
|
||||
<dimen name="bus_traffic_light_time_view_width">130px</dimen>
|
||||
<dimen name="bus_traffic_light_time_size">60px</dimen>
|
||||
<dimen name="bus_station_tag_txt_size">27px</dimen>
|
||||
</resources>
|
||||
@@ -45,4 +45,8 @@
|
||||
<color name="bus_traffic_light_yellow_color_up">#FFFFE198</color>
|
||||
<color name="bus_traffic_light_yellow_color_down">#FFFF9B00</color>
|
||||
<color name="bus_arrived_btn_un_clickable_color">#59FFFFFF</color>
|
||||
|
||||
<color name="bus_station_tag_txt_un_color">#8E9DD4</color>
|
||||
<color name="bus_task_time_bg_color">#2B6EFF</color>
|
||||
<color name="bus_line_station_color_selected">#00FFF8</color>
|
||||
</resources>
|
||||
@@ -152,4 +152,6 @@
|
||||
<dimen name="bus_traffic_light_icon_size">154px</dimen>
|
||||
<dimen name="bus_traffic_light_time_view_width">130px</dimen>
|
||||
<dimen name="bus_traffic_light_time_size">60px</dimen>
|
||||
|
||||
<dimen name="bus_station_tag_txt_size">27px</dimen>
|
||||
</resources>
|
||||
@@ -26,4 +26,12 @@
|
||||
<string name="bus_arrive_to_next_tag">下一站:</string>
|
||||
<string name="bus_auto_disable_tip">自动驾驶状态为0不可用</string>
|
||||
<string name="bus_arrived_str">进站</string>
|
||||
<string name="bus_station_txt_tag_start">起</string>
|
||||
<string name="bus_station_txt_tag_end">终</string>
|
||||
<string name="bus_line_time_tag">班次:</string>
|
||||
|
||||
<string name="bus_dialog_title">提示</string>
|
||||
<string name="bus_dialog_tips">您确认要结束路线吗?</string>
|
||||
<string name="bus_dialog_confirm">确认</string>
|
||||
<string name="bus_dialog_cancel">取消</string>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
import com.mogo.och.common.module.R
|
||||
|
||||
/**
|
||||
* 带有title, tip,confirm,cancel的dialog
|
||||
*/
|
||||
class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
|
||||
|
||||
private var commonConfirm : TextView? = null
|
||||
private var commonCancel : TextView? = null
|
||||
private var commonTitle : TextView? = null
|
||||
private var commonTips : TextView? = null
|
||||
|
||||
private var clickListener: ClickListener? = null
|
||||
|
||||
constructor(builder: Builder,context: Context) : super(context) {
|
||||
commonTitle?.text = builder.titleStr
|
||||
commonTips?.text = builder.tipsStr
|
||||
commonCancel?.text = builder.cancelStr
|
||||
commonConfirm?.text = builder.confirmStr
|
||||
}
|
||||
|
||||
init{
|
||||
setContentView(R.layout.dialog_bus_commit)
|
||||
|
||||
setCanceledOnTouchOutside(true)
|
||||
|
||||
commonConfirm = findViewById(R.id.common_confirm)
|
||||
commonCancel = findViewById(R.id.common_cancel)
|
||||
commonTitle = findViewById(R.id.common_title)
|
||||
commonTips = findViewById(R.id.common_tips)
|
||||
|
||||
commonConfirm?.setOnClickListener{
|
||||
clickListener?.confirm()
|
||||
dismiss()
|
||||
}
|
||||
commonCancel?.setOnClickListener {
|
||||
clickListener?.cancel()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun setClickListener(clickListener: ClickListener) {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
fun showUpgradeDialog(){
|
||||
if(isShowing){
|
||||
return
|
||||
}
|
||||
show()
|
||||
}
|
||||
|
||||
interface ClickListener{
|
||||
fun confirm()
|
||||
fun cancel()
|
||||
}
|
||||
|
||||
class Builder{
|
||||
var titleStr:String = ""
|
||||
var tipsStr:String = ""
|
||||
var confirmStr:String = ""
|
||||
var cancelStr:String = ""
|
||||
|
||||
fun title(title: String) : Builder{
|
||||
this.titleStr = title
|
||||
return this
|
||||
}
|
||||
|
||||
fun tips(tips: String) : Builder{
|
||||
this.tipsStr = tips
|
||||
return this
|
||||
}
|
||||
|
||||
fun confirmStr(commit: String) : Builder{
|
||||
this.confirmStr = commit
|
||||
return this
|
||||
}
|
||||
|
||||
fun cancelStr(cancel: String) : Builder{
|
||||
this.cancelStr = cancel
|
||||
return this
|
||||
}
|
||||
|
||||
fun build(context: Context): OCHCommitDialog? {
|
||||
return OCHCommitDialog(this,context)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.mogo.och.common.module.wigets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.RectF;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.och.common.module.R;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/27 2:08 PM
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class OCHRoundConstraintLayout extends ConstraintLayout implements GestureDetector.OnGestureListener {
|
||||
|
||||
private float roundLayoutRadius = 14f;
|
||||
private Path roundPath;
|
||||
private RectF rectF;
|
||||
|
||||
// 上次滑动的坐标
|
||||
private int mLastXIntercept;
|
||||
private int mLastYIntercept;
|
||||
|
||||
private IScrollListener mScrollListener;
|
||||
|
||||
private GestureDetector mDetector;
|
||||
|
||||
public OCHRoundConstraintLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public OCHRoundConstraintLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
|
||||
roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
|
||||
typedArray.recycle();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public OCHRoundConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
|
||||
roundPath = new Path();
|
||||
rectF = new RectF();
|
||||
mDetector = new GestureDetector(getContext(), this);
|
||||
}
|
||||
|
||||
private void setRoundPath() {
|
||||
//添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行
|
||||
roundPath.reset();
|
||||
roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW);
|
||||
}
|
||||
|
||||
|
||||
public void setRoundLayoutRadius(float roundLayoutRadius) {
|
||||
this.roundLayoutRadius = roundLayoutRadius;
|
||||
setRoundPath();
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
public void setScrollListener(IScrollListener listener) {
|
||||
mScrollListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
super.onLayout(changed, l, t, r, b);
|
||||
rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight());
|
||||
setRoundPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (roundLayoutRadius > 0f) {
|
||||
canvas.clipPath(roundPath);
|
||||
}
|
||||
super.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
boolean intercepted = false;
|
||||
int x = (int) ev.getX();
|
||||
int y = (int) ev.getY();
|
||||
switch (ev.getAction()) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
int deltaX = x - mLastXIntercept;
|
||||
int deltaY = y - mLastYIntercept;
|
||||
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
||||
intercepted = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mLastXIntercept = x;
|
||||
mLastYIntercept = y;
|
||||
return intercepted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (mDetector != null) {
|
||||
return mDetector.onTouchEvent(event);
|
||||
} else {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDown(MotionEvent e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowPress(MotionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
if (e2 != null) {
|
||||
float deltaX = e2.getX() - (e1 != null ? e1.getX() : 0f);
|
||||
float deltaY = e2.getY() - (e1 != null ? e1.getY() : 0f);
|
||||
if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
||||
if (mScrollListener != null) {
|
||||
mScrollListener.onScroll(velocityX < 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public interface IScrollListener {
|
||||
void onScroll(boolean isNextPage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.common.module.wigets.OCHRoundConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="840px"
|
||||
android:layout_height="470px"
|
||||
android:background="@color/och_dialog_bg_color"
|
||||
app:roundLayoutRadius="32px">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/common_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:textSize="56px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:layout_marginTop="50px"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/common_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/common_title"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="43px"
|
||||
android:layout_marginTop="50px"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_horizontal_line"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2px"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/common_tips"
|
||||
android:layout_marginTop="80px"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/view_vertical_line"
|
||||
android:layout_width="3px"
|
||||
android:layout_height="0dp"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/common_confirm"
|
||||
android:layout_width="400px"
|
||||
android:layout_height="100px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="46px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/view_vertical_line"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/common_cancel"
|
||||
android:layout_width="400px"
|
||||
android:layout_height="100px"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="46px"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toBottomOf="@id/view_horizontal_line"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/view_vertical_line"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
</com.mogo.och.common.module.wigets.OCHRoundConstraintLayout>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="och_dialog_bg_color">#3B4577</color>
|
||||
</resources>
|
||||
16
OCH/mogo-och-common-module/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<declare-styleable name="RoundLayout">
|
||||
<attr name="roundLayoutRadius" format="dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="CustomCircleImageView">
|
||||
<attr name="civ_border_width" format="dimension" />
|
||||
<attr name="civ_border_color" format="color" />
|
||||
<attr name="civ_border_overlay" format="boolean" />
|
||||
<attr name="civ_fill_color" format="color" />
|
||||
</declare-styleable>
|
||||
|
||||
|
||||
</resources>
|
||||