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 @@
-
-
-
-
-
-
-
+ android:layout_width="@dimen/module_mogo_och_bus_station_panel_width"
+ android:layout_height="@dimen/module_mogo_och_bus_station_panel_height">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/module_mogo_och_bus_station_notice"
+ android:text="站点信息"
+ android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
+ android:textColor="#fff"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintTop_toTopOf="parent"/>
+
\ No newline at end of file
diff --git a/OCH/mogo-och-bus/src/main/res/values/dimens.xml b/OCH/mogo-och-bus/src/main/res/values/dimens.xml
new file mode 100644
index 0000000000..2a67585b14
--- /dev/null
+++ b/OCH/mogo-och-bus/src/main/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 24px
+ 464px
+ 310px
+
\ No newline at end of file
diff --git a/OCH/mogo-och/build.gradle b/OCH/mogo-och/build.gradle
index 33c33d627e..c39f87ffff 100644
--- a/OCH/mogo-och/build.gradle
+++ b/OCH/mogo-och/build.gradle
@@ -39,6 +39,18 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
+
+ implementation rootProject.ext.dependencies.androidxconstraintlayout
+
+ if (Boolean.valueOf(RELEASE)) {
+ implementation rootProject.ext.dependencies.mogoutils
+ implementation rootProject.ext.dependencies.mogocommons
+ implementation rootProject.ext.dependencies.modulecommon
+ } else {
+ implementation project(":foudations:mogo-utils")
+ implementation project(":foudations:mogo-commons")
+ implementation project(":modules:mogo-module-common")
+ }
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
\ No newline at end of file
diff --git a/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java
new file mode 100644
index 0000000000..b67939da70
--- /dev/null
+++ b/OCH/mogo-och/src/main/java/com/mogo/och/BaseOchFragment.java
@@ -0,0 +1,87 @@
+package com.mogo.och;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckedTextView;
+import android.widget.FrameLayout;
+import android.widget.TextView;
+
+import androidx.fragment.app.Fragment;
+
+import com.mogo.commons.mvp.IView;
+import com.mogo.commons.mvp.MvpFragment;
+import com.mogo.commons.mvp.Presenter;
+import com.mogo.och.view.SlidePanelView;
+
+/**
+ * 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
+ *
+ * @author tongchenfei
+ */
+public abstract class BaseOchFragment> extends MvpFragment {
+ private SlidePanelView slidePanelView;
+ private TextView tvNotice;
+ private CheckedTextView ctvAutopilotStatus;
+ private FrameLayout flStationPanelContainer;
+
+ private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
+ // 此处做一个代理,处理一下共有情况
+ hideSlidePanel();
+ hideNotice();
+ if (getSlidePanelOnEndListener() != null) {
+ getSlidePanelOnEndListener().moveToEnd();
+ }
+ };
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.module_mogo_och_base_fragment;
+ }
+
+ @Override
+ protected void initViews() {
+ slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
+ tvNotice = findViewById(R.id.module_mogo_och_notice);
+ ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
+ flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
+
+ LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
+ slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
+ }
+
+ public void showSlidePanle(String text) {
+ slidePanelView.setText(text);
+ slidePanelView.setVisibility(View.VISIBLE);
+ }
+
+ public void hideSlidePanel(){
+ slidePanelView.setVisibility(View.GONE);
+ }
+
+ public void showNotice(String notice) {
+ tvNotice.setText(notice);
+ tvNotice.setVisibility(View.VISIBLE);
+ }
+
+ public void hideNotice(){
+ tvNotice.setVisibility(View.GONE);
+ }
+
+ /**
+ * 改变自动驾驶状态
+ * @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中
+ */
+ public void onAutopilotStatusChanged(boolean isInAutopilot) {
+ ctvAutopilotStatus.setChecked(isInAutopilot);
+ }
+
+ public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener(){
+ return null;
+ }
+
+ /**
+ * 获取站点面板view,在{@link #initViews()}时候添加到container中
+ * @return 站点面板view
+ */
+ public abstract int getStationPanelViewId();
+}
diff --git a/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java b/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java
index 79d7cd9084..d93463dd99 100644
--- a/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java
+++ b/OCH/mogo-och/src/main/java/com/mogo/och/view/SlidePanelView.java
@@ -76,6 +76,8 @@ public class SlidePanelView extends View {
private String blockText = STRING_SLIDE_TO_RIGHT;
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
+ private static final int GRADIENT_OFFSET = 200;
+
public void setOnSlidePanelMoveToEndListener(OnSlidePanelMoveToEndListener moveToEndListener) {
this.moveToEndListener = moveToEndListener;
}
@@ -97,13 +99,13 @@ public class SlidePanelView extends View {
}
private void init() {
- bgPaint.setColor(Color.RED);
+ bgPaint.setColor(Color.parseColor("#CC0F1325"));
bgPaint.setStyle(Paint.Style.FILL);
textPaint.setStyle(Paint.Style.FILL);
textPaint.setTextSize(40);
textPaint.setTextAlign(Paint.Align.LEFT);
- textGradient = new LinearGradient(-80, 0, 0, 0, new int[]{0xffffffff, 0xff000000, 0xffffffff}, new float[]{0, 0.5f, 1f}, Shader.TileMode.CLAMP);
+ textGradient = new LinearGradient(-GRADIENT_OFFSET, 0, 0, 0, new int[]{0x33ffffff, 0xffffffff, 0x29ffffff}, new float[]{0, 0.5f, 1f}, Shader.TileMode.CLAMP);
textGradient.setLocalMatrix(gradientMatrix);
textPaint.setShader(textGradient);
textPaint.getFontMetrics(blockTextMetrics);
@@ -146,7 +148,7 @@ public class SlidePanelView extends View {
matrixAnim.cancel();
}
textOffset = (getHeight() - blockTextMetrics.ascent - blockTextMetrics.descent) / 2;
- matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + 80).setDuration(1000);
+ matrixAnim = ObjectAnimator.ofFloat(this, "matrixTranslate", 0, w + GRADIENT_OFFSET).setDuration(1000);
matrixAnim.setRepeatCount(ValueAnimator.INFINITE);
matrixAnim.start();
}
diff --git a/OCH/mogo-och/src/main/res/color/module_mogo_och_autopilot_text_color_selector.xml b/OCH/mogo-och/src/main/res/color/module_mogo_och_autopilot_text_color_selector.xml
new file mode 100644
index 0000000000..4cccf36d32
--- /dev/null
+++ b/OCH/mogo-och/src/main/res/color/module_mogo_och_autopilot_text_color_selector.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och/src/main/res/drawable/ic_block.png b/OCH/mogo-och/src/main/res/drawable-xhdpi/ic_block.png
similarity index 100%
rename from OCH/mogo-och/src/main/res/drawable/ic_block.png
rename to OCH/mogo-och/src/main/res/drawable-xhdpi/ic_block.png
diff --git a/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml
new file mode 100644
index 0000000000..84b729bc63
--- /dev/null
+++ b/OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml
new file mode 100644
index 0000000000..94f34cc808
--- /dev/null
+++ b/OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och/src/main/res/values/colors.xml b/OCH/mogo-och/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..8ef705b7ec
--- /dev/null
+++ b/OCH/mogo-och/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+
+
+ #B2FFFFFF
+ #FF52BBFF
+
\ No newline at end of file
diff --git a/OCH/mogo-och/src/main/res/values/dimens.xml b/OCH/mogo-och/src/main/res/values/dimens.xml
new file mode 100644
index 0000000000..ec5ee6b546
--- /dev/null
+++ b/OCH/mogo-och/src/main/res/values/dimens.xml
@@ -0,0 +1,23 @@
+
+
+
+ 37px
+ 40px
+ 40px
+ 24px
+
+ 362px
+ 492px
+
+ 24px
+ 120px
+ 120px
+
+ 20px
+ 25px
+ 12px
+
+ 460px
+ 30px
+
+
\ No newline at end of file
diff --git a/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/TencentHttpDns.java b/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/TencentHttpDns.java
index ea659d4f4b..542d3632dc 100644
--- a/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/TencentHttpDns.java
+++ b/foudations/httpdns-tencent/src/main/java/com/mogo/httpdns/tencent/TencentHttpDns.java
@@ -9,6 +9,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.httpdns.HttpDnsConst;
import com.mogo.httpdns.IHttpDnsCallback;
+import com.mogo.httpdns.IHttpDnsLocationChanged;
import com.mogo.httpdns.IHttpDnsTtlCallback;
import com.mogo.httpdns.IMogoHttpDns;
import com.mogo.utils.logger.Logger;
@@ -97,6 +98,11 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
}
}
+ @Override
+ public String syncGetHttpDns(String host, int type, boolean useCache) {
+ return null;
+ }
+
@Override
public void addHttpDnsTtlCallback( String host,int type, IHttpDnsTtlCallback callback ) {
HttpDnsIpsCache.addHttpDnsTtlCallback( host, callback );
@@ -107,6 +113,11 @@ class TencentHttpDns implements IMogoHttpDns, HttpDns {
HttpDnsIpsCache.removeHttpDnsTtlCallback( host );
}
+ @Override
+ public void init(Context context, IHttpDnsLocationChanged locationChanged) {
+
+ }
+
@Keep
@Override
public void init( Context context ) {