From 5e1961eb33fc8e02049ef955a60a1f7cef2f2418 Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Thu, 21 Jan 2021 15:45:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0BaseOchFragment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + .../mogo/och/bus/fragment/OchBusFragment.java | 111 +++++++++++------- .../src/main/res/layout/fragment_och_bus.xml | 52 ++------ .../src/main/res/values/dimens.xml | 7 ++ OCH/mogo-och/build.gradle | 12 ++ .../java/com/mogo/och/BaseOchFragment.java | 87 ++++++++++++++ .../com/mogo/och/view/SlidePanelView.java | 8 +- ...mogo_och_autopilot_text_color_selector.xml | 5 + .../{drawable => drawable-xhdpi}/ic_block.png | Bin .../module_mogo_och_autopilot_status_bg.xml | 10 ++ .../layout/module_mogo_och_base_fragment.xml | 69 +++++++++++ OCH/mogo-och/src/main/res/values/colors.xml | 5 + OCH/mogo-och/src/main/res/values/dimens.xml | 23 ++++ .../mogo/httpdns/tencent/TencentHttpDns.java | 11 ++ 14 files changed, 314 insertions(+), 87 deletions(-) create mode 100644 OCH/mogo-och-bus/src/main/res/values/dimens.xml create mode 100644 OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java create mode 100644 OCH/mogo-och/src/main/res/color/module_mogo_och_autopilot_text_color_selector.xml rename OCH/mogo-och/src/main/res/{drawable => drawable-xhdpi}/ic_block.png (100%) create mode 100644 OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml create mode 100644 OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml create mode 100644 OCH/mogo-och/src/main/res/values/colors.xml create mode 100644 OCH/mogo-och/src/main/res/values/dimens.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 771c1f74d7..740794bd48 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -89,6 +89,7 @@ diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java index dc92e704d8..00ca10e6c3 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/fragment/OchBusFragment.java @@ -1,5 +1,6 @@ package com.mogo.och.bus.fragment; +import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.TextView; @@ -10,9 +11,11 @@ import androidx.constraintlayout.widget.Group; import com.mogo.commons.mvp.MvpFragment; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.view.OnPreventFastClickListener; +import com.mogo.och.BaseOchFragment; import com.mogo.och.bus.R; import com.mogo.och.bus.bean.OchBusStation; import com.mogo.och.bus.presenter.OchBusPresenter; +import com.mogo.och.view.SlidePanelView; import com.mogo.service.adas.entity.AdasOCHData; import com.mogo.utils.logger.Logger; @@ -25,36 +28,36 @@ import java.util.List; * * @author tongchenfei */ -public class OchBusFragment extends MvpFragment { +public class OchBusFragment extends BaseOchFragment implements SlidePanelView.OnSlidePanelMoveToEndListener { private static final String TAG = "OchBusFragment"; private final List stationList = new ArrayList<>(); - private Button btnExecute; + private TextView tvNotice; - @Override - protected int getLayoutId() { - return R.layout.fragment_och_bus; - } - @Override protected void initViews() { - findViewById(R.id.btnEnterOchBus).setOnClickListener(new OnPreventFastClickListener() { - @Override - public void onClickImpl(View v) { - showOchBus(); - } + super.initViews(); +// findViewById(R.id.btnEnterOchBus).setOnClickListener(new OnPreventFastClickListener() { +// @Override +// public void onClickImpl(View v) { +// showOchBus(); +// } +// }); +// findViewById(R.id.btnArrive).setOnClickListener(view->{ +// mPresenter.onArriveAt(new AdasOCHData(10, nextStation.getLon(), nextStation.getLat())); +// }); +// btnExecute = findViewById(R.id.btnExecute); +// btnExecute.setOnClickListener(new OnPreventFastClickListener() { +// @Override +// public void onClickImpl(View v) { +// mPresenter.autoDriveToNextStation(); +// } +// }); + tvNotice = findViewById(R.id.module_mogo_och_bus_station_notice); + + tvNotice.setOnClickListener(view->{ + showSlidePanle("到达站点,乘客以下车"); }); - findViewById(R.id.btnArrive).setOnClickListener(view->{ - mPresenter.onArriveAt(new AdasOCHData(10, nextStation.getLon(), nextStation.getLat())); - }); - btnExecute = findViewById(R.id.btnExecute); - btnExecute.setOnClickListener(new OnPreventFastClickListener() { - @Override - public void onClickImpl(View v) { - mPresenter.autoDriveToNextStation(); - } - }); - tvNotice = findViewById(R.id.vBusRoute); } @NonNull @@ -66,7 +69,7 @@ public class OchBusFragment extends MvpFragment public void showOchBus() { MogoApisHandler.getInstance().getApis().getTopViewManager().removeAllViewInVrMode(); - tvNotice.setVisibility(View.VISIBLE); +// tvNotice.setVisibility(View.VISIBLE); } @Override @@ -98,32 +101,32 @@ public class OchBusFragment extends MvpFragment // todo 渲染小巴路线数据 stationList.clear(); stationList.addAll(busStationList); - for (int i = 0; i < stationList.size(); i++) { - OchBusStation station = stationList.get(i); - if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_LEAVING) { - tvNotice.setText("正在从 " + i + "站驶向" + (i + 1) + "站"); - nextStation = stationList.get(i + 1); - btnExecute.setVisibility(View.GONE); - break; - } else if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_STOPED) { - tvNotice.setText("车辆正停在" + i + "站"); - btnExecute.setVisibility(View.VISIBLE); - if (i == stationList.size() - 1) { - btnExecute.setText("单程结束"); - }else if(i == 0){ - btnExecute.setText("准备出发"); - }else{ - btnExecute.setText("乘客已上车,准备出发"); - } - break; - } - } +// for (int i = 0; i < stationList.size(); i++) { +// OchBusStation station = stationList.get(i); +// if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_LEAVING) { +// tvNotice.setText("正在从 " + i + "站驶向" + (i + 1) + "站"); +// nextStation = stationList.get(i + 1); +// btnExecute.setVisibility(View.GONE); +// break; +// } else if (station.getIsCurrentSite() == OchBusPresenter.STATION_STATUS_STOPED) { +// tvNotice.setText("车辆正停在" + i + "站"); +// btnExecute.setVisibility(View.VISIBLE); +// if (i == stationList.size() - 1) { +// btnExecute.setText("单程结束"); +// }else if(i == 0){ +// btnExecute.setText("准备出发"); +// }else{ +// btnExecute.setText("乘客已上车,准备出发"); +// } +// break; +// } +// } } }); } public void hideOchBus() { - tvNotice.setVisibility(View.GONE); +// tvNotice.setVisibility(View.GONE); } private void queryStationListIfNecessary() { @@ -131,4 +134,22 @@ public class OchBusFragment extends MvpFragment mPresenter.queryBusRoutes(); } } + + @Override + public int getStationPanelViewId() { + return R.layout.fragment_och_bus; + } + + @Override + public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() { + return this; + } + + private boolean isInAutopilot; + + @Override + public void moveToEnd() { + onAutopilotStatusChanged(isInAutopilot); + isInAutopilot = !isInAutopilot; + } } diff --git a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml index 5801c68cfe..0e51a45408 100644 --- a/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml +++ b/OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml @@ -1,45 +1,19 @@ - - -