Merge branch 'dev_robotaxi-d-app-module_290_220715_2.9.0' into 'dev_robotaxi-d-app-module_282_220707_2.8.2'

# Conflicts:
#   core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt
#   core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt
This commit is contained in:
pangfan
2022-07-25 09:38:11 +00:00
330 changed files with 6283 additions and 1849 deletions

BIN
OCH/mogo-och-bus-passenger/src/main/assets/map_style.data Normal file → Executable file

Binary file not shown.

Binary file not shown.

View File

@@ -11,7 +11,8 @@ import mogo.telematics.pad.MessagePad;
* Created on 2022/3/31
*/
public interface IBusPassengerAutopilotPlanningCallback {
void routeResult(List<LatLng> models);
void routeResult(List<LatLng> models,int haveArrivedIndex);
void routePlanningToNextStationChanged(long meters, long timeInSecond);
void setLineMarker(List<LatLng> models);
void updateTotalDistance();
}

View File

@@ -41,5 +41,8 @@ class BusPassengerConst {
//bus平均速度
const val BUS_AVERAGE_SPEED = 25
// 订单总里程
const val BUS_SP_KEY_ORDER_SUM_DIS = "BUS_SP_KEY_ORDER_SUM_DIS"
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
@@ -304,16 +305,12 @@ public class BusPassengerModel {
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "state = %s", state );
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
// TODO: 2022/3/31
//2022.7.20 自动驾驶更换成带档位的
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
// TODO: 2022/3/31
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
// TODO: 2022/3/31
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
}
}
@@ -369,6 +366,13 @@ public class BusPassengerModel {
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjListCommon(mContext,routePoints);
mRoutePoints.addAll(latLngModels);
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mRoutePoints);
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.updateTotalDistance();
}
}
public void dynamicCalculateRouteInfo() {
@@ -388,7 +392,6 @@ public class BusPassengerModel {
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
}
}
public void startRemainRouteInfo() {
@@ -414,10 +417,12 @@ public class BusPassengerModel {
public void loopRouteAndWipe() {
if (mRoutePoints != null && mRoutePoints.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
int haveArrivedIndex = CoordinateCalculateRouteUtil
.getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude);
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = "+ Thread.currentThread().getName()+" haveArrivedIndex== " + haveArrivedIndex);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResult(lastPoints);
mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex);
}
}
}
@@ -440,7 +445,6 @@ public class BusPassengerModel {
if (isStart) {
BusPassengerModelLoopManager.getInstance().startCalculateRouteInfoLoop();
} else {
mRoutePoints.clear();
BusPassengerModelLoopManager.getInstance().stopCalculateRouteInfLoop();
}
}

View File

@@ -6,8 +6,12 @@ import com.mogo.och.bus.passenger.model.BusPassengerModel;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
@@ -24,8 +28,6 @@ public class BusPassengerModelLoopManager {
private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName();
private Disposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
private static final class SingletonHolder {
private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager();
}
@@ -35,27 +37,40 @@ public class BusPassengerModelLoopManager {
}
private Disposable mHeartbeatDisposable; //心跳轮询
private Disposable mRouteWipeDisposable; //轨迹擦除
private CompositeDisposable mRouteWipeDisposable = new CompositeDisposable();
private CompositeDisposable mCalculateRouteDisposable = new CompositeDisposable(); //每隔2s计算一次剩余里程和时间
public void startOrStopRouteAndWipe() {
if (mRouteWipeDisposable != null && !mRouteWipeDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startOrStopRouteWipe()");
mRouteWipeDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
})
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
.delay(LOOP_LINE_1S, TimeUnit.MILLISECONDS, true) // 设置delayError为true表示出现错误的时候也需要延迟5s进行通知达到无论是请求正常还是请求失败都是5s后重新订阅即重新请求。
.subscribeOn(Schedulers.io())
.repeat() // repeat保证请求成功后能够重新订阅。
.retry() // retry保证请求失败后能重新订阅
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().loopRouteAndWipe());
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
}
});
mRouteWipeDisposable.add(disposable);
}
public void stopOrStopRouteAndWipe() {
if (mRouteWipeDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "stopOrStopRouteWipe()");
mRouteWipeDisposable.dispose();
mRouteWipeDisposable = null;
}
if (mRouteWipeDisposable != null) mRouteWipeDisposable.dispose();
}
public void startQueryDriverLineLoop() {
@@ -80,23 +95,60 @@ public class BusPassengerModelLoopManager {
}
public void startCalculateRouteInfoLoop() {
if (mCalculateRouteDisposable != null && !mCalculateRouteDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startCalculateRouteInfoLoop()");
mCalculateRouteDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
if (mCalculateRouteDisposable == null){
mCalculateRouteDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopCalculateRouteInfo()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
})
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
.delay(LOOP_LINE_2S, TimeUnit.MILLISECONDS, true) // 设置delayError为true表示出现错误的时候也需要延迟5s进行通知达到无论是请求正常还是请求失败都是5s后重新订阅即重新请求。
.subscribeOn(Schedulers.io())
.repeat() // repeat保证请求成功后能够重新订阅。
.retry() // retry保证请求失败后能重新订阅
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().dynamicCalculateRouteInfo());
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
}
});
mCalculateRouteDisposable.add(disposable);
}
public void stopCalculateRouteInfLoop() {
if (mCalculateRouteDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "stopCalculateRouteInfLoop()");
mCalculateRouteDisposable.dispose();
mCalculateRouteDisposable = null;
}
}
private Observable<Integer> startLoopRouteAndWipe(){
return Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
if (emitter.isDisposed()) return;
BusPassengerModel.getInstance().loopRouteAndWipe();
emitter.onComplete();
}
});
}
private Observable<Integer> startLoopCalculateRouteInfo(){
return Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
if (emitter.isDisposed()) return;
BusPassengerModel.getInstance().dynamicCalculateRouteInfo();
emitter.onComplete();
}
});
}
}

View File

@@ -82,7 +82,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
@Override
public void onAutopilotArriveEnd() {
mView.showOverviewFragment();
}
@Override
@@ -136,8 +136,8 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
}
@Override
public void routeResult(List<LatLng> models) {
runOnUIThread(() -> mView.routeResult(models));
public void routeResult(List<LatLng> models, int haveArrivedIndex) {
runOnUIThread(() -> mView.routeResult(models,haveArrivedIndex));
}
@Override
@@ -149,4 +149,9 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
public void setLineMarker(List<LatLng> models) {
runOnUIThread(() -> mView.setLineMarker(models));
}
@Override
public void updateTotalDistance() {
runOnUIThread(() -> mView.setProgressBarMax());
}
}

View File

@@ -3,17 +3,24 @@ package com.mogo.och.bus.passenger.ui;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.widget.ContentLoadingProgressBar;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.common.module.utils.NumberFormatUtil;
/**
@@ -29,7 +36,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
private TextView mCurrentArriveTip;
private ImageView mAutopilotIv;
private FrameLayout flContainer;
private ContentLoadingProgressBar mProgressBar;
/**
* 改变自动驾驶状态
@@ -59,7 +66,17 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mCurrentArriveTip = findViewById(R.id.bus_p_cur_station_tip);
mAutopilotIv = findViewById(R.id.bus_p_autopilot_iv);
mProgressBar = findViewById(R.id.bus_progress_bar);
showRouteFragment();
// mCurrentArriveStation.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View v) {
// showOverviewFragment();
// return false;
// }
// });
}
@Override
@@ -103,6 +120,9 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
}
public void updateRoutePlanningToNextStation(long meters, long timeInSecond){
//更新进度条
updateProgressBar(meters);
String dis = "0";
String disUnit = "公里";
if (meters > 0){
@@ -119,6 +139,19 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mCurrentArriveTip.setText(Html.fromHtml(strHtml2));
}
private void updateProgressBar(long meters) {
int haveDriven = new Long(meters).intValue();
int progressInt = SharedPrefsMgr.getInstance(getContext())
.getInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,0) - haveDriven;
mProgressBar.setProgress(progressInt);
}
public void setProgressBarMax(){
int max = SharedPrefsMgr.getInstance(getContext())
.getInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,0);
mProgressBar.setMax(max);
}
public void onAutopilotStatusChanged(int status) {
getActivity().runOnUiThread(() -> {
// 3. 其他过程直接更新
@@ -139,4 +172,14 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
}
}
public void showOverviewFragment() {
CallerHmiManager.INSTANCE.showSmallFragment();
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerHmiManager.INSTANCE.hideSmallFragment();
}
},5000L);
}
}

View File

@@ -16,6 +16,7 @@ import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptor;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.CustomMapStyleOptions;
@@ -63,7 +64,10 @@ public class BusPassengerMapDirectionView
private CameraUpdate mCameraUpdate;
private Context mContext;
private List<Integer> colorList = new ArrayList<>();
List<BitmapDescriptor> textureList = new ArrayList<>();
List<Integer> texIndexList = new ArrayList<>();
private int mHaveArrivedIndex = 0;
private List<Marker> mLineMarkers = new ArrayList<>();
private IBusPassengerMapViewCallback mIBusPassengerMapViewCallback;
@@ -217,17 +221,18 @@ public class BusPassengerMapDirectionView
}
if (mAMap != null) {
addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
//设置线段纹理
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.addAll(mCoordinatesLatLng);
polylineOptions.colorValues(colorList);
polylineOptions.useGradient(true);
polylineOptions.width(10); //线段宽度
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
polylineOptions.setCustomTextureList(textureList);
polylineOptions.setCustomTextureIndex(texIndexList);
// polylineOptions.colorValues(colorList);
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
@@ -240,8 +245,15 @@ public class BusPassengerMapDirectionView
* 添加画线颜色值
*/
private void addRouteColorList() {
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
colorList.add(Color.argb(255, 70, 147, 253));//路线颜色
textureList.clear();
texIndexList.clear();
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mHaveArrivedIndex){
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived));
}else {
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive));
}
texIndexList.add(i);
}
}
@@ -314,6 +326,13 @@ public class BusPassengerMapDirectionView
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs,int haveArrivedIndex) {
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
mHaveArrivedIndex = haveArrivedIndex;
addRouteColorList();
}
public void clearLineMarkers(){
for (int i =0; i< mLineMarkers.size();i++){
mLineMarkers.get(i).setVisible(false);

View File

@@ -17,10 +17,12 @@ import com.amap.api.maps.model.LatLng;
import com.elegant.utils.UiThreadHandler;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.adapter.BusPassengerLineStationsAdapter;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassengerMapViewCallback;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
@@ -139,10 +141,10 @@ public class BusPassengerRouteFragment extends
}
}
public void routeResult(List<LatLng> latLngList) {
public void routeResult(List<LatLng> latLngList,int haveArrivedIndex) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "routeResult:" + latLngList.size());
if (latLngList.size() > 0) {
drawablePolyline(latLngList);
drawablePolyline(latLngList,haveArrivedIndex);
} else {
clearPolyline();
}
@@ -169,9 +171,9 @@ public class BusPassengerRouteFragment extends
*
* @param coordinates
*/
private void drawablePolyline(List<LatLng> coordinates) {
private void drawablePolyline(List<LatLng> coordinates,int haveArrivedIndex) {
if (mMapDirectionView != null) {
mMapDirectionView.setCoordinatesLatLng(coordinates);
mMapDirectionView.setCoordinatesLatLng(coordinates,haveArrivedIndex);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
@@ -245,6 +247,8 @@ public class BusPassengerRouteFragment extends
}
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
SharedPrefsMgr.getInstance(getContext())
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
clearPolyline();
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:startColor="#D8E4FF"
android:endColor="#D8E4FF"
android:type="linear"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_10" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/progress_item_round"
android:scaleWidth="100%" />
</item>
</layer-list>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="@dimen/dp_60"
android:bottomRightRadius="@dimen/dp_30"
android:topRightRadius="@dimen/dp_30"/>
<gradient
android:angle="0"
android:endColor="#009EFF"
android:startColor="#4D006AFF"
android:type="linear" />
</shape>

View File

@@ -28,69 +28,100 @@
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/iv_bg"
android:layout_width="@dimen/bus_p_curent_station_panel_width"
android:layout_height="@dimen/bus_p_curent_station_panel_height"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin_left"
android:layout_marginBottom="@dimen/bus_p_curent_station_panel_margin"
app:bgColor="@android:color/transparent"
app:blurRadius="@dimen/dp_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:bgColor="@color/bus_p_panel_cur_station_panel_color"
app:blurRadius="@dimen/dp_12"
app:shadowRadius="@dimen/dp_20"
app:shadowColor="@color/bus_p_panel_edge_shadow"
app:shadowRadius="@dimen/dp_30"
app:xOffset="0px"
app:yOffset="0px">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/bus_p_curent_station_panel_width"
android:layout_height="@dimen/bus_p_curent_station_panel_height"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/bus_p_panel_cur_station_panel">
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_28"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_title"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="@dimen/bus_p_curent_station_txt_width"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:elevation="@dimen/dp_10"
android:ellipsize="end"
android:maxLines="1"
android:text="-- --"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@+id/bus_p_cur_station_name"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_cur_station_name"
app:layout_constraintRight_toLeftOf="@+id/bus_p_cur_station_name"
android:layout_marginRight="@dimen/dp_10"
android:src="@drawable/station_arrow">
</androidx.appcompat.widget.AppCompatImageView>
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_arrived_tip"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name" />
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/bus_progress_bar"
android:layout_width="0dp"
android:layout_height="@dimen/dp_10"
android:progress="0"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_15"
app:layout_constraintRight_toRightOf="parent"
android:progressDrawable="@drawable/bus_progress_bar_bg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_27"
android:layout_marginTop="@dimen/dp_50"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_title"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size"
app:layout_constraintLeft_toLeftOf="@+id/iv_bg"
app:layout_constraintTop_toTopOf="@+id/iv_bg" />
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="@dimen/bus_p_curent_station_txt_width"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
android:text="-- --"
android:maxLines="1"
android:ellipsize="end"
android:elevation="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/bus_p_cur_station_arrived_tip"
android:elevation="@dimen/dp_10"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name" />
<FrameLayout
android:id="@+id/bus_p_route_panel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -98,6 +129,6 @@
android:layout_marginBottom="@dimen/dp_48"
android:src="@drawable/bus_p_mogo_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel"/>
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -47,10 +47,10 @@
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
<dimen name="bus_p_curent_station_panel_width">685px</dimen>
<dimen name="bus_p_curent_station_panel_height">309px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">38px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">10px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>

View File

@@ -51,7 +51,7 @@
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
<dimen name="bus_p_curent_station_panel_margin">38px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">38px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">10px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>

View File

@@ -61,12 +61,14 @@ dependencies {
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -22,6 +22,11 @@ public class BusRoutesResult {
public String txtFileMd5 = ""; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel = ""; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url默认“”
public String csvFileMd5DPQP = ""; //轨迹文件md5默认“”
public String txtFileUrlDPQP = ""; //打点文件下载的cos url默认“”
public String txtFileMd5DPQP = ""; //轨迹文件md5默认“”
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public int getLineId() {
return lineId;
@@ -54,6 +59,11 @@ public class BusRoutesResult {
", txtFileMd5='" + txtFileMd5 + '\'' +
", contrailSaveTime=" + contrailSaveTime +
", carModel='" + carModel + '\'' +
", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' +
", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' +
", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' +
", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' +
", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP +
'}';
}
}

View File

@@ -9,5 +9,5 @@ import java.util.List;
* @date: 2021/10/22
*/
public interface IRefreshBusStationsCallback {
void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
void refreshBusStations(String lineName,List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
}

View File

@@ -32,6 +32,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -76,7 +77,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private FrameLayout flStationPanelContainer;
private Group groupTestPanel;
private FrameLayout flSpeed;
private BusArcView mouduleArc;
// private BusArcView mouduleArc;
private TrafficDataView mTrafficDataView;
private ImageView mUpgradeTipIv;
// private BusTrafficLightView mTrafficLightView;
@@ -122,7 +124,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
mouduleArc = (BusArcView) findViewById(R.id.bus_arc);
mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
@@ -150,8 +152,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
if (DebugConfig.isDebug()) {
mouduleArc.setLongClickable(true);
mouduleArc.setOnLongClickListener(v -> {
mTrafficDataView.setLongClickable(true);
mTrafficDataView.setOnLongClickListener(v -> {
CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
@@ -207,17 +209,18 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_iv);
// CallerHmiManager.INSTANCE.registerBadCaseCallback(
// () -> { // onShow()
// return mBadcaseBtn; },
// () -> { // onHide()
// return null; });
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
}
mAISelectBtn = findViewById(R.id.module_mogo_och_ai_collet_iv);
if (mAISelectBtn != null){
CallerDevaToolsManager.INSTANCE.initAiCollect(mAISelectBtn);
}
}
private void updateSwitchMapIcon(){
@@ -254,6 +257,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
/**
* 测试到站
*/
@@ -481,9 +485,9 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
*/
public void updateSpeedView(float newSpeed) {
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
mouduleArc.setValues(speed);
flSpeed.setBackgroundResource(speed > 60 ? R.drawable.bus_yi_biao_pan_bg_speeding : R.drawable.bus_yi_biao_pan_bg_nor);
if (mTrafficDataView != null){
mTrafficDataView.updateSpeedWithValue(speed);
}
}
@Override
@@ -523,6 +527,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private TextView lineIdTV;
private TextView trajMd5TV;
private TextView stopMd5TV;
private TextView trajMd5DPQPTV;
private TextView stopMd5DPQPTV;
public void showHideTestBar() {
if (busTestBar == null) {
@@ -530,6 +536,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id);
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5);
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5);
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp);
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp);
}
if (busTestBar.getVisibility() == View.VISIBLE) {
@@ -539,6 +547,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
busTestBar.setVisibility(View.VISIBLE);
}
}
@@ -549,6 +559,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
}
}
/**

View File

@@ -26,6 +26,7 @@ import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.presenter.BusPresenter;
import com.mogo.och.bus.ui.BusSwitchLineActivity;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import java.util.List;
@@ -42,11 +43,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
private static final String TAG = "BusFragment";
private TextView mCurrentStationName;
private TextView mStartStationFlag;
private TextView mNextStationName;
private TextView mEndStationFlag;
// private TextView mDebugArrive;
private TextView mCurrentTag;
private TextView mNextTag;
private TextView mSwitchLine; //切换路线
private TextView mLineName;
private int mCurrentStation = 0;
private View mBus;
@@ -64,11 +65,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
super.initViews();
mBus = findViewById(R.id.module_och_bus_tag);
mCurrentStationName = findViewById(R.id.module_och_bus_current_station);
mStartStationFlag = findViewById(R.id.module_och_bus_start_station_tag);
mCurrentTag = findViewById(R.id.module_och_bus_current_station_anchor);
mNextStationName = findViewById(R.id.module_och_bus_order_end_station);
mEndStationFlag = findViewById(R.id.module_och_bus_end_station_tag);
mNextTag = findViewById(R.id.module_och_bus_next_station_anchor);
mSwitchLine = findViewById(R.id.switch_line_btn);
// mDebugArrive = findViewById(R.id.module_och_bus_arrive_station);
mLineName = findViewById(R.id.module_och_bus_line_name);
if (DebugConfig.isDebug()) {
mBus.setOnClickListener(view -> {
@@ -76,10 +77,6 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
mPresenter.queryBusRoutes();
});
// mBus.setOnLongClickListener(view -> {
// getActivity().finish();
// return true;
// });
//debug下调用测试面板
mCurrentStationName.setOnLongClickListener(v -> {
debugTestBar();
@@ -132,7 +129,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
* @param nextStation 下个站点
* @param isArrived 是否都站
*/
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
public void refreshBusStations(String lineName,List<BusStationBean> stationList
, int currentStation, int nextStation, boolean isArrived) {
mCurrentStation = currentStation;
if (getActivity() == null) {
return;
@@ -144,25 +142,25 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
}
// 渲染小巴路线数据
renderCurrentStationStatus(stationList, currentStation, nextStation, isArrived);
renderCurrentStationStatus(lineName,stationList, currentStation, nextStation, isArrived);
});
}
/**
* 重新刷新站点信息 isArrived 是否到站
*/
private void renderCurrentStationStatus(List<BusStationBean> stationList, int currentStation
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;
int startStationFlagVisibility = View.INVISIBLE;
int endStationFlagVisibility = View.INVISIBLE;
boolean isArriveEndStation = false;
boolean isArriveAtStation = false;
boolean isArriveAtStartStation = false;
mLineName.setText(lineName);
// 获取当前站点的名称
currentStationName = stationList.get(currentStation).getName();
@@ -171,9 +169,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
// 是否到达起点
if (currentStation == 0) {
startStationFlagVisibility = View.VISIBLE;
isArriveAtStartStation = true;
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
mCurrentTag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
@@ -181,6 +178,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
, 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);
@@ -189,9 +188,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
isArriveEndStation = true;
nextStationName = "--";
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
startStationFlagVisibility = View.VISIBLE;
endStationFlagVisibility = View.INVISIBLE;
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);
@@ -211,8 +208,16 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
}
// 是否到达终点
if (nextStation == stationList.size() - 1) {
endStationFlagVisibility = View.VISIBLE;
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);
}
// 重置滑动按钮文字
@@ -226,12 +231,17 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
mCurrentStationName.setText(currentStationName);
mNextStationName.setText(nextStationName);
mStartStationFlag.setVisibility(startStationFlagVisibility);
mEndStationFlag.setVisibility(endStationFlagVisibility);
updateBusTestBarInfo();
}
private void showOrHideSwitchLineBtn(boolean isShow) {
if (isShow){
mSwitchLine.setVisibility(View.VISIBLE);
}else {
mSwitchLine.setVisibility(View.GONE);
}
}
public void hideOchBus() {
// tvNotice.setVisibility(View.GONE);
}
@@ -328,27 +338,43 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
Runnable setMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
}else {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
Runnable removeMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
}
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}
@@ -374,5 +400,4 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
startActivity(intent);
}
}
}

View File

@@ -11,6 +11,7 @@ import android.location.Location;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -79,7 +80,6 @@ import mogo.telematics.pad.MessagePad;
public class BusOrderModel {
private final String TAG = BusOrderModel.class.getSimpleName();
private int currentLineId = -1;
private int currentStationIndex = 0; //因为服务端和前台对于当前站不一致所以设置两个current index 一个用于前台展示, 一个用于服务端接口请求
private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引
/**
* 运营状态、后端更具运营状态来判断车辆是否派单
@@ -246,12 +246,12 @@ public class BusOrderModel {
* 上报订单全路径规划数据
*/
public void updateOrderRoute() {
if (!isGoingToNextStation || currentStationIndex >= stationList.size() || currentStationIndex-1 < 0 || points.size() == 0){
if (!isGoingToNextStation || backgroundCurrentStationIndex+1 >= stationList.size() || points.size() == 0){
return;
}
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
BusServiceManager.getInstance().updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
, nextStation.getSiteId(), points, new IBusServiceCallback<BaseData>() {
@@ -446,11 +446,10 @@ public class BusOrderModel {
if (!isOneWayOver){
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
//需要更改当前站和下一站的状态 然后渲染
RenderLeaveStationSuccess(o.getResult(),isRestart);
leaveStationSuccess(o.getResult(),isRestart);
}else {
CallerLogger.INSTANCE.d( M_BUS + TAG, "单程真的结束了====" );
isGoingToNextStation = false;
currentStationIndex = 0;
backgroundCurrentStationIndex = 0;
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
queryBusRoutes();
@@ -480,7 +479,7 @@ public class BusOrderModel {
paramIndexes = {0},
clientPkFileName = "sn"
)
private void RenderLeaveStationSuccess(BusRoutesResult result, boolean isRestart) {
private void leaveStationSuccess(BusRoutesResult result, boolean isRestart) {
renderBusStationsStatus(result);
if (slidePannelHideCallback != null) {
slidePannelHideCallback.hideSlidePanel();
@@ -500,8 +499,8 @@ public class BusOrderModel {
* @param isRestart
*/
private void startAutopilot(boolean isRestart) {
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
// == CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
@@ -523,7 +522,10 @@ public class BusOrderModel {
busRoutesResult.getLineId(),
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
busRoutesResult.contrailSaveTime, busRoutesResult.carModel);
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
busRoutesResult.contrailSaveTimeDPQP);
}
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+" startLatLon="+currentStation.getName()+"endLatLon="+nextStation.getName());
@@ -540,9 +542,14 @@ public class BusOrderModel {
* 到站后重置站点状态
*/
private void arriveSiteStation(boolean isRestart) {
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+currentStationIndex);
int arrivedStationIndex = 0;
if (!isRestart){
arrivedStationIndex = backgroundCurrentStationIndex + 1;
}
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex);
BusServiceManager.getInstance().arriveSiteStation(mContext
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
, stationList.get(arrivedStationIndex).getSeq(), stationList.get(arrivedStationIndex).getSiteId()
, new IBusServiceCallback<BaseData>() {
@Override
public void onSuccess(BaseData o) {
@@ -567,9 +574,9 @@ public class BusOrderModel {
private void renderArriveBusStation() {
List<BusStationBean> site = busRoutesResult.getSites();
if (site != null && site.size() > 0){
backgroundCurrentStationIndex = currentStationIndex;
backgroundCurrentStationIndex ++;
if (refreshBusStationsCallback != null){
refreshBusStationsCallback.refreshBusStations(stationList, currentStationIndex
refreshBusStationsCallback.refreshBusStations(busRoutesResult.getName(),stationList, backgroundCurrentStationIndex
, getNextStopStation(),true);
}
}
@@ -582,7 +589,7 @@ public class BusOrderModel {
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
, stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
, new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
@Override
public void onSuccess(QueryLeaveAwayPassengersResponse o) {
@@ -646,7 +653,7 @@ public class BusOrderModel {
startOrStopOrderLoop(mIsWorking);
if ( stationList != null && stationList.size() > 0 ) {
AIAssist.getInstance( mContext ).speakTTSVoice( "车辆已整备完毕,请前往"
+ stationList.get( currentStationIndex ).getName() + "站点" );
+ stationList.get( backgroundCurrentStationIndex ).getName() + "站点" );
}
carOperationStatusCallback.changeOperationStatus(isWorking());
queryBusRoutes();
@@ -705,7 +712,7 @@ public class BusOrderModel {
/**
* 渲染站点信息
* 服务端返回的OchBusRoutesResult逻辑 离开站为当前站, 到达下一站后才会将下一站置为当前站,
* 车机端展示离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理current index不能直接渲染
* 车机端展示 离开站为当前站点,前往站为下一站, 下一站到站后在置为当前站
* @param result
*/
private void renderBusStationsStatus(BusRoutesResult result) {
@@ -717,43 +724,47 @@ public class BusOrderModel {
stationList.addAll( site );
for ( int i = 0; i < stationList.size(); i++ ) {
BusStationBean s = stationList.get( i );
CallerLogger.INSTANCE.d( M_BUS + "renderBusStationsStatus--",
"Index="+ i+" ,name = "+s.getName()+" ,"+s.isLeaving()+","+s.getDrivingStatus());
// 是否正在开往下一站
if ( s.isLeaving()) {
isGoingToNextStation = true;
}
// 当前站点信息
if (s.getDrivingStatus() == STATION_STATUS_STOPPED ) {
currentStationIndex = i;
backgroundCurrentStationIndex = i;
break;
}
}
backgroundCurrentStationIndex = currentStationIndex;
BusStationBean currentStation = stationList.get(currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "渲染站点信息服务端currentStationIndex="+currentStationIndex
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG,
"渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex
+" isLeaving()="+currentStation.isLeaving());
//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态
// ,订单开始站下在始发站的状态流转有问题
if (currentStationIndex == 0 && !currentStation.isLeaving()){
if (backgroundCurrentStationIndex == 0 && !currentStation.isLeaving()){
arriveSiteStation(true);
}
// 美化是否开始
if (FunctionBuildConfig.isDemoMode && (currentStationIndex >= 0
&& currentStationIndex <= stationList.size()-1)
&& stationList.get(currentStationIndex).isLeaving()){//行驶过程中设置美化
if (FunctionBuildConfig.isDemoMode && (backgroundCurrentStationIndex >= 0
&& backgroundCurrentStationIndex <= stationList.size()-1)
&& stationList.get(backgroundCurrentStationIndex).isLeaving()){//行驶过程中设置美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
CallerAutoPilotManager.INSTANCE.setDemoMode(true);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为true每次滑动出发");
}
if (refreshBusStationsCallback != null){
if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态展示当前站需要+1
currentStationIndex ++;
refreshBusStationsCallback.refreshBusStations(stationList
, currentStationIndex, getNextStopStation(),false);
}else{
refreshBusStationsCallback.refreshBusStations(stationList
, currentStationIndex, getNextStopStation(),true);
}
refreshBusStationsCallback.refreshBusStations(result.getName(),stationList
, backgroundCurrentStationIndex, getNextStopStation(),!currentStation.isLeaving());
}
if ( currentStation.isLeaving() && slidePannelHideCallback != null) {
slidePannelHideCallback.hideSlidePanel();
}
@@ -768,10 +779,10 @@ public class BusOrderModel {
* @return -1 当前已是最后一个站点
*/
private int getNextStopStation() {
if ( currentStationIndex >= stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex >= stationList.size() - 1 ) {
return -1;
}
int nextStationIndex = currentStationIndex + 1;
int nextStationIndex = backgroundCurrentStationIndex + 1;
for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) {
if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) {
break;
@@ -802,12 +813,13 @@ public class BusOrderModel {
* @param awayPassengersResponse
*/
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="+currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="
+ String.valueOf(backgroundCurrentStationIndex + 1));
if ( currentStationIndex > stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
return;
}
String station = stationList.get( currentStationIndex ).getName();
String station = stationList.get( backgroundCurrentStationIndex+1 ).getName();
StringBuilder builder = new StringBuilder( "已到达" );
builder.append( station );
if ( !station.endsWith( "" ) ) {
@@ -854,9 +866,8 @@ public class BusOrderModel {
* 行程结束
*/
private void travelOver() {
// CallerLogger.INSTANCE.d( M_BUS + TAG, "行程结束");
if ( currentStationIndex >= stationList.size() ) {
if ( backgroundCurrentStationIndex >= stationList.size() ) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "travel over index out of station list" );
return;
}
@@ -875,19 +886,18 @@ public class BusOrderModel {
* @param data
*/
public void onArriveAt( MessagePad.ArrivalNotification data){
if ( currentStationIndex > stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" );
return;
}
if (FunctionBuildConfig.isDemoMode && currentStationIndex <= stationList.size() - 1) {//到达一站结束美化
if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
CallerAutoPilotManager.INSTANCE.setDemoMode(false);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为false到最后一站");
}
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex);
isGoingToNextStation = false;
// 到达站点后,更新站点状态
// currentStationIndex = getNextStopStation();
queryStationLeaveAwayPassengers();
UiThreadHandler.postDelayed(new Runnable() {// 先查询下车乘客,再上报到站,便于后台筛查下车订单
@Override
@@ -930,11 +940,11 @@ public class BusOrderModel {
}
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
if (stationList == null || currentStationIndex >= stationList.size() || currentStationIndex == 0) {
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() || backgroundCurrentStationIndex == 0) {
return;
}
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
BusAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
currentStation.getName(), nextStation.getName(), currentLineId);
}
@@ -944,6 +954,6 @@ public class BusOrderModel {
}
public int getCurrentStationIndex() {
return currentStationIndex;
return backgroundCurrentStationIndex;
}
}

View File

@@ -120,14 +120,15 @@ public class BusPresenter extends Presenter<BusFragment>
}
@Override
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
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(
runOnUIThread(() -> mView.refreshBusStations(lineName,
stationList, currentStation, nextStation, isArrived));
}
}

View File

@@ -40,9 +40,9 @@ public class BusTrajectoryManager {
private Disposable mSendReqDisposable = null;
public BusTrajectoryManager() {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
-1, "", "", "", "",
0, "");
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
"", "", "", "", 0, "",
"", "", "", "", 0);
}
/**
@@ -106,7 +106,10 @@ public class BusTrajectoryManager {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(routesResult.getLineId(),
routesResult.csvFileUrl, routesResult.csvFileMd5,
routesResult.txtFileUrl, routesResult.txtFileMd5,
routesResult.contrailSaveTime, routesResult.carModel);
routesResult.contrailSaveTime, routesResult.carModel,
routesResult.csvFileUrlDPQP, routesResult.csvFileMd5DPQP,
routesResult.txtFileUrlDPQP, routesResult.txtFileMd5DPQP,
routesResult.contrailSaveTimeDPQP);
} else {
mAutoPilotLine.setLineId(routesResult.getLineId());
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
@@ -115,6 +118,11 @@ public class BusTrajectoryManager {
mAutoPilotLine.setStopMd5(routesResult.txtFileMd5);
mAutoPilotLine.setTimestamp(routesResult.contrailSaveTime);
mAutoPilotLine.setVehicleModel(routesResult.carModel);
mAutoPilotLine.setTrajUrl_dpqp(routesResult.csvFileUrlDPQP);
mAutoPilotLine.setTrajMd5_dpqp(routesResult.csvFileMd5DPQP);
mAutoPilotLine.setStopUrl_dpqp(routesResult.txtFileUrlDPQP);
mAutoPilotLine.setStopMd5_dpqp(routesResult.txtFileMd5DPQP);
mAutoPilotLine.setTimestamp_dpqp(routesResult.contrailSaveTimeDPQP);
}
}
}
@@ -128,6 +136,11 @@ public class BusTrajectoryManager {
mAutoPilotLine.setStopMd5("");
mAutoPilotLine.setTimestamp(0);
mAutoPilotLine.setVehicleModel("");
mAutoPilotLine.setTrajUrl_dpqp("");
mAutoPilotLine.setTrajMd5_dpqp("");
mAutoPilotLine.setStopUrl_dpqp("");
mAutoPilotLine.setStopMd5_dpqp("");
mAutoPilotLine.setTimestamp_dpqp(0);
}
private void startTrajReqLoop() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1,46 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#293159" android:startColor="#293159" />
</shape>
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<!-- <item android:state_pressed="false">-->
<!-- <shape android:shape="rectangle">-->
<!-- <corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />-->
<!-- <gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />-->
<!-- </shape>-->
<!-- </item>-->
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
</shape>
<item android:state_selected="true" android:drawable="@drawable/start_success">
</item>
<item android:state_selected="false">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:state_selected="false" android:drawable="@drawable/start_failure">
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#293159" android:startColor="#293159" />
</shape>
<item android:state_focused="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_focused="false">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:state_focused="false" android:drawable="@drawable/start_failure">
</item>
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#000B4B" android:startColor="#001C83" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#0027FF" android:startColor="#4267FF" />
</shape>
</item>
</selector>

View File

@@ -3,10 +3,9 @@
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="27px"
android:bottomRightRadius="27px"/>
<solid android:color="#2A67EF"></solid>
<corners android:bottomLeftRadius="40px"
android:bottomRightRadius="40px"/>
<gradient android:angle="180" android:endColor="#004DFF" android:startColor="#20AAFF" />
</shape>
</item>
</selector>

View File

@@ -5,23 +5,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/bus_ext_speed_width"
android:layout_height="@dimen/bus_ext_speed_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginTop="@dimen/module_mogo_och_margin_left"
android:background="@drawable/bus_yi_biao_pan_bg_nor"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_40"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.och.bus.view.BusArcView
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
android:id="@+id/bus_arc"
android:layout_width="@dimen/bus_ext_arcView_width"
android:layout_height="@dimen/bus_ext_arcView_height"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
android:layout_gravity="center" />
</FrameLayout>
@@ -29,9 +28,7 @@
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
android:layout_marginTop="@dimen/bus_ext_arcView_top"
android:background="@drawable/bus_autopilot_status_bg"
app:layout_constraintLeft_toLeftOf="parent"
android:gravity="center"
@@ -39,33 +36,30 @@
<ImageView
android:id="@+id/bus_autopilot_btn_iv"
android:layout_width="56px"
android:layout_height="56px"
android:layout_width="73px"
android:layout_height="73px"
android:layout_centerVertical="true"
android:src="@drawable/bus_ic_autopilot" />
<TextView
android:id="@+id/bus_autopolot_btn_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自动驾驶"
android:layout_centerVertical="true"
android:layout_marginLeft="28px"
android:layout_toRightOf="@+id/bus_autopilot_btn_iv"
android:text="自动驾驶"
android:textColor="@color/bus_autopilot_text_color_normal"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:layout_centerVertical="true"
android:textStyle="bold"/>
android:textStyle="bold" />
</RelativeLayout>
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_m_t"
android:background="@drawable/bus_panel_bkg"
android:elevation="@dimen/bus_dp_10"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
tools:visibility="visible" />
@@ -126,7 +120,6 @@
android:elevation="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -22,4 +22,16 @@
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_traj_md5_dpqp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_stop_md5_dpqp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
</LinearLayout>

View File

@@ -2,188 +2,175 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/module_och_bus_order_status_stationInfo"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:background="@drawable/bus_panel_bkg">
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_28"
android:background="@drawable/bus_line_panel_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<!-- <TextView-->
<!-- android:id="@+id/module_och_bus_arrive_to_end_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_32"-->
<!-- android:layout_marginLeft="@dimen/dp_27"-->
<!-- android:text="@string/bus_arrive_to_end_title"-->
<!-- android:textColor="#FFF"-->
<!-- android:textSize="@dimen/dp_27"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:textStyle="bold" />-->
<!-- <View-->
<!-- android:id="@+id/module_och_bus_arrive_to_end_deviler_line"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_1"-->
<!-- android:layout_marginTop="@dimen/dp_23"-->
<!-- app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_arrive_to_end_title"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/module_och_bus_arrive_to_end_title"-->
<!-- android:background="#707DBE">-->
<!-- </View>-->
<TextView
android:id="@+id/module_och_bus_line_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_68"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_64"
android:ellipsize="end"
android:maxLines="1"
android:text="--"
android:textColor="#FFF"
android:textSize="38px"
android:textStyle="bold"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_tag"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_bus_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_109"
android:layout_height="@dimen/dp_42"
android:layout_gravity="right"
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_tag_m_t"
android:layout_marginRight="@dimen/module_mogo_och_autopilot_order_tag_m_r"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_60"
android:background="@drawable/bus_panel_anchor_bkg"
android:paddingLeft="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingTop="2px"
android:paddingRight="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingBottom="2px"
android:gravity="center"
android:text="小巴车"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_autopilot_order_tag_height"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
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" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_och_bus_order_status_stationInfo"
<View
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_4"
android:layout_marginTop="@dimen/dp_24"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:background="@drawable/bus_line_dividing_line1_selector"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_tag" />
<View
android:id="@+id/line2"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_4"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:background="@drawable/bus_line_dividing_line2_selector"
app:layout_constraintLeft_toLeftOf="@+id/line1"
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:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft"
android:paddingTop="8px"
android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight"
android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_tag"
app:layout_constraintLeft_toLeftOf="parent">
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_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14px"
android:text="当前站点:"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_bus_current_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_current_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6px"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_start_station_tag"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
tools:text="后路站" />
<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_start_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="始"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station"
tools:visibility="visible" />
<TextView
android:id="@+id/module_och_bus_order_end_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" />
<TextView
android:id="@+id/module_och_bus_next_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_och_bus_order_distance_anchor_marginTop"
android:text="下一站:"
android:textColor="#8E9DD4"
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" />
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
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" />
<TextView
android:id="@+id/module_och_bus_order_end_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_end_station_tag"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
tools:text="后路站1" />
<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" />
<TextView
android:id="@+id/module_och_bus_end_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="终"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station"
tools:visibility="visible" />
<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" />
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
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="parent"
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" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/switch_line_btn"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/bus_switch_line_btn"
android:text="@string/bus_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: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:background="@drawable/bus_switch_line_btn"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
app:layout_constraintLeft_toLeftOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -13,8 +13,8 @@
<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>
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">40px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
@@ -44,20 +44,20 @@
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">34px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">34px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">28px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">64px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
<dimen name="module_mogo_och_margin_left">40px</dimen>
@@ -77,8 +77,8 @@
<dimen name="module_mogo_och_slide_panel_textSize">70px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">180px</dimen>
<dimen name="module_mogo_och_operation_status_bg_width">112px</dimen>
<dimen name="module_mogo_och_operation_status_bg_height">112px</dimen>
@@ -86,11 +86,11 @@
<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">466px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">446px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">36px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">40px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
@@ -104,9 +104,9 @@
<dimen name="bus_ext_arcView_stroke_with">20px</dimen>
<dimen name="bus_ext_arcView_top">40px</dimen>
<dimen name="bus_ext_arcView_width">320px</dimen>
<dimen name="bus_ext_speed_height">460px</dimen>
<dimen name="bus_ext_speed_height">320px</dimen>
<dimen name="bus_ext_speed_padding">70px</dimen>
<dimen name="bus_ext_speed_width">460px</dimen>
<dimen name="bus_ext_speed_width">616px</dimen>
<dimen name="bus_ext_speed_width_big_radius">130px</dimen>
<dimen name="bus_ext_speed_width_sm_radius">30px</dimen>
<dimen name="bus_switch_map">279px</dimen>
@@ -120,7 +120,8 @@
<dimen name="bus_switch_line_title">46px</dimen>
<dimen name="bus_switch_line_btn_width">700px</dimen>
<dimen name="bus_switch_line_btn_height">120px</dimen>
<dimen name="bus_switch_line_btn">86px</dimen>
<dimen name="bus_switch_line_btn_width_1">560px</dimen>
<dimen name="bus_switch_line_btn_height_1">116px</dimen>
<dimen name="bus_switch_line_btn_margin_b">20px</dimen>

View File

@@ -13,8 +13,8 @@
<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>
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">40px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
@@ -44,11 +44,11 @@
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">34px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">34px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
@@ -57,7 +57,7 @@
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">64px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
<dimen name="module_mogo_och_margin_left">40px</dimen>
@@ -77,8 +77,8 @@
<dimen name="module_mogo_och_slide_panel_textSize">70px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">180px</dimen>
<dimen name="module_mogo_och_operation_status_bg_width">112px</dimen>
<dimen name="module_mogo_och_operation_status_bg_height">112px</dimen>
@@ -86,11 +86,11 @@
<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">466px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">446px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">36px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">40px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
@@ -119,7 +119,8 @@
<dimen name="bus_switch_line_title">46px</dimen>
<dimen name="bus_switch_line_btn_width">700px</dimen>
<dimen name="bus_switch_line_btn_height">120px</dimen>
<dimen name="bus_switch_line_btn">86px</dimen>
<dimen name="bus_switch_line_btn_width_1">560px</dimen>
<dimen name="bus_switch_line_btn_height_1">116px</dimen>
<dimen name="bus_switch_line_btn_margin_b">50px</dimen>
<dimen name="bus_traffic_light_layout_width">225px</dimen>

View File

@@ -135,7 +135,8 @@
<dimen name="bus_switch_line_title">30px</dimen>
<dimen name="bus_switch_line_btn_width">450px</dimen>
<dimen name="bus_switch_line_btn_height">72px</dimen>
<dimen name="bus_switch_line_btn">52px</dimen>
<dimen name="bus_switch_line_btn_width_1">280px</dimen>
<dimen name="bus_switch_line_btn_height_1">58px</dimen>
<dimen name="bus_switch_line_btn_margin_b">20px</dimen>
<dimen name="bus_traffic_light_layout_width">225px</dimen>

View File

@@ -19,9 +19,9 @@
<string name="bus_change_line_commit_tip_s">更换路线成功</string>
<string name="bus_change_line_commit_tip_f">更换路线失败</string>
<!-- <string name="bus_arrive_to_end_title">去往下车地点</string>-->
<string name="bus_arrive_to_end_start"></string>
<!-- <string name="bus_arrive_to_end_start1">上车</string>-->
<string name="bus_arrive_to_end_end"></string>
<!-- <string name="bus_arrive_to_end_end1">下车</string>-->
<string name="bus_arrive_to_end_start">起点:</string>
<string name="bus_arrive_to_end_end">终点:</string>
<string name="bus_arrive_to_current_tag">当前站点:</string>
<string name="bus_arrive_to_next_tag">下一站:</string>
<string name="bus_auto_disable_tip">自动驾驶状态为0不可用</string>
</resources>

View File

@@ -167,4 +167,34 @@ public class CoordinateCalculateRouteUtil {
}
return latePoints;
}
/**
* 简单粗暴 直接比较 todo 需要优化
* @param mRoutePoints
* @param realLon
* @param realLat
* @return 返回已经到达点的index
*/
public static int getArrivedPointIndex(List<LatLng> mRoutePoints,double realLon,double realLat) {
int currentIndex = 0; //记录疑似点
if (mRoutePoints.size() > 0){
//基础点
LatLng baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
}
}
return currentIndex;
}
return currentIndex;
}
}

View File

@@ -9,7 +9,7 @@ import java.math.RoundingMode;
*/
public class NumberFormatUtil {
/**
* 有小数位, 没有小数保留整数
* 有小数1位, 没有小数保留整数
* @param d
* @return
*/

View File

@@ -0,0 +1,152 @@
package com.mogo.och.common.module.utils;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author: wangmingjun
* @date: 2022/7/19
*/
public class OCHThreadPoolManager<T> {
/**
* 根据cpu的数量动态的配置核心线程数和最大线程数
*/
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
/**
* 核心线程数 = CPU核心数 + 1
*/
private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
/**
* 线程池最大线程数 = CPU核心数 * 2 + 1
*/
private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1;
/**
* 非核心线程闲置时超时1s
*/
private static final int KEEP_ALIVE = 1;
/**
* 线程池的对象
*/
private ThreadPoolExecutor executor;
/**
* 要确保该类只有一个实例对象,避免产生过多对象消费资源,所以采用单例模式
*/
private OCHThreadPoolManager() {
}
private volatile static OCHThreadPoolManager INSTANCE;
public static OCHThreadPoolManager getsInstance() {
if (INSTANCE == null) {
synchronized (OCHThreadPoolManager.class) {
if (INSTANCE == null) {
INSTANCE = new OCHThreadPoolManager();
}
}
}
return INSTANCE;
}
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public void execute(Runnable r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
try {
executor.execute(r);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 开启一个有返回结果的线程
*
* @param r
* @return
*/
public Future<T> submit(Callable<T> r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
return executor.submit(r);
}
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public Future submit(Runnable r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
return executor.submit(r);
}
/**
* 把任务移除等待队列
*
* @param r
*/
public void cancel(Runnable r) {
if (r != null) {
executor.getQueue().remove(r);
}
}
}

View File

@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.taxi.passenger">
/
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<application>
<activity
android:name=".ui.video.VideoActivity"
android:launchMode="singleTask"
android:process=":video"
android:theme="@style/ActivityTranslucentVideo"
android:exported="false" />
<service android:name=".mulprocess.EmptyService"
android:process=":video" />
<provider
android:name=".mulprocess.BinderProvider"
android:authorities="com.mogo.och.taxi.passenger.leftmenu"
android:exported="false" />
</application>
</manifest>

View File

@@ -0,0 +1,12 @@
// ICallback.aidl
package com.mogo.och.taxi.passenger.mulprocess;
// Declare any non-default types here with import statements
interface ICallback {
void onResult(long meters, long timeInSecond,float speed);
void postEvent(int type);
}

View File

@@ -0,0 +1,19 @@
// ILeftMenuService.aidl
package com.mogo.och.taxi.passenger.mulprocess;
import com.mogo.och.taxi.passenger.mulprocess.ICallback;
// Declare any non-default types here with import statements
interface ILeftMenuService {
/**
* 向主进程传选中的item
*/
void transmissionIndex(int index);
void registerCallback(in ICallback cb);
void unRegisterCallback(in ICallback cb);
}

View File

@@ -57,6 +57,11 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
public String txtFileMd5 = ""; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel = ""; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url默认“”
public String csvFileMd5DPQP = ""; //轨迹文件md5默认“”
public String txtFileUrlDPQP = ""; //打点文件下载的cos url默认“”
public String txtFileMd5DPQP = ""; //轨迹文件md5默认“”
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
// !!!接口中暂无此字段仅用于本地实现逻辑使用起始站目的站距离km
public double travelDistance;

View File

@@ -12,5 +12,5 @@ import mogo.telematics.pad.MessagePad;
*/
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
void setLineMarker(List<LatLng> models);
void routeResultByServer(List<LatLng> models);
void routeResultByServer(List<LatLng> models,int haveArrivedIndex);
}

View File

@@ -0,0 +1,4 @@
package com.mogo.och.taxi.passenger.event;
public class FinishActivity {
}

View File

@@ -0,0 +1,16 @@
package com.mogo.och.taxi.passenger.event;
public class UIStatus {
public static final int LIVE = 0;
public static final int OVERVIEW = 1;
public static final int CONSULT = 2;
public static final int MOVIE = 3;
public int status = LIVE;
public UIStatus(int status) {
this.status = status;
}
}

View File

@@ -617,10 +617,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
public void loopRouteAndWipe() {
if (mLocationsModels != null && mLocationsModels.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mLocationsModels,mLongitude,mLatitude);
int haveArrivedIndex = CoordinateCalculateRouteUtil
.getArrivedPointIndex(mLocationsModels,mLongitude,mLatitude);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResultByServer(lastPoints);
mAutopilotPlanningCallback.routeResultByServer(mLocationsModels,haveArrivedIndex);
}
}
}
@@ -893,7 +893,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
mCurrentOCHOrder.lineId,
mCurrentOCHOrder.csvFileUrl, mCurrentOCHOrder.csvFileMd5,
mCurrentOCHOrder.txtFileUrl, mCurrentOCHOrder.txtFileMd5,
mCurrentOCHOrder.contrailSaveTime, mCurrentOCHOrder.carModel);
mCurrentOCHOrder.contrailSaveTime, mCurrentOCHOrder.carModel,
mCurrentOCHOrder.csvFileUrlDPQP, mCurrentOCHOrder.csvFileMd5DPQP,
mCurrentOCHOrder.txtFileUrlDPQP, mCurrentOCHOrder.txtFileMd5DPQP,
mCurrentOCHOrder.contrailSaveTimeDPQP);
}
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);

View File

@@ -8,8 +8,12 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/**
@@ -31,8 +35,8 @@ public class TaxiPassengerModelLoopManager {
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
private Disposable mQueryOrderRemainingDisposable; //心跳轮询
private Disposable mRouteWipeDisposable; //轨迹擦除
private Disposable mReadyToAutopilotDisposable; //轨迹擦除
private CompositeDisposable mRouteWipeDisposable = new CompositeDisposable(); //轨迹擦除
private Disposable mReadyToAutopilotDisposable; //轮询是否可开启自动驾驶
public void startReadyToAutopilot() {
if (mReadyToAutopilotDisposable != null && !mReadyToAutopilotDisposable.isDisposed()) {
@@ -56,23 +60,48 @@ public class TaxiPassengerModelLoopManager {
}
public void startRouteAndWipe() {
if (mRouteWipeDisposable != null && !mRouteWipeDisposable.isDisposed()) {
return;
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startRouteAndWipe()");
mRouteWipeDisposable = Observable.interval(TaxiPassengerConst.LOOP_DELAY,
TaxiPassengerConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
.delay(TaxiPassengerConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS, true) // 设置delayError为true表示出现错误的时候也需要延迟5s进行通知达到无论是请求正常还是请求失败都是5s后重新订阅即重新请求。
.subscribeOn(Schedulers.io())
.repeat() // repeat保证请求成功后能够重新订阅。
.retry() // retry保证请求失败后能重新订阅
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> TaxiPassengerModel.getInstance().loopRouteAndWipe());
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
}
});
mRouteWipeDisposable.add(disposable);
}
public Observable<Integer> startLoopRouteAndWipe(){
return Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
TaxiPassengerModel.getInstance().loopRouteAndWipe();
emitter.onComplete();
}
});
}
public void stopRouteAndWipe() {
if (mRouteWipeDisposable != null) {
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "stopRouteAndWipe()");
mRouteWipeDisposable.dispose();
mRouteWipeDisposable = null;
}
}

View File

@@ -0,0 +1,64 @@
package com.mogo.och.taxi.passenger.mulprocess;
import android.database.MatrixCursor;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
public class BinderCursor extends MatrixCursor {
static final String KEY_BINDER = "binder";
Bundle mBinderExtra = new Bundle();
public static class BinderParcelable implements Parcelable {
public IBinder mBinder;
public static final Creator<BinderParcelable> CREATOR = new Creator<BinderParcelable>() {
@Override
public BinderParcelable createFromParcel(Parcel source) {
return new BinderParcelable(source);
}
@Override
public BinderParcelable[] newArray(int size) {
return new BinderParcelable[size];
}
};
BinderParcelable(IBinder binder) {
mBinder = binder;
}
BinderParcelable(Parcel source) {
mBinder = source.readStrongBinder();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStrongBinder(mBinder);
}
}
public BinderCursor(String[] columnNames, IBinder binder) {
super(columnNames);
if (binder != null) {
Parcelable value = new BinderParcelable(binder);
mBinderExtra.putParcelable(KEY_BINDER, value);
}
}
@Override
public Bundle getExtras() {
return mBinderExtra;
}
}

View File

@@ -0,0 +1,55 @@
package com.mogo.och.taxi.passenger.mulprocess;
import static android.os.Binder.getCallingUid;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.IBinder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class BinderProvider extends ContentProvider {
public static final String TAG = BinderProvider.class.getSimpleName();
public static final String AUTHORITY = "com.mogo.och.taxi.passenger.leftmenu";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/binder");
public static final String SERVICE_LEFTMENU = "lefmenu";
@Override
public boolean onCreate() {
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
getCallingUid();
IBinder binder;
if (selectionArgs[0].equals(BinderProvider.SERVICE_LEFTMENU)) {
binder = new OrderServiceImpl();
} else {
return null;
}
BinderCursor cursor = new BinderCursor(new String[]{"service"}, binder);
return cursor;
}
@Override
public String getType(Uri uri) {return null;}
@Override
public Uri insert(Uri uri, ContentValues values) {return null;}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {return 0;}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {return 0;}
}

View File

@@ -0,0 +1,22 @@
package com.mogo.och.taxi.passenger.mulprocess
import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.IBinder
class EmptyService: Service() {
companion object{
fun startService(context: Context){
//预加载视频进程
val intent = Intent(context, EmptyService::class.java)
context.startService(intent)
}
}
override fun onBind(intent: Intent?): IBinder? {
// 加载进程的空Service
return null
}
}

View File

@@ -0,0 +1,29 @@
package com.mogo.och.taxi.passenger.mulprocess;
import android.os.RemoteException;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen;
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils;
public class OrderServiceImpl extends ILeftMenuService.Stub {
@Override
public void transmissionIndex(int index) throws RemoteException {
UiThreadHandler.getsUiHandler().post(() -> {
OverlayLeftViewUtils.INSTANCE.transmissionIndexGet(index);
});
}
@Override
public void registerCallback(ICallback cb) throws RemoteException {
LeftMenuOpen.INSTANCE.registerCallbackHost(cb);
}
@Override
public void unRegisterCallback(ICallback cb) throws RemoteException {
LeftMenuOpen.INSTANCE.unregisterCallbackHost(cb);
}
}

View File

@@ -23,6 +23,7 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
import com.mogo.och.taxi.passenger.model.TaxiPassengerGeocodeSearchModel;
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen;
/**
* @author: wangmingjun
@@ -118,6 +119,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
@Override
public void onCarLocationChanged(Location location) {
LeftMenuOpen.INSTANCE.callCallBack(-1,-1,location.getSpeed());
}
@Override
@@ -134,7 +136,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
@Override
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
LeftMenuOpen.INSTANCE.callCallBack(meters,timeInSecond,-1);
}
@Override
@@ -155,7 +157,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
// 70 取消订单
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == order.orderStatus){
runOnUIThread(() -> {
mView.showOrHideServingOrderFragment(false);
mView.showOrHideServingOrderFragment(false,true);
mView.showOrHideStartAutopilotView(false,false);
mView.showOrHidePressengerCheckPager(false, "",
"", "", "", "");
@@ -189,7 +191,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
runOnUIThread(() ->{
mView.showOrHideStartAutopilotView(false,false);
mView.showOrHideServingOrderFragment(true);
mView.showOrHideServingOrderFragment(true,true);
});
TaxiPassengerModel.getInstance().startOrStopReadyToAutopilotoop(false);
}
@@ -210,7 +212,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
TaxiPassengerModel.getInstance().recoverNaviInfo();
TaxiPassengerGeocodeSearchModel.getInstance(getContext()).destroyGeocodeSearch();
runOnUIThread(() -> {
mView.showOrHideServingOrderFragment(false);
mView.showOrHideServingOrderFragment(false,true);
mView.showOrHideArrivedEndLayout(true, order.endSiteAddr,order.orderNo);
});
return;

View File

@@ -74,13 +74,13 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
runOnUIThread(() -> mView.setLineMarker(models));
}
@Override
public void routeResultByServer(List<LatLng> models) {
public void routeResultByServer(List<LatLng> models, int haveArrivedIndex) {
if (models == null) return;
runOnUIThread(() -> mView.routeResultByServer(models));
runOnUIThread(() -> mView.routeResultByServer(models,haveArrivedIndex));
}
@Override
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));

View File

@@ -1,12 +1,15 @@
package com.mogo.och.taxi.passenger.ui;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentTransaction;
import com.mogo.commons.AbsMogoApplication;
@@ -27,9 +30,15 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.callback.ITPClickStartAutopilotCallback;
import com.mogo.och.taxi.passenger.event.UIStatus;
import com.mogo.och.taxi.passenger.presenter.BaseTaxiPassengerPresenter;
import com.mogo.och.taxi.passenger.ui.comment.TaxiPassengerArrivedView;
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils;
import com.mogo.och.taxi.passenger.mulprocess.EmptyService;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.lang.ref.WeakReference;
@@ -46,7 +55,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
static final String TAG = "TaxiPassengerBaseFragment";
private FrameLayout flNaviPanelContainer;
private ImageView mAutopilotImage;
private ImageView mMapswitchBtn;
private TaxiPassengerTrafficLightView mTrafficLightView;
@@ -54,13 +62,17 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
private WeakReference<TaxiPassengerArrivedView> mArrivedEndView;
private WeakReference<TaxiPassengerCheckView> mArrivedCheckView;
private WeakReference<TaxiPassengerStartAutopilotView> mStartAutopilotView;
private View vOpenLeft;
protected TaxiPassengerServingOrderFragment ochServingOrderFragment = null;
private Handler mHandler = new Handler(Looper.getMainLooper());
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
EventBus.getDefault().register(this);
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
protected int getLayoutId() {
return R.layout.taxi_p_base_fragment;
@@ -77,7 +89,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
hideEagleConfig();
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
flNaviPanelContainer = findViewById(R.id.module_mogo_och_navi_panel_container);
mTrafficLightView = findViewById(R.id.traffic_light_view);
CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
@@ -85,7 +96,6 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
CallerHmiManager.INSTANCE.setNotificationViewProvider(this);
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
vOpenLeft = findViewById(R.id.v_open_left);
updateSwitchMapIcon();
initListener();
@@ -96,6 +106,8 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
}else {
switchVRFlatMode(false);
}
//预加载视频进程
EmptyService.Companion.startService(getContext());
}
@NonNull
@@ -133,15 +145,11 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
});
findViewById(R.id.iv_temp).setOnClickListener(view -> {
// OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity());
// OverlayLeftViewUtils.INSTANCE.dragTarget(vOpenLeft);
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity(),0,true,-1,true);
//showOrHideArrivedEndLayout(true, "北京北京北京", "1527481606997577728");
//showOrHidePressengerCheckPager(true, "开始站点开", "开始站点开始站点开始", "2", "京A888888", "18811539480");
//OCHFloatWindowManager.getInstance().ShowFloatWindow(getContext());
//OverlayViewUtils.showOverlayView(getActivity(),new TaxiPassengerMogoConsultView(getContext()));
});
vOpenLeft.setOnClickListener(v -> OverlayLeftViewUtils.INSTANCE.open());
}
private void initArrivedView(){
@@ -166,7 +174,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
public void onResume() {
super.onResume();
// mPresenter.startOrStopOrderLoop();
// showOrHideServingOrderFragment(true);
// showOrHideServingOrderFragment(true,false);
// showOrHideStartAutopilotView(true,true);
}
@@ -235,7 +243,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
@Override
public void onDestroyView() {
super.onDestroyView();
OverlayLeftViewUtils.INSTANCE.removeDragTarget(vOpenLeft);
EventBus.getDefault().unregister(this);
removeListener();
}
@@ -245,6 +253,16 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
}
mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeOverview(UIStatus uiStatus){
if(uiStatus.status==UIStatus.LIVE){
CallerHmiManager.INSTANCE.hideSmallFragment();
showOrHideServingOrderFragment(true,false);
}else if(uiStatus.status==UIStatus.OVERVIEW){
CallerHmiManager.INSTANCE.showSmallFragment();
showOrHideServingOrderFragment(false,false);
}
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
@@ -255,34 +273,43 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
* 显示或隐藏订单信息
* @param isShow
*/
public void showOrHideServingOrderFragment(boolean isShow){
public void showOrHideServingOrderFragment(boolean isShow,boolean showOrHideLefeMenu){
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
if (isShow){
flNaviPanelContainer.setVisibility(View.VISIBLE);
if (ochServingOrderFragment == null){
ochServingOrderFragment = new TaxiPassengerServingOrderFragment().newInstance();
}
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity());
OverlayLeftViewUtils.INSTANCE.dragTarget(vOpenLeft);
if(showOrHideLefeMenu) {
OverlayLeftViewUtils.INSTANCE.showOverlayView(getActivity(), 0, true, -1, true);
}
if (ochServingOrderFragment.isHidden()){
transaction.show(ochServingOrderFragment).commitAllowingStateLoss();
transaction
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.show(ochServingOrderFragment).commitAllowingStateLoss();
return;
}
if (ochServingOrderFragment.isAdded()){
transaction.show(ochServingOrderFragment).commitAllowingStateLoss();
transaction
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.show(ochServingOrderFragment).commitAllowingStateLoss();
return;
}
transaction.add(R.id.module_mogo_och_navi_panel_container, ochServingOrderFragment)
transaction
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.add(R.id.module_mogo_och_navi_panel_container, ochServingOrderFragment)
.show(ochServingOrderFragment).commitAllowingStateLoss();
}else {
flNaviPanelContainer.setVisibility(View.GONE);
if (ochServingOrderFragment != null){
transaction.hide(ochServingOrderFragment).commitAllowingStateLoss();
transaction
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
.hide(ochServingOrderFragment).commitAllowingStateLoss();
}
if(showOrHideLefeMenu) {
OverlayLeftViewUtils.INSTANCE.dismissOverlayView(true);
CallerHmiManager.INSTANCE.hideSmallFragment();
}
OverlayLeftViewUtils.INSTANCE.dismissOverlayView();
}
}

View File

@@ -3,7 +3,6 @@ package com.mogo.och.taxi.passenger.ui;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -19,6 +18,7 @@ import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptor;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.CustomMapStyleOptions;
@@ -61,8 +61,10 @@ public class TaxiPassengerMapDirectionView
private Polyline mPolyline;
private CameraUpdate mCameraUpdate;
private Context mContext;
private int mHaveArrivedIndex;
private List<Integer> colorList = new ArrayList<>();
List<BitmapDescriptor> textureList = new ArrayList<>();
List<Integer> texIndexList = new ArrayList<>();
private ITaxiPassengerMapViewCallback mITaxiPassengerMapViewCallback;
@@ -232,7 +234,7 @@ public class TaxiPassengerMapDirectionView
}
if (mAMap != null) {
addRouteColorList();
// addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
//设置线段纹理
@@ -243,7 +245,9 @@ public class TaxiPassengerMapDirectionView
//polylineOptions.useGradient(true);
polylineOptions.width(15);
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
polylineOptions.setCustomTextureList(textureList);
polylineOptions.setCustomTextureIndex(texIndexList);
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
@@ -256,12 +260,20 @@ public class TaxiPassengerMapDirectionView
* 添加画线颜色值
*/
private void addRouteColorList() {
textureList.clear();
texIndexList.clear();
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mCoordinatesLatLng.size()/2){
colorList.add(Color.argb(255, 31, 195, 255));//start
// if (i <= mCoordinatesLatLng.size()/2){
// colorList.add(Color.argb(255, 31, 195, 255));//start
// }else {
// colorList.add(Color.argb(255, 87, 171, 255));//end
// }
if (i <= mHaveArrivedIndex){
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_arrived));
}else {
colorList.add(Color.argb(255, 87, 171, 255));//end
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
}
texIndexList.add(i);
}
}
@@ -344,6 +356,13 @@ public class TaxiPassengerMapDirectionView
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs, int haveArrivedIndex){
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
mHaveArrivedIndex = haveArrivedIndex;
addRouteColorList();
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mITaxiPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);

View File

@@ -2,6 +2,8 @@ package com.mogo.och.taxi.passenger.ui;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.location.Location;
import android.os.Build;
import android.os.Bundle;
@@ -13,8 +15,10 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.widget.AppCompatSeekBar;
import androidx.fragment.app.FragmentTransaction;
import com.amap.api.maps.model.LatLng;
import com.mogo.commons.mvp.MvpFragment;
@@ -224,18 +228,18 @@ public class TaxiPassengerServingOrderFragment extends
}
}
public void routeResultByServer(List<LatLng> latLngList) {
public void routeResultByServer(List<LatLng> latLngList,int haveArrivedIndex) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "routeResultByServer:" + latLngList.size());
if (latLngList.size() > 0) {
drawablePolylineByServerRoute(latLngList);
drawablePolylineByServerRoute(latLngList,haveArrivedIndex);
} else {
clearPolyline();
}
}
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng){
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
if (mMapDirectionView != null){
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng);
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
@@ -379,4 +383,22 @@ public class TaxiPassengerServingOrderFragment extends
lastBearing = bearing;
}
@Nullable
@Override
public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
if (transit == FragmentTransaction.TRANSIT_FRAGMENT_OPEN) {
if (enter) {//普通的进入的动作
return AnimatorInflater.loadAnimator(getContext(),R.animator.alpha_hide_show_f);
} else {//比如一个已经Fragmen被另一个replace是一个进入动作被replace的那个就是false
return AnimatorInflater.loadAnimator(getContext(),R.animator.alpha_hide_hide_f);
}
} else if (FragmentTransaction.TRANSIT_FRAGMENT_CLOSE == transit) {
if (enter) {//之前被replace的重新进入到界面或者Fragment回到栈顶
return AnimatorInflater.loadAnimator(getContext(),R.animator.alpha_hide_show_f);
} else {//Fragment退出出栈
return AnimatorInflater.loadAnimator(getContext(),R.animator.alpha_hide_hide_f);
}
}
return super.onCreateAnimator(transit,enter,nextAnim);
}
}

View File

@@ -217,6 +217,9 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
private fun commitAndStartAnimation(fraction: Int,title:String) {
resetStar()
allStartOrdered.forEach {
it.isEnabled = false
}
currentFraction = fraction
tvFeel.text = title
if(allStarWithWorld!=null&&allStarWithWorld!!.data!=null&&allStarWithWorld!!.data!!.size>0){
@@ -232,10 +235,6 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
// 总量请求失败 单独去取
requestStarWordByStar(fraction)
}
// allStartOrdered.forEach {
// it.isEnabled = false
// }
}
private var currentAnimarion = 0
private var maxIndex = 0
@@ -315,7 +314,9 @@ class TaxiPassengerArrivedView :RelativeLayout, View.OnClickListener {
}
override fun onAnimationEnd(animation: Animation?) {
allStartOrdered.forEach {
it.isEnabled = true
}
}
override fun onAnimationRepeat(animation: Animation?) {

View File

@@ -1,74 +1,33 @@
package com.mogo.och.taxi.passenger.ui.leftmenu
import android.annotation.SuppressLint
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
class ItemViewTouchListener(
private val windowView: View,
private val wl: WindowManager.LayoutParams,
private val windowManager: WindowManager?,
private val close: (view:View,windowManager: WindowManager?) -> Unit,
private val open : (view:View,windowManager: WindowManager?) -> Unit
) :
class ItemViewTouchListener :
View.OnTouchListener {
private var x = 0
// 判断并放跑点击事件
private var dragTime = 0L
private val DEVIATION = 10
private val NEGATIVEDEVIATION = -10
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(view: View, motionEvent: MotionEvent): Boolean {
when (motionEvent.action) {
MotionEvent.ACTION_DOWN -> {
x = motionEvent.rawX.toInt()
LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action)
dragTime = System.currentTimeMillis()
}
MotionEvent.ACTION_MOVE -> {
val nowX = motionEvent.rawX.toInt()
val movedX = nowX - x
x = nowX
wl.apply {
x += movedX
}
if (wl.x > 0 || wl.x < OverlayLeftViewUtils.DEVIATION_WIDTH) {
wl.apply {
x -= movedX
}
if (LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action)) {
return false
}
if (wl.x > NEGATIVEDEVIATION && movedX > 0) {
open(windowView,windowManager)
}else{
//更新悬浮球控件位置
windowManager?.updateViewLayout(windowView, wl)
}
if (wl.x < OverlayLeftViewUtils.DEVIATION_WIDTH +DEVIATION && movedX < 0) {
close(windowView,windowManager)
}else{
//更新悬浮球控件位置
windowManager?.updateViewLayout(windowView, wl)
}
}
MotionEvent.ACTION_UP -> {
val startX = wl.x
if (startX > OverlayLeftViewUtils.DEVIATION_WIDTH /2 && startX < 0) {
//拖动距离大于一半 自动打开
open(windowView,windowManager)
} else if (startX < OverlayLeftViewUtils.DEVIATION_WIDTH /2 && startX >= OverlayLeftViewUtils.DEVIATION_WIDTH) {
// 拖动距离小于一半自动关闭
close(windowView,windowManager)
}
LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action)
if (System.currentTimeMillis() - dragTime > 500) {
dragTime = 0
return true
}
}
else -> {
}
else -> {}
}
return false
}

View File

@@ -0,0 +1,278 @@
package com.mogo.och.taxi.passenger.ui.leftmenu
import android.annotation.SuppressLint
import android.content.ContentResolver
import android.database.Cursor
import android.os.IBinder
import android.os.RemoteCallbackList
import android.os.RemoteException
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.mulprocess.BinderCursor
import com.mogo.och.taxi.passenger.mulprocess.BinderProvider
import com.mogo.och.taxi.passenger.mulprocess.ICallback
import com.mogo.och.taxi.passenger.mulprocess.ILeftMenuService
@SuppressLint("StaticFieldLeak")
object LeftMenuOpen {
private var windowView: View? = null
private var wl: WindowManager.LayoutParams? = null
private var windowManager: WindowManager? = null
private var close: ((view: View, windowManager: WindowManager?) -> Unit)? = null
private var open: ((view: View, windowManager: WindowManager?) -> Unit)? = null
private var cu: Cursor? = null
// 两部分主进程和子进程
private var dragList = mutableSetOf<View>()
private var orderService: ILeftMenuService? = null
private var icallbacks: RemoteCallbackList<ICallback> = RemoteCallbackList<ICallback>()
fun setValue(
windowView: View,
wl: WindowManager.LayoutParams?,
windowManager: WindowManager?,
close: (view: View, windowManager: WindowManager?) -> Unit,
open: (view: View, windowManager: WindowManager?) -> Unit
) {
this.open = open
this.close = close
this.windowView = windowView
this.windowManager = windowManager
this.wl = wl
dragList.forEach {
registerDragView(it)
}
registerC()
}
fun clearValue() {
this.open = null
this.close = null
this.windowView = null
this.windowManager = null
this.wl = null
cu?.let {
it.close()
orderService = null
}
val iterator = dragList.iterator()
while (iterator.hasNext()) {
val next = iterator.next()
unRegisterDragView(next)
}
}
private var x = 0
// 判断并放跑点击事件
private const val DEVIATION = 10
private const val NEGATIVEDEVIATION = -10
fun dragAndOpen(newX: Int, action: Int): Boolean {
when (action) {
MotionEvent.ACTION_DOWN -> {
x = newX
}
MotionEvent.ACTION_MOVE -> {
val nowX = newX
val movedX = nowX - x
x = nowX
wl?.let { it ->
it.x += movedX
if (it.x > 0 || it.x < OverlayLeftViewUtils.DEVIATION_WIDTH) {
it.apply {
x -= movedX
}
return true
}
windowView?.let { windowView ->
windowManager?.let { windowManager ->
if (it.x > NEGATIVEDEVIATION && movedX > 0) {
open?.let { it1 ->
UiThreadHandler.getsUiHandler().post {
it1(windowView, windowManager)
}
}
} else {
//更新悬浮球控件位置
UiThreadHandler.getsUiHandler().post {
windowManager.updateViewLayout(windowView, it)
}
}
if (it.x < OverlayLeftViewUtils.DEVIATION_WIDTH + DEVIATION && movedX < 0) {
close?.let { it1 ->
UiThreadHandler.getsUiHandler().post {
it1(windowView, windowManager)
}
}
} else {
//更新悬浮球控件位置
UiThreadHandler.getsUiHandler().post {
windowManager.updateViewLayout(windowView, it)
}
}
}
}
}
}
MotionEvent.ACTION_UP -> {
wl?.let { wl ->
val startX = wl.x
if (startX > OverlayLeftViewUtils.DEVIATION_WIDTH / 2 && startX < 0) {
//拖动距离大于一半 自动打开
open?.let {
UiThreadHandler.getsUiHandler().post {
it(windowView!!, windowManager)
}
}
} else if (startX < OverlayLeftViewUtils.DEVIATION_WIDTH / 2 && startX >= OverlayLeftViewUtils.DEVIATION_WIDTH) {
// 拖动距离小于一半自动关闭
close?.let {
UiThreadHandler.getsUiHandler().post {
it(windowView!!, windowManager)
}
}
} else {
}
}
}
}
return false
}
fun registerDragView(view: View?) {
if (view != null) {
dragList.add(view)
if (orderService == null) {
registerC()
}
view.setOnTouchListener(ItemViewTouchListener())
view.setOnClickListener {
open?.let { it1 -> it1(windowView!!, windowManager) }
}
}
}
fun unRegisterDragView(view: View?) {
dragList.remove(view)
view?.let {
it.setOnTouchListener(null)
it.setOnClickListener(null)
if(it.id==R.id.ids_video_anchor){
val parent = it.parent as ViewGroup
parent.removeView(it)
}
}
}
fun transmissionIndex(index:Int){
if (orderService == null) {
registerC()
}
orderService?.transmissionIndex(index)
}
fun registerCallbackHost(cb:ICallback?){
if (orderService == null) {
registerC()
}
cb?.let {
icallbacks?.register(it)
}
}
fun unregisterCallbackHost(cb:ICallback?){
cb?.let {
icallbacks?.unregister(it)
}
}
fun registerCallback(cb:ICallback?){
if (orderService == null) {
registerC()
}
cb?.let {
orderService?.registerCallback(it)
}
}
fun unregisterCallback(cb:ICallback?){
cb?.let {
orderService?.unRegisterCallback(it)
}
}
fun callCallBack(meters: Long,timeInSecond: Long,speed:Float){
val len = icallbacks.beginBroadcast()
for (i in 0 until len) {
try {
icallbacks.getBroadcastItem(i).onResult(meters,timeInSecond,speed)
} catch (e: RemoteException) {
e.printStackTrace()
}
}
icallbacks.finishBroadcast()
}
fun invoKeyByEventType(typeID:Int){
val len = icallbacks.beginBroadcast()
for (i in 0 until len) {
try {
icallbacks.getBroadcastItem(i).postEvent(typeID)
} catch (e: RemoteException) {
e.printStackTrace()
}
}
icallbacks.finishBroadcast()
}
/**
* 主进程、video进程都得调用
* 主进程在显示是主动调用
* video进程在天津View是判断是否调用了
*/
private fun registerC() {
val resolver: ContentResolver = Utils.getApp().contentResolver
cu = resolver.query(
BinderProvider.CONTENT_URI,
null,
null,
arrayOf(BinderProvider.SERVICE_LEFTMENU),
null
) ?: return
val binder: IBinder = getBinder(cu!!)
try {
orderService = ILeftMenuService.Stub.asInterface(binder)
} catch (e: RemoteException) {
e.printStackTrace()
cu?.close()
cu = null
}
}
private fun getBinder(cursor: Cursor): IBinder {
val extras = cursor.extras
extras.classLoader = BinderCursor.BinderParcelable::class.java.classLoader
val w = extras.getParcelable<BinderCursor.BinderParcelable>("binder")
return w!!.mBinder
}
}

View File

@@ -30,26 +30,29 @@ class ListAdapter(private val context: Context,val list: MutableList<LeftMenuMod
imageView.setImageResource(leftMenuModel.select)
}
imageView.setOnClickListener {
for (i in list.indices) {
if(position==i){
if(!list[i].isChecked){
list[i].selectListener.onSelect(convertView)
}
}
list[i].isChecked = position == i
}
notifyDataSetChanged()
setSelectIndex(position,true)
}
return imageView
}
/**
* 多进程调用
*/
fun setSelectIndex(index: Int,needStartActivity: Boolean) {
for (i in list.indices) {
if(index==i){
if(!list[i].isChecked){
list[i].selectListener.onSelect(needStartActivity)
OverlayLeftViewUtils.transmissionIndex(index)
}
}
list[i].isChecked = index == i
}
notifyDataSetChanged()
}
interface OnTabSelectListener {
/**
* Called when a view has been clicked.
*
* @param v The view that was clicked.
*/
fun onSelect(v: View?)
fun onSelect(isCurrentProcess:Boolean)
}
}

View File

@@ -4,23 +4,30 @@ import android.animation.Animator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Context.WINDOW_SERVICE
import android.graphics.PixelFormat
import android.graphics.Rect
import android.view.*
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.view.animation.LinearInterpolator
import android.widget.FrameLayout
import android.widget.ListView
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst
import com.mogo.och.taxi.passenger.event.FinishActivity
import com.mogo.och.taxi.passenger.event.UIStatus
import com.mogo.och.taxi.passenger.mulprocess.EmptyService
import com.mogo.och.taxi.passenger.ui.leftmenu.model.LeftMenuModel
import com.mogo.och.taxi.passenger.ui.video.FullVideoUtils
import com.mogo.och.taxi.passenger.ui.video.TaxiPassengerMogoConsultView
import com.mogo.och.taxi.passenger.ui.video.TaxiPassengerMogoMoviesView
import com.mogo.och.taxi.passenger.ui.video.VideoActivity
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import org.greenrobot.eventbus.EventBus
import java.util.concurrent.TimeUnit
/**
@@ -32,7 +39,6 @@ import java.util.concurrent.TimeUnit
object OverlayLeftViewUtils {
private const val TAG = "OverlayViewUtils"
private var windowManager: WindowManager? = null
private var applicationContext: Context? = null
@Volatile
private var isShowing = false
@@ -42,30 +48,30 @@ object OverlayLeftViewUtils {
const val WIDTH = 810
const val DEVIATION_WIDTH = -669
const val LIVE = 0
const val OVERVIEW = 1
const val CONSULT = 2
const val MOVIE = 3
private var overlayView: View?=null
private var subscribe: Disposable?=null
private var taxiPassengerMogoConsultView: TaxiPassengerMogoConsultView? = null
private var taxiPassengerMogoMoviesView: TaxiPassengerMogoMoviesView? = null
private var subscribeLive: Disposable?=null
private var subscribeOVERVIEW: Disposable?=null
private var acivOpenClose: AppCompatImageView?=null
private var dragList = mutableListOf<View>()
/**
* 添加覆盖View在Activity上面
*/
@JvmOverloads
fun showOverlayView(context: Activity, ani: Int = -1) {
fun showOverlayView(context: Activity,checkIndex:Int = LIVE,isOpen: Boolean=true, ani: Int = -1,isMainProcess: Boolean = false) {
if (isShowing) {
return
}
if (applicationContext == null) {
applicationContext = context.applicationContext
}
if (windowManager == null) {
windowManager = context.windowManager
windowManager = context.getSystemService(WINDOW_SERVICE) as WindowManager
}
overlayView = LayoutInflater.from(context)
@@ -77,20 +83,14 @@ object OverlayLeftViewUtils {
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
layoutParams(ani,view)
layoutParams(ani,view, isOpen)
// 如果正在展示中并且lastOverlayView不为null先做移除操作保证覆盖在最上面的View只有一个防止叠加导致无法移除
dismissOverlayView()
dismissOverlayView(false)
val vDragField = view.findViewById<View>(R.id.v_drag_field)
acivOpenClose = view.findViewById(R.id.aciv_open_close)
dragList.forEach {
it.setOnTouchListener(ItemViewTouchListener(
overlayView!!,params!!, windowManager, ::close,
::open))
}
vDragField.setOnTouchListener(ItemViewTouchListener(overlayView!!,params!!, windowManager, ::close,
::open))
vDragField.setOnTouchListener(ItemViewTouchListener())
vDragField.setOnClickListener {
val start: Int = params!!.x
if (start > DEVIATION_WIDTH /2 && start < 10) {
@@ -104,40 +104,79 @@ object OverlayLeftViewUtils {
val integers = mutableListOf<LeftMenuModel>()
val liveSelected = object :ListAdapter.OnTabSelectListener{
override fun onSelect(v: View?) {
close(view, windowManager)
FullVideoUtils.dismissOverlayView(true)
closeConsult()
closeMovice()
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
}else {
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
if(isMainProcess){
//主进程 建议Eventbus实现
subscribeLive = Observable.timer(300, TimeUnit.MILLISECONDS)
.subscribe {
EventBus.getDefault().post(UIStatus(UIStatus.LIVE))
}
}else{
EventBus.getDefault().post(FinishActivity())
}
}
}
val overViewSelected = object :ListAdapter.OnTabSelectListener{
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
}else {
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
if(isMainProcess){
//主进程 建议Eventbus实现
subscribeOVERVIEW = Observable.timer(300, TimeUnit.MILLISECONDS)
.subscribe {
EventBus.getDefault().post(UIStatus(UIStatus.OVERVIEW))
}
}else{
EventBus.getDefault().post(FinishActivity())
}
}
}
val consultSelect = object :ListAdapter.OnTabSelectListener{
override fun onSelect(v: View?) {
close(view, windowManager)
FullVideoUtils.dismissOverlayView(true)
closeMovice()
taxiPassengerMogoConsultView = TaxiPassengerMogoConsultView(context)
OverlayViewUtils.showOverlayView(context,taxiPassengerMogoConsultView)
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
//计算订单起点和终点距离
val sumDis = SharedPrefsMgr.getInstance(context).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0)
VideoActivity.startActivity(context, VideoActivity.VIDEOTYPE_CONSULT,sumDis)
}
}
}
val entertainmentSelect = object :ListAdapter.OnTabSelectListener{
override fun onSelect(v: View?) {
close(view, windowManager)
FullVideoUtils.dismissOverlayView(true)
closeConsult()
taxiPassengerMogoMoviesView = TaxiPassengerMogoMoviesView(context)
OverlayViewUtils.showOverlayView(context,taxiPassengerMogoMoviesView)
override fun onSelect(isCurrentProcess:Boolean) {
if(isCurrentProcess) {
close(view, windowManager)
val sumDis = SharedPrefsMgr.getInstance(context).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0)
VideoActivity.startActivity(context, VideoActivity.VIDEOTYPE_MOIES,sumDis)
}
}
}
integers.add(LeftMenuModel(R.drawable.taxi_p_mogo_live_select,R.drawable.taxi_p_mogo_live_selected,true,liveSelected))
integers.add(LeftMenuModel(R.drawable.taxi_p_mogo_live_select,R.drawable.taxi_p_mogo_live_selected,false,liveSelected))
integers.add(LeftMenuModel(R.drawable.taxi_p_mogo_overview_select,R.drawable.taxi_p_mogo_overview_selected,false,overViewSelected))
integers.add(LeftMenuModel(R.drawable.taxi_p_mogo_consult_select,R.drawable.taxi_p_mogo_consult_selected,false,consultSelect))
integers.add(LeftMenuModel(R.drawable.taxi_p_mogo_entertainment_select,R.drawable.taxi_p_mogo_entertainment_selected,false,entertainmentSelect))
integers.forEachIndexed { index, leftMenuModel ->
leftMenuModel.isChecked = index == checkIndex
}
lvSelectItem.adapter = ListAdapter(context, integers)
addTarget(context)
LeftMenuOpen.setValue(view, params, windowManager,::close,::open)
try {
windowManager!!.addView(overlayView, params)
checkProcess()
isShowing = true
} catch (e: Exception) {
e.printStackTrace()
@@ -145,10 +184,30 @@ object OverlayLeftViewUtils {
}
}
private fun addTarget(context: Activity) {
try {
val content =
context.window.decorView.findViewById<FrameLayout>(android.R.id.content)
val textView = View(context)
textView.id = R.id.ids_video_anchor
addDragTarget(textView)
val param: FrameLayout.LayoutParams =
FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT)
param.gravity = Gravity.CENTER_VERTICAL
param.width = 143
param.height = 308
textView.layoutParams = param
content.addView(textView)
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}
/**
* 打开状态栏
*/
private fun open(overlayView: View,windowManager: WindowManager?) {
checkProcess()
val valueAnimator = ValueAnimator.ofInt(params!!.x, 0)
valueAnimator.duration = 100
valueAnimator.interpolator = LinearInterpolator()
@@ -176,28 +235,50 @@ object OverlayLeftViewUtils {
valueAnimator.start()
}
fun open(){
if(isShowing) {
overlayView?.let { open(it, windowManager) }
}
}
fun dragTarget(view :View){
if(view!=null) {
dragList.add(view)
params?.let {
view.setOnTouchListener(
ItemViewTouchListener(
overlayView!!, params!!, windowManager, ::close,
::open
)
)
private fun checkProcess() {
ThreadPoolService.execute {
val currentProcessName = ProcessUtils.getCurrentProcessName()
if (currentProcessName.contains(":video")) {
return@execute
}
val allBackgroundProcesses = ProcessUtils.getAllBackgroundProcesses()
var haveProcess = false
allBackgroundProcesses.forEach {
if (it.contains(":video")) {
haveProcess = true
return@forEach
}
}
if (!haveProcess) {
EmptyService.startService(Utils.getApp())
}
}
}
fun removeDragTarget(view: View){
dragList.remove(view)
fun addDragTarget(view :View?){
LeftMenuOpen.registerDragView(view)
}
fun removeDragTarget(view: View?){
LeftMenuOpen.unRegisterDragView(view)
}
/**
*
*/
fun transmissionIndex(index:Int){
if(!ProcessUtils.isMainProcess(Utils.getApp())) {
LeftMenuOpen.transmissionIndex(index)
}
}
fun transmissionIndexGet(index: Int){
overlayView?.let {
val lvSelectItem = it.findViewById<ListView>(R.id.lv_select_item)
val listAdapter = lvSelectItem.adapter as ListAdapter
listAdapter.setSelectIndex(index,false)
}
}
private fun closeByTime(
@@ -226,8 +307,10 @@ object OverlayLeftViewUtils {
valueAnimator.duration = 100
valueAnimator.interpolator = LinearInterpolator()
valueAnimator.addUpdateListener {
params?.x = it.animatedValue as Int
windowManager?.updateViewLayout(overlayView, params)
params?.let { paramsIn->
paramsIn.x = it.animatedValue as Int
windowManager?.updateViewLayout(overlayView, paramsIn)
}
}
valueAnimator.addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator?) {}
@@ -237,11 +320,14 @@ object OverlayLeftViewUtils {
pivotY = (height /2).toFloat()
rotation = 180f
}
params?.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
windowManager?.updateViewLayout(overlayView, params)
params?.let {
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
windowManager?.updateViewLayout(overlayView, it)
}
}
override fun onAnimationCancel(animation: Animator?) {}
override fun onAnimationRepeat(animation: Animator?) {}
@@ -249,16 +335,21 @@ object OverlayLeftViewUtils {
valueAnimator.start()
}
private fun layoutParams(ani: Int,view :View) {
private fun layoutParams(ani: Int,view :View,isOpen: Boolean) {
if(params ==null) {
params = WindowManager.LayoutParams()
}
params = WindowManager.LayoutParams()
params?.let {
it.width = WIDTH
it.height = WindowManager.LayoutParams.MATCH_PARENT
it.alpha = 1.0f
it.gravity = Gravity.START or Gravity.CENTER_HORIZONTAL
it.x = 0
if(isOpen) {
it.x = 0
}else{
it.x = DEVIATION_WIDTH
}
it.y = 0
it.format = PixelFormat.RGBA_8888
// 设置窗口类型为应用子窗口和PopupWindow同类型
@@ -277,27 +368,27 @@ object OverlayLeftViewUtils {
/**
* 移除覆盖View在Activity上面
*/
fun dismissOverlayView() {
fun dismissOverlayView(isMain:Boolean) {
if (!isShowing) {
return
}
subscribe?.let {
if (!it.isDisposed) {
it.dispose()
}
}
FullVideoUtils.dismissOverlayView(true)
// 管理的要关闭都得关闭
dragList.forEach {
it.setOnTouchListener(null)
}
dragList.clear()
closeConsult()
closeMovice()
releaseDelay(subscribe)
releaseDelay(subscribeLive)
releaseDelay(subscribeOVERVIEW)
subscribe = null
subscribeLive = null
subscribeOVERVIEW = null
// 管理的要关闭都得关闭
if(isMain) {
LeftMenuOpen.invoKeyByEventType(VideoActivity.EVENT_FINISH)
}
LeftMenuOpen.clearValue()
try {
if (windowManager != null && overlayView != null) {
windowManager!!.removeView(overlayView)
windowManager!!.removeViewImmediate(overlayView)
windowManager = null
params = null
}
if (overlayView!=null) {
overlayView = null
@@ -311,19 +402,11 @@ object OverlayLeftViewUtils {
}
}
private fun closeMovice() {
OverlayViewUtils.dismissOverlayView(taxiPassengerMogoMoviesView)
taxiPassengerMogoMoviesView= null
System.gc()
}
private fun closeConsult() {
OverlayViewUtils.dismissOverlayView(taxiPassengerMogoConsultView)
taxiPassengerMogoConsultView = null
System.gc()
}
private fun getViewBounds(view: View): Rect {
return Rect(view.left, view.top, view.right, view.bottom)
private fun releaseDelay(subscribe: Disposable?) {
subscribe?.let {
if (!it.isDisposed) {
it.dispose()
}
}
}
}

View File

@@ -0,0 +1,235 @@
package com.mogo.och.taxi.passenger.ui.video
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.graphics.PixelFormat
import android.os.Build
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.SeekBar
import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.wigets.OCHGradientTextView
import com.mogo.och.taxi.passenger.R
/**
* 视频全屏播放
*
* @author yangyakun
*/
@SuppressLint("StaticFieldLeak")
object FloatingDistanceInfoUtils {
private const val TAG = "OverlayViewUtils"
private var windowManager: WindowManager? = null
@Volatile
private var isShowing = false
private var params:WindowManager.LayoutParams?=null
private var paramsBottom:WindowManager.LayoutParams?=null
private var orderInfoView: View?=null
private var processView: SeekBar?=null
// 距离
private var actvDistancew: OCHGradientTextView?=null
// 距离单位
private var actvDistancewUnit: AppCompatTextView?=null
// 剩余时间
private var actvSurplusTime: OCHGradientTextView?=null
// 到达时间
private var actvArrivedTime: OCHGradientTextView?=null
private var actvSpeed: OCHGradientTextView?=null
/**
* 添加覆盖View在Activity上面
*/
@JvmOverloads
fun showOverlayView(context: Activity,ani: Int = -1,sumDis:Int) {
if (isShowing) {
return
}
if (windowManager == null) {
windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
}
orderInfoView = LayoutInflater.from(context)
.inflate(R.layout.taxi_p_window_float_distance_info, null) as ConstraintLayout
orderInfoView?.let { view ->
// 设置View显示模式沉浸式的侵入到状态栏导航栏
view.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
layoutParams(ani)
actvSpeed = view.findViewById(R.id.actv_speed)
actvDistancew = view.findViewById(R.id.actv_distancew)
actvDistancewUnit = view.findViewById(R.id.actv_distancew_unit)
actvSurplusTime = view.findViewById(R.id.actv_surplus_time)
actvArrivedTime = view.findViewById(R.id.actv_arrived_time)
val intArrayOf = intArrayOf(
context.resources.getColor(R.color.taxi_p_video_gradient_end),
context.resources.getColor(R.color.taxi_p_video_gradient_start)
)
actvSpeed?.setVertrial(true)
actvSpeed?.setmColorList(intArrayOf)
actvDistancew?.setVertrial(true)
actvDistancew?.setmColorList(intArrayOf)
actvSurplusTime?.setVertrial(true)
actvSurplusTime?.setmColorList(intArrayOf)
actvArrivedTime?.setVertrial(true)
actvArrivedTime?.setmColorList(intArrayOf)
processView = SeekBar(context)
processView?.let {
it.max = sumDis
layoutParamsBottom(-1)
it.setPadding(0,0,0,0)
it.progressDrawable = ContextCompat.getDrawable(context,R.drawable.taxi_video_order_process)
it.thumb = null
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
it.maxHeight = 14
it.minHeight = 14
}
}
// 如果正在展示中并且lastOverlayView不为null先做移除操作保证覆盖在最上面的View只有一个防止叠加导致无法移除
dismissOverlayView()
try {
windowManager!!.addView(orderInfoView, params)
windowManager!!.addView(processView, paramsBottom)
isShowing = true
} catch (e: Exception) {
e.printStackTrace()
}
}
}
private fun layoutParams(ani: Int) {
if(params ==null) {
params = WindowManager.LayoutParams()
}
params = WindowManager.LayoutParams()
params?.let {
it.width = WindowManager.LayoutParams.WRAP_CONTENT
it.height = WindowManager.LayoutParams.WRAP_CONTENT
it.alpha = 1.0f
it.gravity = Gravity.END or Gravity.TOP
it.x = 0
it.y = 199
it.format = PixelFormat.RGBA_8888
// 设置窗口类型为应用子窗口和PopupWindow同类型
it.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL
// 没有边界限制,允许窗口扩展到屏幕外
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
if (ani != -1) {
it.windowAnimations = ani
}
}
}
private fun layoutParamsBottom(ani: Int) {
if(paramsBottom ==null) {
paramsBottom = WindowManager.LayoutParams()
}
paramsBottom = WindowManager.LayoutParams()
paramsBottom?.let {
it.width = WindowManager.LayoutParams.MATCH_PARENT
it.height = WindowManager.LayoutParams.WRAP_CONTENT
it.alpha = 1.0f
it.gravity = Gravity.START or Gravity.BOTTOM
it.x = 0
it.y = 0
it.format = PixelFormat.RGBA_8888
// 设置窗口类型为应用子窗口和PopupWindow同类型
it.type = WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL
// 没有边界限制,允许窗口扩展到屏幕外
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
if (ani != -1) {
it.windowAnimations = ani
}
}
}
fun setSpeed(speed: Float) {
val newSpeed: Int = (Math.abs(speed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
UiThreadHandler.getsUiHandler().post {
actvSpeed?.text = "$newSpeed"
}
}
fun setDistance(meters:Long,remainDis: String?, disUnit: String, time: Int, arriveTime: String) {
UiThreadHandler.getsUiHandler().post {
actvDistancew?.text = "$remainDis"
actvDistancewUnit?.text = "距离($disUnit)"
actvSurplusTime?.text = "$time"
actvArrivedTime?.text = arriveTime
processView?.let {
val process = it.max - meters
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
it.setProgress(process.toInt(), true)
}else{
it.progress = process.toInt()
}
it.jumpDrawablesToCurrentState()
}
}
}
/**
* 移除覆盖View在Activity上面
*/
fun dismissOverlayView() {
if (!isShowing) {
return
}
try {
if (windowManager != null && orderInfoView != null) {
windowManager!!.removeViewImmediate(orderInfoView)
params = null
}
if (windowManager != null && processView != null) {
windowManager!!.removeViewImmediate(processView)
paramsBottom = null
}
if(windowManager!=null){
windowManager = null
}
if (orderInfoView!=null) {
orderInfoView = null
}
if(processView!=null){
processView = null
}
isShowing = false
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -10,15 +10,14 @@ import com.shuyu.gsyvideoplayer.GSYVideoManager
import java.lang.Exception
/**
* 遮罩层工具类
* 视频全屏播放
*
* @author mogoauto
* @author yangyakun
*/
@SuppressLint("StaticFieldLeak")
object FullVideoUtils {
private const val TAG = "OverlayViewUtils"
private var windowManager: WindowManager? = null
private var applicationContext: Context? = null
@Volatile
private var isShowing = false
@@ -33,9 +32,6 @@ object FullVideoUtils {
*/
@JvmOverloads
fun showOverlayView(context: Activity, overlayView: View, ani: Int = -1) {
if (applicationContext == null) {
applicationContext = context.applicationContext
}
if (windowManager == null) {
windowManager = context.windowManager
}
@@ -86,7 +82,8 @@ object FullVideoUtils {
}
try {
if (windowManager != null) {
windowManager!!.removeView(lastOverlayView)
windowManager!!.removeViewImmediate(lastOverlayView)
windowManager = null
}
if (lastOverlayView != null) {
lastOverlayView = null

View File

@@ -14,6 +14,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.taxi.passenger.R;
import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay;
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack;
import java.util.List;
@@ -23,6 +24,7 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
private List<TaxiPassengerVideoPlay> itemDataList = null;
private Context context = null;
private OnThumbImageClilckListener onThumbImageClilckListener;
private RecyclerView recyclerView;
public OnThumbImageClilckListener getOnThumbImageClilckListener() {
return onThumbImageClilckListener;
@@ -32,9 +34,10 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
this.onThumbImageClilckListener = onThumbImageClilckListener;
}
public RecyclerVideoAdapter(Context context, List<TaxiPassengerVideoPlay> itemDataList) {
public RecyclerVideoAdapter(Context context, List<TaxiPassengerVideoPlay> itemDataList,RecyclerView recyclerView) {
this.itemDataList = itemDataList;
this.context = context;
this.recyclerView = recyclerView;
}
public TaxiPassengerVideoPlay getItemByPosition(int position){
@@ -53,6 +56,8 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
return recyclerItemVideoHolder;
}
@Override
public void onBindViewHolder(@NonNull final RecyclerItemVideoHolder holder, int position) {
final TaxiPassengerVideoPlay taxiPassengerVideoPlay = itemDataList.get(position);
@@ -69,7 +74,6 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
.load(taxiPassengerVideoPlay.getImageUrl())
.apply(new RequestOptions().placeholder(R.drawable.taxi_p_video_holder).centerCrop())
.into(holder.gsyVideoPlayer.coverImage);
holder.gsyVideoPlayer.vPpenLeft.setVisibility(View.GONE);
holder.gsyVideoPlayer.getThumbImageViewLayout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -78,6 +82,33 @@ public class RecyclerVideoAdapter extends RecyclerView.Adapter<RecyclerItemVideo
}
}
});
holder.gsyVideoPlayer.setVideoAllCallBack(new GSYSampleCallBack(){
@Override
public void onAutoComplete(String url, Object... objects) {
holder.gsyVideoPlayer.onVideoReset();
if(holder.getAbsoluteAdapterPosition()==getItemCount()-1){
recyclerView.smoothScrollToPosition(0);
}else {
recyclerView.smoothScrollToPosition(holder.getAbsoluteAdapterPosition()+1);
}
}
@Override
public void onClickBlank(String url, Object... objects) {
super.onClickBlank(url, objects);
recyclerView.smoothScrollToPosition(holder.getAbsoluteAdapterPosition());
}
@Override
public void onPlayError(String url, Object... objects) {
ToastUtils.showLong("哎呀,出错了,看看其他视频吧");
}
@Override
public void onClickStartError(String url, Object... objects) {
ToastUtils.showLong("哎呀,出错了,看看其他视频吧");
}
});
}
@Override

View File

@@ -1,271 +0,0 @@
package com.mogo.och.taxi.passenger.ui.video
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.drawable.BitmapDrawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselZoomPostLayoutListener
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CenterScrollListener
import com.mogo.och.taxi.passenger.utils.blur.GlideBlurTransform
import com.mogo.och.taxi.passenger.widget.ConsultVideoPlayer
import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import kotlin.math.floor
/**
*
* 蘑菇咨询
* Created on 2022/5/16
*/
class TaxiPassengerMogoConsultView :RelativeLayout {
constructor(context: Context?) : super(context)
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
private lateinit var rvVideoPlaylist: RecyclerView
private lateinit var indicatorView: IndicatorView
private lateinit var clContain: ConstraintLayout
private lateinit var vOpenLeft: View
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.taxi_p_arrived_mogo_consult, this, true)
rvVideoPlaylist = findViewById(R.id.rv_video_playlist)
indicatorView = findViewById(R.id.indicatorView)
clContain = findViewById(R.id.cl_contain)
vOpenLeft = findViewById(R.id.v_open_left)
vOpenLeft.setOnClickListener {
OverlayLeftViewUtils.open()
}
OverlayLeftViewUtils.dragTarget(vOpenLeft)
val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708596763/全车型混剪增加红旗车队.m4v","https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969511280/车队.png","蘑菇车联覆盖生活的方方面面"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708554279/红旗车队.m4v","https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969553174/红旗重新排版.png","蘑菇车联之红旗车队"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708499497/大运会合作解说版.m4v","https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969536177/大运会.png","蘑菇车联牵手成都大运会"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708409810/20210610重新排版3屏.m4v","https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969579713/三屏.png","多视角体验蘑菇车联自动驾驶"))
val recyclerVideoAdapter = RecyclerVideoAdapter(context, arrayListOf)
val carouselLayoutManager = CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true)
carouselLayoutManager.setPostLayoutListener(CarouselZoomPostLayoutListener ())
carouselLayoutManager.maxVisibleItems = 1
indicatorView.notifyDataChanged(arrayListOf.size)
indicatorView.setSlideMode(IndicatorSlideMode.SCALE)
indicatorView.setOrientation(IndicatorOrientation.INDICATOR_HORIZONTAL)
indicatorView.setIndicatorStyle(IndicatorStyle.ROUND_RECT)
indicatorView.setSliderColor(Color.parseColor("#80FFFFFF"), Color.parseColor("#2972FF"),Color.parseColor("#27C8FF"))
indicatorView.setSliderWidth(16f, 101f)
indicatorView.setSliderHeight(16f)
indicatorView.setSliderGap(30f)
rvVideoPlaylist.addOnScrollListener(object: CenterScrollListener() {
var prePlayerPosition = 0
override fun pageSelect(recyclerView: RecyclerView?, newState: Int) {
//播放视频
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
indicatorView.onPageSelected(centerItemPosition)
if(player is ConsultVideoPlayer){
if(prePlayerPosition!=centerItemPosition) {
if(player.currentState==GSYVideoView.CURRENT_STATE_PAUSE){
player.onVideoReset()
}else{
}
val playerHolder = carouselLayoutManager.findViewByPosition(prePlayerPosition)
val prePlayer = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
prePlayer?.let {
if(it is ConsultVideoPlayer){
it.onVideoReset()
}
}
val taxiPassengerVideoPlay = arrayListOf[centerItemPosition]
setBackageAndPlayNext(taxiPassengerVideoPlay, player, centerItemPosition)
}else{
player.onVideoResume(false)
}
}
prePlayerPosition = centerItemPosition
}
override fun pageStop() {
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(player is ConsultVideoPlayer){
player.onVideoPause()
}
}
})
carouselLayoutManager.addOnDargAutoDiffListener { adapterPosition, currentPosition ->
val fl = adapterPosition - floor(adapterPosition)
var currentIndex = currentPosition
if(fl>0.5){
if(currentPosition==0){
currentIndex = rvVideoPlaylist.adapter!!.itemCount-1
}else {
currentIndex -= 1
}
}
indicatorView.onPageScrolled(currentIndex, fl, 0)
}
recyclerVideoAdapter.setOnThumbImageClilckListener {
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(player is ConsultVideoPlayer) {
player.onVideoReset()
player.thumbImageViewLayout.visibility = View.VISIBLE
}
rvVideoPlaylist.smoothScrollToPosition(it)
}
rvVideoPlaylist.layoutManager = carouselLayoutManager
rvVideoPlaylist.setHasFixedSize(true)
rvVideoPlaylist.adapter = recyclerVideoAdapter
}
private fun setBackageAndPlayNext(
taxiPassengerVideoPlay: TaxiPassengerVideoPlay,
player: ConsultVideoPlayer,
centerItemPosition: Int,
) {
// 设置背景图片
Glide.with(context).asBitmap()
.load(taxiPassengerVideoPlay.imageUrl)
.apply(
RequestOptions().transform(
GlideBlurTransform(context, taxiPassengerVideoPlay.imageUrl, 100)
)
)
.into(object : SimpleTarget<Bitmap?>() {
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap?>?
) {
clContain.background = BitmapDrawable(context.resources, resource)
}
})
if(player.getVideoAllCallBack()==null) {
player.setVideoAllCallBack(object : GSYSampleCallBack() {
override fun onAutoComplete(url: String?, vararg objects: Any?) {
player.onVideoReset()
val itemCount = rvVideoPlaylist.adapter?.itemCount
itemCount?.let {
if (centerItemPosition == itemCount - 1) {
rvVideoPlaylist.smoothScrollToPosition(0)
} else {
rvVideoPlaylist.smoothScrollToPosition(centerItemPosition + 1)
}
}
}
override fun onClickBlank(url: String?, vararg objects: Any?) {
super.onClickBlank(url, *objects)
rvVideoPlaylist.smoothScrollToPosition(centerItemPosition)
}
override fun onPlayError(url: String?, vararg objects: Any?) {
super.onPlayError(url, *objects)
ToastUtils.showLong("哎呀,出错了,看看其他视频吧")
}
override fun onClickStartError(url: String?, vararg objects: Any?) {
super.onClickStartError(url, *objects)
ToastUtils.showLong("哎呀,出错了,看看其他视频吧")
}
})
}
}
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
super.onWindowFocusChanged(hasWindowFocus)
val carouselLayoutManager = rvVideoPlaylist.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
if (player is ConsultVideoPlayer) {
if(hasWindowFocus){// 获取焦点两种情况
// 恢复播放和开始播放
if(player.isIfCurrentIsFullscreen){// 全屏了
}else {
when (player.currentState) {
GSYVideoView.CURRENT_STATE_PAUSE -> {
player.onVideoResume(false)
}
GSYVideoView.CURRENT_STATE_PLAYING -> {
}
else -> {
val recyclerVideoAdapter =
rvVideoPlaylist.adapter as RecyclerVideoAdapter
setBackageAndPlayNext(
recyclerVideoAdapter.getItemByPosition(centerItemPosition),
player, centerItemPosition
)
//player.startPlayLogic()
}
}
}
}else {
// 离开应用 暂停视频
// 关闭 onDetachedFromWindow 会reset
if(player.isIfCurrentIsFullscreen){// 全屏了
}else {
player.onVideoPause()
}
}
}
}
}
private fun getPlayer(carouselLayoutManager: CarouselLayoutManager): Pair<Int, ConsultVideoPlayer?> {
val centerItemPosition: Int = carouselLayoutManager.centerItemPosition
val playerHolder = carouselLayoutManager.findViewByPosition(centerItemPosition)
val player = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
return Pair(centerItemPosition, player)
}
override fun onDetachedFromWindow() {
val carouselLayoutManager = rvVideoPlaylist.layoutManager as CarouselLayoutManager
val (_: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
if(player is ConsultVideoPlayer){
player.currentPlayer.release()
player.onVideoReset()
}
}
OverlayLeftViewUtils.removeDragTarget(vOpenLeft)
super.onDetachedFromWindow()
}
init {
try {
initView(context)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -1,272 +0,0 @@
package com.mogo.och.taxi.passenger.ui.video
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.drawable.BitmapDrawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.transition.Transition
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselZoomPostLayoutListener
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CenterScrollListener
import com.mogo.och.taxi.passenger.utils.blur.GlideBlurTransform
import com.mogo.och.taxi.passenger.widget.ConsultVideoPlayer
import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import java.util.*
import kotlin.math.floor
/**
*
* 蘑菇咨询
* Created on 2022/5/16
*/
class TaxiPassengerMogoMoviesView :RelativeLayout {
constructor(context: Context?) : super(context)
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
private lateinit var rvVideoPlaylist: RecyclerView
private lateinit var indicatorView: IndicatorView
private lateinit var clContain: ConstraintLayout
private lateinit var vOpenLeft: View
private fun initView(context: Context) {
LayoutInflater.from(context).inflate(R.layout.taxi_p_mogo_movies, this, true)
rvVideoPlaylist = findViewById(R.id.rv_video_playlist)
indicatorView = findViewById(R.id.indicatorView)
clContain = findViewById(R.id.cl_contain)
vOpenLeft = findViewById(R.id.v_open_left)
vOpenLeft.setOnClickListener {
OverlayLeftViewUtils.open()
}
OverlayLeftViewUtils.dragTarget(vOpenLeft)
val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558672856/小宝宝.mp4","https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559345882/1.png","小宝宝"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558697055/小猫.mp4","https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559367261/2.png","小猫"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558730074/星空.mp4","https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559406169/4.png","星空"))
arrayListOf.add(TaxiPassengerVideoPlay("https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558644708/海浪.mp4","https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559384635/3.png","星空"))
val recyclerVideoAdapter = RecyclerVideoAdapter(context, arrayListOf)
val carouselLayoutManager = CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true)
carouselLayoutManager.setPostLayoutListener(CarouselZoomPostLayoutListener ())
carouselLayoutManager.maxVisibleItems = 1
indicatorView.notifyDataChanged(arrayListOf.size)
indicatorView.setSlideMode(IndicatorSlideMode.SCALE)
indicatorView.setOrientation(IndicatorOrientation.INDICATOR_HORIZONTAL)
indicatorView.setIndicatorStyle(IndicatorStyle.ROUND_RECT)
indicatorView.setSliderColor(Color.parseColor("#80FFFFFF"), Color.parseColor("#2972FF"),Color.parseColor("#27C8FF"))
indicatorView.setSliderWidth(16f, 101f)
indicatorView.setSliderHeight(16f)
indicatorView.setSliderGap(30f)
rvVideoPlaylist.addOnScrollListener(object: CenterScrollListener() {
var prePlayerPosition = 0
override fun pageSelect(recyclerView: RecyclerView?, newState: Int) {
//播放视频
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
indicatorView.onPageSelected(centerItemPosition)
if(player is ConsultVideoPlayer){
if(prePlayerPosition!=centerItemPosition) {
if(player.currentState==GSYVideoView.CURRENT_STATE_PAUSE){
player.onVideoReset()
}else{
}
val playerHolder = carouselLayoutManager.findViewByPosition(prePlayerPosition)
val prePlayer = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
prePlayer?.let {
if(it is ConsultVideoPlayer){
it.onVideoReset()
}
}
val taxiPassengerVideoPlay = arrayListOf[centerItemPosition]
setBackageAndPlayNext(taxiPassengerVideoPlay, player, centerItemPosition)
}else{
player.onVideoResume(false)
}
}
prePlayerPosition = centerItemPosition
}
override fun pageStop() {
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(player is ConsultVideoPlayer){
player.onVideoPause()
}
}
})
carouselLayoutManager.addOnDargAutoDiffListener { adapterPosition, currentPosition ->
val fl = adapterPosition - floor(adapterPosition)
var currentIndex = currentPosition
if(fl>0.5){
if(currentPosition==0){
currentIndex = rvVideoPlaylist.adapter!!.itemCount-1
}else {
currentIndex -= 1
}
}
indicatorView.onPageScrolled(currentIndex, fl, 0)
}
recyclerVideoAdapter.setOnThumbImageClilckListener {
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(player is ConsultVideoPlayer) {
player.onVideoReset()
player.thumbImageViewLayout.visibility = View.VISIBLE
}
rvVideoPlaylist.smoothScrollToPosition(it)
}
rvVideoPlaylist.layoutManager = carouselLayoutManager
rvVideoPlaylist.setHasFixedSize(true)
rvVideoPlaylist.adapter = recyclerVideoAdapter
}
private fun setBackageAndPlayNext(
taxiPassengerVideoPlay: TaxiPassengerVideoPlay,
player: ConsultVideoPlayer,
centerItemPosition: Int,
) {
// 设置背景图片
Glide.with(context).asBitmap()
.load(taxiPassengerVideoPlay.imageUrl)
.apply(
RequestOptions().transform(
GlideBlurTransform(context, taxiPassengerVideoPlay.imageUrl, 85)
)
)
.into(object : SimpleTarget<Bitmap?>() {
override fun onResourceReady(
resource: Bitmap,
transition: Transition<in Bitmap?>?
) {
clContain.background = BitmapDrawable(context.resources, resource)
}
})
if(player.getVideoAllCallBack()==null) {
player.setVideoAllCallBack(object : GSYSampleCallBack() {
override fun onAutoComplete(url: String?, vararg objects: Any?) {
player.onVideoReset()
val itemCount = rvVideoPlaylist.adapter?.itemCount
itemCount?.let {
if (centerItemPosition == itemCount - 1) {
rvVideoPlaylist.smoothScrollToPosition(0)
} else {
rvVideoPlaylist.smoothScrollToPosition(centerItemPosition + 1)
}
}
}
override fun onClickBlank(url: String?, vararg objects: Any?) {
super.onClickBlank(url, *objects)
rvVideoPlaylist.smoothScrollToPosition(centerItemPosition)
}
override fun onPlayError(url: String?, vararg objects: Any?) {
super.onPlayError(url, *objects)
ToastUtils.showLong("哎呀,出错了,看看其他视频吧")
}
override fun onClickStartError(url: String?, vararg objects: Any?) {
super.onClickStartError(url, *objects)
ToastUtils.showLong("哎呀,出错了,看看其他视频吧")
}
})
}
}
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
super.onWindowFocusChanged(hasWindowFocus)
val carouselLayoutManager = rvVideoPlaylist.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
if (player is ConsultVideoPlayer) {
if(hasWindowFocus){// 获取焦点两种情况
// 恢复播放和开始播放
if(player.isIfCurrentIsFullscreen){// 全屏了
}else {
when (player.currentState) {
GSYVideoView.CURRENT_STATE_PAUSE -> {
player.onVideoResume(false)
}
GSYVideoView.CURRENT_STATE_PLAYING -> {
}
else -> {
val recyclerVideoAdapter =
rvVideoPlaylist.adapter as RecyclerVideoAdapter
setBackageAndPlayNext(
recyclerVideoAdapter.getItemByPosition(centerItemPosition),
player, centerItemPosition
)
//player.startPlayLogic()
}
}
}
}else {
// 离开应用 暂停视频
// 关闭 onDetachedFromWindow 会reset
if(player.isIfCurrentIsFullscreen){// 全屏了
}else {
player.onVideoPause()
}
}
}
}
}
private fun getPlayer(carouselLayoutManager: CarouselLayoutManager): Pair<Int, ConsultVideoPlayer?> {
val centerItemPosition: Int = carouselLayoutManager.centerItemPosition
val playerHolder = carouselLayoutManager.findViewByPosition(centerItemPosition)
val player = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
return Pair(centerItemPosition, player)
}
override fun onDetachedFromWindow() {
val carouselLayoutManager = rvVideoPlaylist.layoutManager as CarouselLayoutManager
val (_: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
if(player is ConsultVideoPlayer){
player.currentPlayer.release()
player.onVideoReset()
}
}
OverlayLeftViewUtils.removeDragTarget(vOpenLeft)
super.onDetachedFromWindow()
}
init {
try {
initView(context)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -0,0 +1,400 @@
package com.mogo.och.taxi.passenger.ui.video
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.NumberFormatUtil
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst
import com.mogo.och.taxi.passenger.mulprocess.ICallback
import com.mogo.och.taxi.passenger.ui.leftmenu.LeftMenuOpen
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
import com.mogo.och.taxi.passenger.event.FinishActivity
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselZoomPostLayoutListener
import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CenterScrollListener
import com.mogo.och.taxi.passenger.utils.FixMemoryLeak
import com.mogo.och.taxi.passenger.widget.ConsultVideoPlayer
import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode
import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
import kotlin.math.floor
class VideoActivity : AppCompatActivity() {
private var rvVideoPlaylist: RecyclerView?=null
private lateinit var indicatorView: IndicatorView
private lateinit var clContain: ConstraintLayout
private lateinit var acivTitleIcon: AppCompatImageView
private lateinit var tvTitle: TextView
private val arrayListOf = ArrayList<TaxiPassengerVideoPlay>()
companion object{
const val VIDEOTYPE = "VIDEOTYPE"
const val VIDEOTYPE_CONSULT = 0
const val VIDEOTYPE_MOIES = 1
const val VIDEOTYPE_CLOSE = 2
const val EVENT_FINISH = 0
fun startActivity(context:Context,videoType:Int,sumDis:Int){
val intent = Intent(context, VideoActivity::class.java)
intent.putExtra(VIDEOTYPE, videoType)
intent.putExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS,sumDis)
context.startActivity(intent)
}
}
private var videotype = VIDEOTYPE_CONSULT
val callBack = object : ICallback.Stub() {
override fun onResult(meters :Long, timeInSecond:Long,speed:Float) {
if(speed<0){
// 距离单位
var disUnit = "公里"
// 距离
var remainDis: String? = "0"
if (meters > 0) {
if (meters / 1000 < 1) {
disUnit = ""
remainDis = Math.round(meters.toFloat()).toString()
} else {
disUnit = "公里"
remainDis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
}
}
// 剩余时间
val time = Math.ceil(timeInSecond.toDouble() / 60f).toInt()
val beforeTime = Calendar.getInstance()
beforeTime.add(Calendar.MINUTE, time)
//到达时间
val arriveTime = DateTimeUtil.formatCalendarToString(beforeTime, DateTimeUtil.TAXI_HH_mm)
FloatingDistanceInfoUtils.setDistance(meters,remainDis,disUnit,time,arriveTime)
}else{
FloatingDistanceInfoUtils.setSpeed(speed)
}
}
override fun postEvent(type: Int) {
when (type) {
EVENT_FINISH -> {
finish()
}
else -> {}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EventBus.getDefault().register(this)
setContentView(R.layout.taxi_p_arrived_mogo_consult)
initView()
configPage()
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)
configPage()
}
private fun configPage() {
FullVideoUtils.dismissOverlayView(true)
releaseOnNewInstance()
when (intent.getIntExtra(VIDEOTYPE, VIDEOTYPE_CONSULT)) {
VIDEOTYPE_CONSULT -> {
videotype = VIDEOTYPE_CONSULT
acivTitleIcon.setImageResource(R.drawable.taxi_p_mogo_consult_title_icon)
tvTitle.text = "蘑菇资讯"
initConsultData()
}
VIDEOTYPE_MOIES -> {
videotype = VIDEOTYPE_MOIES
acivTitleIcon.setImageResource(R.drawable.taxi_p_mogo_movies_title_icon)
tvTitle.text = "影视娱乐"
initMoviesData()
}
}
initListener()
initData()
LeftMenuOpen.registerCallback(callBack)
}
private fun initConsultData(){
arrayListOf.clear()
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708596763/全车型混剪增加红旗车队.m4v",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969511280/车队.png",
"蘑菇车联覆盖生活的方方面面"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708554279/红旗车队.m4v",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969553174/红旗重新排版.png",
"蘑菇车联之红旗车队"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708499497/大运会合作解说版.m4v",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969536177/大运会.png",
"蘑菇车联牵手成都大运会"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708409810/20210610重新排版3屏.m4v",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969579713/三屏.png",
"多视角体验蘑菇车联自动驾驶"
)
)
}
private fun initMoviesData() {
arrayListOf.clear()
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558672856/小宝宝.mp4",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559345882/1.png",
"小宝宝"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558697055/小猫.mp4",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559367261/2.png",
"小猫"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558730074/星空.mp4",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559406169/4.png",
"星空"
)
)
arrayListOf.add(
TaxiPassengerVideoPlay(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558644708/海浪.mp4",
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559384635/3.png",
"星空"
)
)
}
private fun initData() {
val carouselLayoutManager = CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true)
carouselLayoutManager.setPostLayoutListener(CarouselZoomPostLayoutListener())
carouselLayoutManager.maxVisibleItems = 1
indicatorView.notifyDataChanged(arrayListOf.size)
indicatorView.setSlideMode(IndicatorSlideMode.SCALE)
indicatorView.setOrientation(IndicatorOrientation.INDICATOR_HORIZONTAL)
indicatorView.setIndicatorStyle(IndicatorStyle.ROUND_RECT)
indicatorView.setSliderColor(
Color.parseColor("#FFFFFF"), Color.parseColor("#26C5FD"),
Color.parseColor("#26C5FD")
)
indicatorView.setSliderWidth(9f, 54f)
indicatorView.setSliderHeight(9f)
indicatorView.setSliderGap(36f)
rvVideoPlaylist?.addOnScrollListener(object : CenterScrollListener() {
var prePlayerPosition = 0
override fun pageSelect(recyclerView: RecyclerView?, newState: Int) {
//播放视频
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
indicatorView.onPageSelected(centerItemPosition)
if (player is ConsultVideoPlayer) {
if (prePlayerPosition != centerItemPosition) {
if (player.currentState == GSYVideoView.CURRENT_STATE_PAUSE) {
player.onVideoReset()
}
val playerHolder =
carouselLayoutManager.findViewByPosition(prePlayerPosition)
val prePlayer =
playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
prePlayer?.onVideoReset()
val taxiPassengerVideoPlay = arrayListOf[centerItemPosition]
setBackageAndPlayNext(taxiPassengerVideoPlay)
} else {
player.onVideoResume(false)
}
}
prePlayerPosition = centerItemPosition
}
override fun pageStop() {
val (_: Int, player) = getPlayer(carouselLayoutManager)
if (player is ConsultVideoPlayer) {
player.onVideoPause()
}
}
})
carouselLayoutManager.addOnDargAutoDiffListener { adapterPosition, currentPosition ->
val fl = adapterPosition - floor(adapterPosition)
var currentIndex = currentPosition
if (fl > 0.5) {
if (currentPosition == 0) {
currentIndex = rvVideoPlaylist?.adapter!!.itemCount - 1
} else {
currentIndex -= 1
}
}
indicatorView.onPageScrolled(currentIndex, fl, 0)
}
val recyclerVideoAdapter = RecyclerVideoAdapter(this, arrayListOf,rvVideoPlaylist)
recyclerVideoAdapter.setOnThumbImageClilckListener {
val (_: Int, player) = getPlayer(carouselLayoutManager)
if (player is ConsultVideoPlayer) {
player.onVideoReset()
player.thumbImageViewLayout.visibility = View.VISIBLE
}
rvVideoPlaylist?.smoothScrollToPosition(it)
}
rvVideoPlaylist?.layoutManager = carouselLayoutManager
rvVideoPlaylist?.setHasFixedSize(true)
rvVideoPlaylist?.adapter = recyclerVideoAdapter
}
private fun getPlayer(carouselLayoutManager: CarouselLayoutManager): Pair<Int, ConsultVideoPlayer?> {
val centerItemPosition: Int = carouselLayoutManager.centerItemPosition
val playerHolder = carouselLayoutManager.findViewByPosition(centerItemPosition)
val player = playerHolder?.findViewById<ConsultVideoPlayer>(R.id.video_item_player)
return Pair(centerItemPosition, player)
}
private fun initListener() {
}
private fun initView() {
rvVideoPlaylist = findViewById(R.id.rv_video_playlist)
indicatorView = findViewById(R.id.indicatorView)
clContain = findViewById(R.id.cl_contain)
acivTitleIcon = findViewById(R.id.aciv_title_icon)
tvTitle = findViewById(R.id.tv_mogo_consult)
acivTitleIcon.setOnClickListener {
finish()
}
}
private fun setBackageAndPlayNext(taxiPassengerVideoPlay: TaxiPassengerVideoPlay) {
// 设置背景图片
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
when (videotype){
VIDEOTYPE_CONSULT -> {
OverlayLeftViewUtils.showOverlayView(this,isOpen = false, checkIndex = OverlayLeftViewUtils.CONSULT)
}
VIDEOTYPE_MOIES -> {
OverlayLeftViewUtils.showOverlayView(this,isOpen = false, checkIndex = OverlayLeftViewUtils.MOVIE)
}
}
val sumDis = intent.getIntExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0)
FloatingDistanceInfoUtils.showOverlayView(this,sumDis=sumDis)
}
override fun onResume() {
super.onResume()
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(centerItemPosition<0){
setBackageAndPlayNext(arrayListOf[0])
}
player?.let {
if (player.isIfCurrentIsFullscreen) {// 全屏了
} else {
when (player.currentState) {
GSYVideoView.CURRENT_STATE_PAUSE -> {
player.onVideoResume(false)
}
GSYVideoView.CURRENT_STATE_PLAYING -> {
}
else -> {
}
}
}
}
}
override fun onPause() {
super.onPause()
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
if (player is ConsultVideoPlayer) {
// 离开应用 暂停视频
// 关闭 onDetachedFromWindow 会reset
if (player.isIfCurrentIsFullscreen) {// 全屏了
} else {
player.onVideoPause()
}
}
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun finishActivity(event: FinishActivity){
val intent = Intent()
val parse = Uri.parse("mogo://launcher/main/switch2?type=launch")
intent.data = parse
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
startActivity(intent)
finish()
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
LeftMenuOpen.unregisterCallback(callBack)
releaseOnNewInstance()
OverlayLeftViewUtils.dismissOverlayView(false)
FloatingDistanceInfoUtils.dismissOverlayView()
FixMemoryLeak.fixLeak(this)
}
private fun releaseOnNewInstance() {
if (rvVideoPlaylist!=null&&rvVideoPlaylist?.layoutManager != null) {
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
val (_: Int, player) = getPlayer(carouselLayoutManager)
player?.let {
player.currentPlayer.release()
player.onVideoReset()
}
}
FullVideoUtils.dismissOverlayView(true)
}
override fun onBackPressed() {}
}

View File

@@ -33,10 +33,10 @@ public class CarouselZoomPostLayoutListener extends CarouselLayoutManager.PostLa
translateY = Math.signum(itemPositionToCenterDiff) * translateYGeneral;
translateX = 0;
} else {
final float translateXGeneral = (child.getMeasuredWidth()*0.9f) * (1 - scale) / 2f;
final float translateXGeneral = child.getMeasuredWidth() * (1 - scale)/8;
translateX = Math.signum(itemPositionToCenterDiff) * translateXGeneral;
translateY = 0;
}
return new ItemTransformation(scale,scale, scale, translateX, translateY);
return new ItemTransformation(scale,scale, scale, 0, translateY);
}
}

View File

@@ -0,0 +1,42 @@
package com.mogo.och.taxi.passenger.utils;
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import java.lang.reflect.Field;
/**
* memory leak fix:
* <p>
* InputMethodManager#mLastSrvView reference Last Page Activity.
*/
public class FixMemoryLeak {
private static Field field;
private static boolean hasField = true;
public static void fixLeak(Context context) {
if (!hasField) {
return;
}
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm == null) {
return;
}
try {
if (field == null) {
field = imm.getClass().getDeclaredField("mCurRootView");
}
if (field == null) {
hasField = false;
}
if (field != null) {
field.setAccessible(true);
field.set(imm, null);
}
} catch (Throwable t) {
hasField = false;
}
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.och.taxi.passenger.utils;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -8,6 +9,9 @@ import android.os.Build;
import androidx.core.content.ContextCompat;
import com.mogo.eagle.core.network.utils.Util;
import com.mogo.eagle.core.utilcode.util.Utils;
/**
* @author: wangmingjun
* @date: 2021/12/7
@@ -34,4 +38,25 @@ public class PermissionUtil {
}
return false;
}
private static String processName = "";
public static String getCurProcessName() {
if(!processName.isEmpty()){
return processName;
}
// 获取此进程的标识符
int pid = android.os.Process.myPid();
// 获取活动管理器
ActivityManager activityManager = (ActivityManager)
Utils.getApp().getSystemService(Context.ACTIVITY_SERVICE);
// 从应用程序进程列表找到当前进程,是:返回当前进程名
for (ActivityManager.RunningAppProcessInfo appProcess :
activityManager.getRunningAppProcesses()) {
if (appProcess.pid == pid) {
return appProcess.processName;
}
}
return null;
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.och.taxi.passenger.utils
import android.content.Context
import android.graphics.*
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes
object ZoomDrawable {
fun zoomDrawableImage(context: Context,@DrawableRes id:Int,scaleX:Float,scaleY:Float):Drawable{
val bitmap: Bitmap = BitmapFactory.decodeResource(context.resources, id)
val bitmapWidth = bitmap.width
val bitmapHeight = bitmap.height
val matrix = Matrix()
matrix.postScale(scaleX, scaleY)
// 产生缩放后的Bitmap对象
val resizeBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmapWidth, bitmapHeight, matrix, true)
return BitmapDrawable(context.resources,resizeBitmap)
}
}

View File

@@ -4,38 +4,45 @@ import android.content.Context;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
public class GlideBlurTransform extends BitmapTransformation {
private String key;
private Context context;
private int blurRadius;
public GlideBlurTransform(Context context, String key, int blurRadius ) {
this.context = context;
public GlideBlurTransform(String key, int blurRadius) {
this.key = key;
this.blurRadius = blurRadius;
}
@Override
protected Bitmap transform( @NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight ) {
Bitmap lruBitmap = DiskLruCacheManager.getInstance(context).get(key);
if(lruBitmap!=null){
return lruBitmap;
}
Bitmap bitmap = FastBlurUtil.doBlur( toTransform, 1, blurRadius );
// 缓存高斯模糊图片
DiskLruCacheManager.getInstance( context ).put( key, bitmap );
return bitmap;
}
@Override
public void updateDiskCacheKey( MessageDigest messageDigest ) {
public boolean equals(@Nullable Object obj) {
if (obj instanceof GlideBlurTransform) {
return ((GlideBlurTransform) obj).key.equals(key);
}
return false;
}
@Override
public int hashCode() {
return key.hashCode();
}
@Override
public void updateDiskCacheKey( MessageDigest messageDigest ) {
messageDigest.update(key.getBytes(StandardCharsets.UTF_8));
}
}

View File

@@ -0,0 +1,55 @@
package com.mogo.och.taxi.passenger.utils.windowdispatch;
import android.graphics.Region;
import android.inputmethodservice.InputMethodService;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
public class OnComputeInternalInsetsListener implements InvocationHandler {
private Region touchRegion = null;
public Object getListener() {
Object target = null;
try {
Class class1 = Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener");
target = Proxy.newProxyInstance(OnComputeInternalInsetsListener.class.getClassLoader(),
new Class[]{class1}, this);
} catch (Exception e) {
e.printStackTrace();
}
return target;
}
public Region getTouchRegion() {
return touchRegion;
}
public void setTouchRegion(Region touchRegion) {
this.touchRegion = touchRegion;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
try {
Field regionField = args[0].getClass()
.getDeclaredField("touchableRegion");
regionField.setAccessible(true);
Field insetField = args[0].getClass()
.getDeclaredField("mTouchableInsets");
insetField.setAccessible(true);
if (touchRegion != null) {
Region region = (Region) regionField.get(args[0]);
region.set(touchRegion);
insetField.set(args[0], InputMethodService.Insets.TOUCHABLE_INSETS_REGION);
} else {
insetField.set(args[0], InputMethodService.Insets.TOUCHABLE_INSETS_FRAME);
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -0,0 +1,51 @@
package com.mogo.och.taxi.passenger.utils.windowdispatch;
import android.view.ViewTreeObserver;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
public class ReflectionUtils {
private ReflectionUtils() {
}
public static void removeOnComputeInternalInsetsListener(ViewTreeObserver viewTree) {
if (viewTree == null) {
return;
}
try {
Class<?> clazz = Class.forName("android.view.ViewTreeObserver");
Field field = viewTree.getClass().getDeclaredField("mOnComputeInternalInsetsListeners");
field.setAccessible(true);
Object listenerList = field.get(viewTree);
Method method = listenerList.getClass().getDeclaredMethod("getArray");
method.setAccessible(true);
ArrayList<Object> list = (ArrayList<Object>) method.invoke(listenerList);
Class<?> classes[] = {Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener")};
if (list != null && list.size() > 0) {
clazz.getDeclaredMethod("removeOnComputeInternalInsetsListener", classes).invoke(viewTree,
list.get(0));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void addOnComputeInternalInsetsListener(ViewTreeObserver viewTree, Object object) {
if (viewTree == null) {
return;
}
try {
Class<?> classes[] = {Class.forName("android.view.ViewTreeObserver$OnComputeInternalInsetsListener")};
Class<?> clazz = Class.forName("android.view.ViewTreeObserver");
clazz.getDeclaredMethod("addOnComputeInternalInsetsListener", classes).invoke(viewTree,
object);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.och.taxi.passenger.widget
import android.app.Activity
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.util.AttributeSet
import android.util.TypedValue
@@ -15,13 +16,14 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.AppCompatImageView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.marginTop
import androidx.core.app.ActivityCompat
import com.mogo.eagle.core.utilcode.util.TimeTransformUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.ui.leftmenu.OverlayLeftViewUtils
import com.mogo.och.taxi.passenger.ui.video.FullVideoUtils
import com.mogo.och.taxi.passenger.utils.ZoomDrawable
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
@@ -44,7 +46,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
private lateinit var totalTimeTextView: TextView
private lateinit var aivStartPlay: AppCompatImageView
private lateinit var layoutBottom: ConstraintLayout
lateinit var vPpenLeft: View
private lateinit var vPpenLeft: View
private var fullVideoPlayer:ConsultVideoPlayer?=null
var smalllPlayer:ConsultVideoPlayer?=null
@@ -64,6 +66,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
totalTimeTextView = findViewById(R.id.total)
aivStartPlay = findViewById(R.id.aiv_start_play)
layoutBottom = findViewById(R.id.layout_bottom)
vPpenLeft = findViewById(R.id.v_open_left)
fullscreenButton.setOnClickListener(this)
aivStartPlay.setOnClickListener(this)
if (mThumbImageViewLayout != null
@@ -74,12 +77,44 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL)
aivStartPlay.scaleX = 0.8f
aivStartPlay.scaleY = 0.8f
vPpenLeft = findViewById(R.id.v_open_left)
vPpenLeft.setOnClickListener {
OverlayLeftViewUtils.open()
mProgressBar.thumb = ZoomDrawable.zoomDrawableImage(context,R.drawable.bg_taxi_p_video_index,0.66f,0.66f)
}
private fun addDrageAnchor(){
vPpenLeft.visibility = VISIBLE
OverlayLeftViewUtils.addDragTarget(vPpenLeft)
layoutBottom.post {
val layoutParams = layoutBottom.layoutParams as ConstraintLayout.LayoutParams
layoutParams.setMargins(333,0,333,90)
layoutParams.height = 148
layoutBottom.layoutParams = layoutParams
}
OverlayLeftViewUtils.dragTarget(vPpenLeft)
mTopContainer.post {
val layoutParams = mTopContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParams.height = 320
mTopContainer.layoutParams = layoutParams
val background = layoutBottom.background as GradientDrawable
val x = arrayOf(12f, 12f,12f, 12f,12f, 12f,12f, 12f)
background.cornerRadii = x.toFloatArray()
layoutBottom.background = background
fullscreenButton.setPadding(92,0,92,0)
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 50f)
val layoutParams1 = titleTextView.layoutParams as ConstraintLayout.LayoutParams
layoutParams1.marginStart = 80
titleTextView.layoutParams = layoutParams1
aivStartPlay.scaleX = 1f
aivStartPlay.scaleY = 1f
val drawable = ActivityCompat.getDrawable(context, R.drawable.bg_taxi_p_video_index)
mProgressBar.thumb = drawable
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
mProgressBar.maxHeight = 6
mProgressBar.minHeight = 6
}
}
}
override fun getLayoutId(): Int {
@@ -181,6 +216,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
when (v?.id) {
R.id.fullscreen -> {
startWindowFullscreenOwn(context)
// startWindowFullscreen(context)
}
R.id.aiv_start_play -> {
if(currentState==GSYVideoView.CURRENT_STATE_PAUSE){
@@ -235,21 +271,6 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
}
}
fun fullMarainTop(){
if(mIfCurrentIsFullscreen&&smalllPlayer!=null) {
if(mTopContainer.marginTop==0) {
val layoutParams = mTopContainer.layoutParams as ConstraintLayout.LayoutParams
layoutParams.height = 336
mTopContainer.layoutParams = layoutParams
fullscreenButton.setPadding(80,0,80,0)
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 50f)
titleTextView.setPadding(30,0,0,0)
aivStartPlay.scaleX = 1f
aivStartPlay.scaleY = 1f
}
}
}
override fun setViewShowState(view: View?, visibility: Int) {
if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
return
@@ -259,7 +280,6 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
override fun onSurfaceAvailable(surface: Surface) {
super.onSurfaceAvailable(surface)
fullMarainTop()
if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
mThumbImageViewLayout.visibility = View.INVISIBLE
@@ -354,6 +374,7 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer {
gsyVideoPlayer.id = fullId
gsyVideoPlayer.isIfCurrentIsFullscreen = true
gsyVideoPlayer.setVideoAllCallBack(mVideoAllCallBack)
gsyVideoPlayer.addDrageAnchor()
cloneParams(this, gsyVideoPlayer)
val frameLayout = FrameLayout(context)
if (gsyVideoPlayer.fullscreenButton != null) {

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator android:propertyName="alpha" android:duration="1000" android:valueFrom="1.0" android:valueTo="0.0"/>
</set>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator android:propertyName="alpha" android:duration="1000" android:valueFrom="0.0" android:valueTo="1.0"/>
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Some files were not shown because too many files have changed in this diff Show More