[2.13.0-arch-opt] merge

This commit is contained in:
zhongchao
2023-02-07 15:06:28 +08:00
parent a382fc36c1
commit 1548c607da
71 changed files with 1014 additions and 1337 deletions

View File

@@ -52,6 +52,8 @@ dependencies {
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_function_v2x
}else {

View File

@@ -6,9 +6,6 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -28,7 +25,7 @@ import java.util.Objects;
* Created on 2022/3/29
*/
@Route(path = BusPassengerConst.PATH)
public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener {
public class MogoOCHBusPassenger implements IMogoOCH {
private static final String TAG = MogoOCHBusPassenger.class.getSimpleName();
private FragmentActivity mActivity;
@@ -45,8 +42,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
public Fragment createCoverage(@Nullable FragmentActivity activity, @Nullable Integer containerId) {
this.mActivity = activity;
this.mContainerId = containerId;
// UiThreadHandler.post(() -> stepIntoVrMode());
showFragment();
return null;
}
@@ -65,18 +61,6 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
@Override
public void init(Context context) {
MogoStatusManager.getInstance().registerStatusChangedListener("OchBus",StatusDescriptor.VR_MODE, this);
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue){
showFragment();
}else {
hideFragment();
}
}
}
/**

View File

@@ -8,6 +8,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.widget.ContentLoadingProgressBar;
import com.mogo.commons.mvp.IView;
@@ -15,14 +16,13 @@ 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.function.view.MapBizView;
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;
import com.mogo.och.common.module.wigets.OCHBorderShadowLayout;
/**
* Created on 2022/3/31
@@ -32,6 +32,7 @@ import com.mogo.och.common.module.wigets.OCHBorderShadowLayout;
public abstract class BusPassengerBaseFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> {
private static final String TAG = BusPassengerBaseFragment.class.getSimpleName();
private MapBizView mapBizView;
private TextView mCurrentArriveStation;
private TextView mCurrentArriveStationTitle;
private TextView mCurrentArriveTip;
@@ -56,12 +57,12 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
return TAG;
}
@Override
protected void initViews() {
//隐藏小地图
CallerSmpManager.INSTANCE.hidePanel();
mapBizView = findViewById(R.id.mapBizView);
mCurrentArriveStation = findViewById(R.id.bus_p_cur_station_name);
mCurrentArriveStationTitle = findViewById(R.id.bus_p_cur_station_title);
mCurrentArriveTip = findViewById(R.id.bus_p_cur_station_tip);
@@ -83,6 +84,37 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mapBizView.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
mapBizView.onResume();
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
mapBizView.onSaveInstanceState(outState);
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapBizView.onLowMemory();
}
@Override
public void onPause() {
super.onPause();
mapBizView.onPause();
}
@Override
public void onDestroyView() {
mapBizView.onDestroy();
super.onDestroyView();
}
/**

View File

@@ -4,6 +4,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="@dimen/dp_1860"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
android:id="@+id/steering_wheel"
android:layout_width="@dimen/dp_490"
@@ -26,6 +34,11 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<!--浓雾预警动画-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XFogEventView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"

View File

@@ -51,11 +51,12 @@ dependencies {
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxrecyclerview
compileOnly rootProject.ext.dependencies.recyclerviewadapterhelper
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation rootProject.ext.dependencies.androidxrecyclerview
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -10,9 +10,6 @@ import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.bus.constant.BusConst;
@@ -47,8 +44,6 @@ public class BusProvider implements IMogoOCH {
@Override
public void init(Context context) {
MogoStatusManager.getInstance().registerStatusChangedListener("OchBus"
, StatusDescriptor.VR_MODE, statusChangedListener);
}
private void showFragment() {
@@ -78,22 +73,6 @@ public class BusProvider implements IMogoOCH {
}
private final IMogoStatusChangedListener statusChangedListener = (descriptor, isTrue) -> {
if (descriptor == StatusDescriptor.VR_MODE) {
// 进入vr模式默认显示网约车小巴fragment
if (isTrue) {
showFragment();
} else {
hideFragment();
}
} else if (MogoStatusManager.getInstance().isVrMode()) {
// topView进行展示时推出网约车界面但是不隐藏整个fragment
if (busFragment != null && isTrue) {
busFragment.hideOchBus();
}
}
};
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
@@ -108,19 +87,15 @@ public class BusProvider implements IMogoOCH {
@Nullable
@Override
public Fragment createCoverage(@Nullable FragmentActivity fragmentActivity, @Nullable Integer integer) {
this.containerId = integer;
this.activity = fragmentActivity;
// UiThreadHandler.postDelayed(this::stepIntoVrMode, 5_000L );
showFragment();
return null;
}
@Override
public void onDestroy() {
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
MogoStatusManager.getInstance().unregisterStatusChangedListener("OchBus"
, StatusDescriptor.VR_MODE, statusChangedListener);
if (activity == null) return;
activity.finish();
}

View File

@@ -33,6 +33,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.function.view.MapBizView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -72,6 +73,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
protected RelativeLayout mBadcaseBtn;
protected RelativeLayout mAICollectBtn;
private FrameLayout flStationPanelContainer;
private MapBizView mapBizView;
private Group groupTestPanel;
private TrafficDataView mTrafficDataView;
// private BusTrafficLightView mTrafficLightView;
@@ -106,6 +108,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
@Override
protected void initViews() {
mapBizView = findViewById(R.id.mapBizView);
groupTestPanel = findViewById(R.id.groupTestPanel);
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
@@ -220,6 +223,18 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mapBizView.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
mapBizView.onResume();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container
@@ -247,14 +262,32 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
BDRouteDataTestUtils.converToRouteData();
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
mapBizView.onSaveInstanceState(outState);
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapBizView.onLowMemory();
}
@Override
public void onPause() {
super.onPause();
mapBizView.onPause();
}
@Override
public void onDestroyView() {
mapBizView.onDestroy();
super.onDestroyView();
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
EventBus.getDefault().unregister(this);
}
@Override
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
// if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
@@ -266,7 +299,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
/**
* 测试到站
*/

View File

@@ -18,7 +18,6 @@ import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.temp.EventLogout;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -471,7 +470,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
.latitude(lat)
.longitude(longi);
IMogoMarker marker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(
longi,lat,-1);
if (null != centerLine && marker != null) { // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致 地图未初始化会返回空
marker.setRotateAngle(centerLine.getAngle().floatValue());

View File

@@ -6,6 +6,11 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_616"
@@ -23,9 +28,13 @@
</FrameLayout>
<!--浓雾预警动画-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XFogEventView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--V2X预警红色边框-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
android:id="@+id/flV2XWarningView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
@@ -34,7 +43,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -71,6 +71,7 @@ dependencies {
api project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-hmi')
api project(':core:function-impl:mogo-core-function-map')
}
implementation project(':libraries:mogo-adas')

View File

@@ -14,7 +14,6 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -356,7 +355,7 @@ public class SweeperFragment extends BaseSweeperTabFragment<SweeperFragment, Swe
.latitude(lat)
.longitude(longi);
IMogoMarker marker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(
longi, lat, -1);
if (null != centerLine) { // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());

View File

@@ -55,6 +55,8 @@ dependencies {
implementation rootProject.ext.dependencies.amapsearch
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_function_v2x
}else {

View File

@@ -29,7 +29,7 @@ public
* 网约车-出租车-乘客端
*/
@Route(path = TaxiPassengerConst.PATH)
class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
class MogoOCHTaxiPassenger implements IMogoOCH {
private static final String TAG = "MogoOCHTaxiPassenger";
private TaxiPassengerBaseFragment ochTaxiPassengerFragment;
@@ -39,7 +39,6 @@ class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
@Override
public void init(Context context) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "init");
MogoStatusManager.getInstance().registerStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE, this);
}
/**
@@ -68,17 +67,6 @@ class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
}
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
showFragment();
} else {
hideFragment();
}
}
}
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
@@ -95,15 +83,13 @@ class MogoOCHTaxiPassenger implements IMogoOCH, IMogoStatusChangedListener {
public Fragment createCoverage(@Nullable FragmentActivity fragmentActivity, @Nullable Integer integer) {
this.mActivity = fragmentActivity;
this.mContainerId = integer;
// UiThreadHandler.postDelayed(() -> stepIntoVrMode(), 5_000L);
showFragment();
return null;
}
@Override
public void onDestroy() {
// 若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
MogoStatusManager.getInstance().unregisterStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE, this);
if (mActivity == null) return;
mActivity.finish();
}

View File

@@ -5,11 +5,11 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.mogo.commons.mvp.BaseFragment
import com.mogo.eagle.core.function.overview.view.OverMapView
import com.mogo.eagle.core.function.view.OverMapView
class OverviewFragment : BaseFragment() {
private var overmapview:OverMapView?=null
private var overmapview: OverMapView?=null
override fun onCreateView(
inflater: LayoutInflater,

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.PassengerMsgBoxListView;
import com.mogo.eagle.core.function.view.MapBizView;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
@@ -53,6 +54,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
static final String TAG = "TaxiPassengerBaseFragment";
private MapBizView mapBizView;
private ImageView mAutopilotImage;
private ImageView mMapswitchBtn;
@@ -91,6 +93,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
hideEagleConfig();
mapBizView = findViewById(R.id.mapBizView);
mAutopilotImage = findViewById(R.id.module_och_autopilot_iv);
mMapswitchBtn = findViewById(R.id.module_och_taxi_swich_map_iv);
updateSwitchMapIcon();
@@ -119,6 +122,12 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
});
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mapBizView.onCreate(savedInstanceState);
}
private void updateSwitchMapIcon() {
IMogoMapUIController controller = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (controller != null) {
@@ -179,6 +188,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
@Override
public void onResume() {
super.onResume();
mapBizView.onResume();
// mPresenter.startOrStopOrderLoop();
// showOrHideServingOrderFragment(true,false);
// showOrHideStartAutopilotView(true,true);
@@ -248,8 +258,27 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
return new BaseTaxiPassengerPresenter(this);
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapBizView.onLowMemory();
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
mapBizView.onSaveInstanceState(outState);
}
@Override
public void onPause() {
super.onPause();
mapBizView.onPause();
}
@Override
public void onDestroyView() {
mapBizView.onDestroy();
super.onDestroyView();
EventBus.getDefault().unregister(this);
removeListener();

View File

@@ -5,6 +5,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
android:id="@+id/steering_wheel"
android:layout_width="@dimen/dp_630"
@@ -27,6 +32,11 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--浓雾预警动画-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XFogEventView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"

View File

@@ -53,6 +53,7 @@ dependencies {
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_function_v2x

View File

@@ -8,9 +8,6 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.taxi.constant.TaxiConst;
@@ -29,7 +26,7 @@ public
* 网约车-出租车
*/
@Route( path = TaxiConst.PATH )
class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
class TaxiProvider implements IMogoOCH {
private static final String TAG = "TaxiProvider";
private TaxiFragment ochTaxiFragment;
@@ -38,7 +35,6 @@ class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
@Override
public void init( Context context ) {
CallerLogger.INSTANCE.d( M_TAXI + TAG, "init" );
MogoStatusManager.getInstance().registerStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE,this);
}
/**
@@ -66,17 +62,6 @@ class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
}
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.VR_MODE){
if (isTrue){
showFragment();
}else {
hideFragment();
}
}
}
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
@@ -93,13 +78,13 @@ class TaxiProvider implements IMogoOCH , IMogoStatusChangedListener {
public Fragment createCoverage(@Nullable FragmentActivity fragmentActivity, @Nullable Integer integer) {
this.mActivity = fragmentActivity;
this.mContainerId = integer;
showFragment();
return null;
}
@Override
public void onDestroy() {
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
MogoStatusManager.getInstance().unregisterStatusChangedListener("ochTaxi", StatusDescriptor.VR_MODE,this);
if (mActivity == null) return;
mActivity.finish();
}

View File

@@ -4,6 +4,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAX
import static com.mogo.och.taxi.constant.TaxiConst.TIMER_START_AUTOPILOT_INTERVAL;
import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
@@ -35,6 +36,7 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.view.MapBizView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
@@ -67,6 +69,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
protected TextView mDriverRole;
protected FrameLayout flStationPanelContainer;
private FrameLayout flNaviPanelContainer;
private MapBizView mapBizView;
private Group groupTestPanel;
private TextView mSpeedView;
private ImageView mAutopilotImage;
@@ -153,6 +156,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
@Override
protected void initViews() {
mapBizView = findViewById(R.id.mapBizView);
groupTestPanel = findViewById(R.id.groupTestPanel);
ctvAutopilotStatusRL = findViewById(R.id.module_mogo_och_autopilot_status);
ctvAutopilotStatusRL.setBackground(getResources().getDrawable(R.drawable.taxi_autopilot_bg_selector));
@@ -292,6 +296,24 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
});
}
@Override
protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mapBizView.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
mapBizView.onResume();
}
@Override
public void onPause() {
super.onPause();
mapBizView.onPause();
}
protected void onChangeOperationStatus() {
}
@@ -309,8 +331,21 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapBizView.onLowMemory();
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
mapBizView.onSaveInstanceState(outState);
}
@Override
public void onDestroyView() {
mapBizView.onDestroy();
super.onDestroyView();
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
}

View File

@@ -21,7 +21,6 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -765,7 +764,7 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment
.latitude(station.get(1))
.longitude(station.get(0));
IMogoMarker marker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(station.get(0)
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(station.get(0)
, station.get(1), -1);
if (null != centerLine && marker != null) {// 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());

View File

@@ -6,6 +6,11 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/mapBizView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/module_mogo_och_speed_layout"
android:layout_height="@dimen/taxi_tab_speed_width_height"
@@ -80,6 +85,11 @@
</RelativeLayout>
<!--浓雾预警动画-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XFogEventView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!--V2X预警红色边框-->
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
android:layout_width="match_parent"
@@ -90,7 +100,7 @@
app:layout_constraintTop_toTopOf="parent" />
<!--刹车、转向-->
<com.mogo.eagle.core.function.hmi.ui.widget.SteeringWheelView
<com.mogo.eagle.core.function.hmi.ui.vehicle.SteeringBrakeView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -52,6 +52,7 @@ import com.zhidao.support.adas.high.OnMultiDeviceListener
import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS
import com.zhidao.support.adas.high.common.CupidLogUtils
import com.zhidao.support.adas.high.common.MessageType
import com.zhidao.support.adas.high.common.MogoReport
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants
@@ -720,7 +721,20 @@ class MoGoAutopilotControlProvider :
}
override fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) {
Log.d(TAG, "---- sendSweeperFuTianTaskCmd ----")
AdasManager.getInstance().sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd)
}
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
if (isDrawPointCloud) {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
} else {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
}
}

View File

@@ -9,7 +9,7 @@ import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBindingCarDialog
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showModifyBindingCarDialog
import com.mogo.eagle.core.function.call.map.CallerHDMapManager.changeCurrentIcon
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.utils.GsonUtil
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
@@ -156,19 +156,19 @@ class BindingCarNetWorkManager private constructor() {
d(SceneConstant.M_BINDING + TAG, "updateCarVrIconRes : $brandId")
when (brandId) {
"1" -> {
changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
}
"2" -> {
changeCurrentIcon(R.raw.hq_h9)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.hq_h9)
HdMapBuildConfig.currentCarVrIconRes = R.raw.hq_h9
}
"3" -> {
changeCurrentIcon(R.raw.xiaobache)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
}
else -> {
changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
HdMapBuildConfig.currentCarVrIconRes = R.raw.chuzuche
}
}

View File

@@ -6,7 +6,6 @@ import android.view.ViewGroup
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.eagle.core.data.bindingcar.IPCUpgradeStateInfo
@@ -235,14 +234,14 @@ class MoGoHmiProvider : IMoGoHmiProvider {
}
override fun showToBindingCarDialog() {
if (ContextHolderUtil.getContext() != null) {
ToBindingCarDialog.show(ContextHolderUtil.getContext())
if (context != null) {
ToBindingCarDialog.show(context)
}
}
override fun showModifyBindingCarDialog() {
if (ContextHolderUtil.getContext() != null) {
ModifyBindingCarDialog.show(ContextHolderUtil.getContext())
if (context != null) {
ModifyBindingCarDialog.show(context)
}
}
@@ -267,17 +266,17 @@ class MoGoHmiProvider : IMoGoHmiProvider {
content: String,
installType: String
) {
if (ContextHolderUtil.getContext() != null) {
if (context != null) {
UpgradeAppDialog.show(
ContextHolderUtil.getContext(), name, url, title, content, installType
context, name, url, title, content, installType
)
}
}
override fun showAdUpgradeDialog(images: List<String>, padSn: String, releaseId: String) {
ThreadUtils.runOnUiThread {
if (ContextHolderUtil.getContext() != null) {
AdUpgradeDialog.show(ContextHolderUtil.getContext(), images, padSn, releaseId)
if (context != null) {
AdUpgradeDialog.show(context, images, padSn, releaseId)
}
}
}

View File

@@ -51,7 +51,6 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigList
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
@@ -524,10 +523,10 @@ internal class DebugSettingView @JvmOverloads constructor(
tbChangeCurrentCarIcon.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
// 替换为出租车图标
CallerHDMapManager.changeCurrentIcon(R.raw.chuzuche)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.chuzuche)
} else {
// 替换为小巴车图标
CallerHDMapManager.changeCurrentIcon(R.raw.xiaobache)
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.xiaobache)
}
}
@@ -741,7 +740,9 @@ internal class DebugSettingView @JvmOverloads constructor(
tbDrawPointCloudData.isChecked = FunctionBuildConfig.isDrawPointCloudData
//是否渲染点云数据
tbDrawPointCloudData.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.setIsDrawPointCloud(isChecked)
CallerAutoPilotControlManager.setIsDrawPointCloud(isChecked)
FunctionBuildConfig.isDrawPointCloudData = isChecked
CallerMapUIServiceManager.getMapUIController()?.setIsDrawPointCloud(isChecked)
}
//设置点云大小
@@ -752,7 +753,7 @@ internal class DebugSettingView @JvmOverloads constructor(
} else {
try {
val cloudSizeFloat = cloudSize.toFloat()
CallerHDMapManager.setPointCloudSize(cloudSizeFloat)
CallerMapUIServiceManager.getMapUIController()?.setPointCloudSize(cloudSizeFloat)
} catch (e: Exception) {
ToastUtils.showShort("点云大小格式输入不正确")
}
@@ -765,7 +766,7 @@ internal class DebugSettingView @JvmOverloads constructor(
ToastUtils.showShort("请输入正确的点云颜色")
} else {
try {
CallerHDMapManager.setPointCloudColor(cloudColor)
CallerMapUIServiceManager.getMapUIController()?.setPointCloudColor(cloudColor)
} catch (e: Exception) {
ToastUtils.showShort("点云大小颜色输入不正确")
}
@@ -1215,7 +1216,7 @@ internal class DebugSettingView @JvmOverloads constructor(
* 设置是否输出高精地图日志 true-打印日志false-不打印日志
*/
tbHdMapLog.setOnCheckedChangeListener { _, isChecked ->
CallerHDMapManager.setDebugMode(isChecked)
CallerMapUIServiceManager.getMapUIController()?.setDebugMode(isChecked)
}
cbTraceLog.isChecked = CallerDevaToolsManager.getTraceLogStatus()

View File

@@ -1,10 +1,13 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.animation.Animator
import android.animation.Animator.AnimatorListener
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
@@ -14,8 +17,8 @@ import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import kotlinx.android.synthetic.main.view_v2x_warning_fog.view.*
class V2XFogEventView(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
ConstraintLayout(context, attrs, defStyleAttr), IV2XEventListener {
class V2XFogEventView(context: Context, attrs: AttributeSet) :
ConstraintLayout(context, attrs), IV2XEventListener {
companion object {
private const val TAG = "V2XFogEventView"
@@ -44,6 +47,24 @@ class V2XFogEventView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
animator8
)
animatorSet.duration = 5000
animatorSet.addListener(object : AnimatorListener{
override fun onAnimationStart(animation: Animator?) {
visibility = View.VISIBLE
}
override fun onAnimationEnd(animation: Animator?) {
visibility = View.GONE
}
override fun onAnimationCancel(animation: Animator?) {
visibility = View.GONE
}
override fun onAnimationRepeat(animation: Animator?) {
}
})
}
override fun onAttachedToWindow() {

View File

@@ -1,481 +0,0 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LEAK;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_NATIVE_LEAK;
import static com.mogo.eagle.core.function.main.MainPresenter.MOGO_PERMISSION_REQUEST_CODE;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.kwai.koom.base.MonitorManager;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor;
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig;
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView;
import com.mogo.eagle.core.function.main.modules.MogoModulesManager;
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.eagle.core.utilcode.util.BarUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb;
import com.zhjt.service.chain.ChainLog;
import com.zhjt.service.chain.TracingConstants;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述:加载各个模块
*/
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
IMoGoAutopilotStatusListener {
protected static final String TAG = "MainActivity";
private static final int REQUEST_CODE_DIALOG = 100;
protected FrameLayout mFloatingLayout;
protected View mCoverUpLayout;
protected ConstraintLayout clSpecialEffect;
private boolean isFirst = false;
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private final List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@Override
protected int getLayoutId() {
return R.layout.module_main_activity_main;
}
@Override
protected void initViews() {
injectStatusBar();
getWindow().setBackgroundDrawable(null);
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
clSpecialEffect = findViewById(R.id.cl_special_effect);
mConnectInfoRV = findViewById(R.id.rvConnectInfo);
initConnectInfoRV();
FloatingViewHandler.init(mFloatingLayout);
CallerHmiManager.INSTANCE.init(this);
//申请悬浮窗权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 检查是否有悬浮窗权限
if (Settings.canDrawOverlays(this)) {
return;
}
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
}
}
private void injectStatusBar() {
FrameLayout decorView = (FrameLayout) this.getWindow().getDecorView();
View contentView = ((ViewGroup) decorView.findViewById(android.R.id.content)).getChildAt(0);
contentView.setFitsSystemWindows(false);
decorView.setClipToPadding(false);
View statusBarView = decorView.findViewWithTag("status_bar");
if (statusBarView == null) {
statusBarView = getStatusBarView();
statusBarView.setTag("status_bar");
}
FrameLayout.LayoutParams statusBarLP =
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, BarUtils.getStatusBarHeight());
statusBarLP.topMargin = 0;
statusBarLP.gravity = Gravity.TOP;
decorView.addView(statusBarView, statusBarLP);
}
/**
* 修改statusBar 重写实现,需要继承 StatusBarViewxml中基础系统控件不要修改其id拿来即用
* @return StatusBarView
*/
protected StatusBarView getStatusBarView(){
return new StatusBarView(this);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
calculateStartTime();
ContextHolderUtil.holdContext(this);
// 监听工控机连接信息
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerStartUpManager.initStageTwo();
// 加载模块
mPresenter.postLoadModuleMsg();
// 监听网络状态
NetworkUtils.listenNetStrength(this);
mPresenter.checkPermission(this);
// 同步AppInfo Config信息
CallerDevaToolsManager.INSTANCE.syncConfig();
}
private void calculateStartTime() {
long coldStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.COLD_START);
// 这里记录的TimeUtils.coldStartTime是指Application启动的时间最终的冷启动时间等于Application启动时间+热启动时间
AppLaunchTimeUtils.sColdStartTime = coldStartTime > 0 ? coldStartTime : 0;
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.HOT_START);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
// 统计代码
final Map<String, Object> properties = new HashMap<>();
long hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START);
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
// 真正的冷启动时间 = Application启动时间 + 热启动时间
long coldStartTime = AppLaunchTimeUtils.sColdStartTime + hotStartTime;
// 过滤掉异常启动时间
if (coldStartTime < 50000) {
// 上传冷启动时间coldStartTime
CallerLogger.INSTANCE.i(M_HMI + TAG, "coldStartTime:" + coldStartTime);
properties.put("app_launch_coldStartTime", coldStartTime);
}
} else if (hotStartTime > 0) {
// 过滤掉异常启动时间
if (hotStartTime < 30000) {
// 上传热启动时间hotStartTime
CallerLogger.INSTANCE.i(M_HMI + TAG, "hotStartTime:" + hotStartTime);
properties.put("app_launch_hotStartTime", hotStartTime);
}
}
AnalyticsUtils.track("app_launch_time", properties);
}
}
private void initConnectInfoRV() {
mConnAdapter = new ConnInfoAdapter(this, dataList);
mConnectInfoRV.setLayoutManager(new LinearLayoutManager(this));
mConnectInfoRV.setAdapter(mConnAdapter);
}
@Override
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulesManager.getInstance().init(this);
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, new IMogoMapListener() {
@Override
public void onMapLoaded() {
// 延时加载其他模块
getWindow().getDecorView().post(() -> {
HdMapBuildConfig.isMapLoaded = true;
loadOthersModules();
loadFunctionFragment();
// TODO 这里临时兼容进入VR模式标记状态机。有些业务OCH会根据状态判断加载
MogoStatusManager.getInstance().setVrMode(TAG, true);
// 设置地图样式
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
});
CallerLogger.INSTANCE.i(M_HMI + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
}
});
// 加载地图
loadFunctionMapView();
}
/**
* 加载其它模块
*/
protected void loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
MogoModulesManager.getInstance().loadFunctionModules();
mPresenter.delayOperations();
MogoModulesManager.getInstance().loadFunctionModulesServer();
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.d(M_HMI + TAG, "5秒已过启动基础服务……");
MogoModulesManager.getInstance().loadBaseModule();
}, 5_000L);
if (DebugConfig.isDebug()) {
// 启动Native内存泄漏监测
startLeakMonitor();
}
checkMonitorDb();
}
private void startLeakMonitor() {
LeakMonitorConfig leakMonitorConfig = new LeakMonitorConfig.Builder()
.setLoopInterval(50000)
.setMonitorThreshold(16)
.setNativeHeapAllocatedThreshold(0)
.setSelectedSoList(new String[]{"libhdmap", "libmap",
"libAMapSDK_NAVI_v8_0_1", "libZegoExpressEngine",
"libcntts"
})
.setEnableLocalSymbolic(DebugConfig.isDebug())
.setLeakListener(leaks -> {
StringBuilder stringBuilder = new StringBuilder();
if (!leaks.isEmpty()) {
for (LeakRecord leakRecord : leaks) {
stringBuilder.append(leakRecord.toString());
}
printLeakMsg(stringBuilder.toString());
}
})
.build();
MonitorManager.addMonitorConfig(leakMonitorConfig);
LeakMonitor.INSTANCE.start();
}
private void checkMonitorDb() {
new Thread(() -> {
long limitId = 50001;
File file = this.getDatabasePath(MonitorDb.INTERNAL_DB_NAME);
try {
if (file != null && file.exists()) {
List<CpuInfo> cpuList = MonitorDb.getDb(this).monitorDao().getAllCPUById(limitId);
List<MemInfo> memList = MonitorDb.getDb(this).monitorDao().getAllMemById(limitId);
// 大于5w条清除
if (cpuList.size() > 0 || memList.size() > 0) {
this.deleteDatabase(MonitorDb.INTERNAL_DB_NAME);
}
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, e.getMessage());
}
}).start();
}
@ChainLog(
linkChainLog = CHAIN_LINK_LOG_NATIVE_LEAK,
linkCode = CHAIN_LINK_LEAK,
endpoint = TracingConstants.Endpoint.PAD,
nodeAliasCode = CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK,
paramIndexes = {0},
clientPkFileName = "sn"
)
private void printLeakMsg(String leakRecord) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "内存泄漏日志如下:\n" + leakRecord);
}
@Override
public void hideCoverUpLayout() {
mConnectInfoRV.setVisibility(View.GONE);
getWindow().setBackgroundDrawable(null);
mCoverUpLayout.setVisibility(View.GONE);
isFloatingLayerHidden = true;
}
@Override
public void loadFunctionFragment() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "loadFunctionFragment……");
// 加载 小地图 图层
BaseFragment fragmentSmpMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP).navigation();
addFragment(fragmentSmpMap, fragmentSmpMap.getTagName(), R.id.module_main_id_smp_fragment);
}
/**
* 加载地图视图
*/
private void loadFunctionMapView() {
MvpFragment fragmentHdMap = (MvpFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_MAP).navigation();
if (fragmentHdMap != null) {
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_map_fragment_container);
}
}
@NonNull
@Override
protected MainPresenter createPresenter() {
return new MainPresenter(this);
}
@Override
protected void onResume() {
super.onResume();
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
}
@Override
protected void onPause() {
super.onPause();
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false);
}
@Override
protected void onStop() {
super.onStop();
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
public void onAutopilotStatusResponse(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
int status = autoPilotStatusInfo.getIpcConnStatus();
if (mLastStatus != status) {
AutopilotStatusInfo statusInfo = autoPilotStatusInfo.clone();
mConnectInfoRV.post(() -> updateConnectInfoView(statusInfo));
mLastStatus = status;
}
}
@Override
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
}
@Override
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
private void updateConnectInfoView(@NonNull AutopilotStatusInfo autoPilotStatusInfo) {
if (!isFloatingLayerHidden) {// 遮罩层显示的时候
mConnAdapter.updateData(autoPilotStatusInfo);
mConnectInfoRV.scrollToPosition(mConnAdapter.getItemCount() - 1);
mLastStatus = autoPilotStatusInfo.getIpcConnStatus();
} else {// 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(TAG);
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(TAG);
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (mapUIController != null) {
mapUIController.destroy();
}
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy.");
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();
FloatingViewHandler.clear();
ProcessUtils.killAllBackgroundProcesses();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == MOGO_PERMISSION_REQUEST_CODE) {
boolean isAllGranted = true;
// 判断是否所有的权限都已经授予了
for (int grant : grantResults) {
if (grant != PackageManager.PERMISSION_GRANTED) {
isAllGranted = false;
break;
}
}
if (isAllGranted) {
isFirst = false;
} else {
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
if (!isFirst) {
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG);
isFirst = true;
}
}
}
}
/**
* 由于应用是单页面的所以采用Fragment将各模块的UI进行分割解耦合
*
* @param newFragment 功能UI
* @param tagName UI绑定的Tag
* @param containerId 要加入的资源ID
*/
private void addFragment(Fragment newFragment, String tagName, int containerId) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tagName);
if (fragment == null) {
fragment = newFragment;
}
if (fragment == null) {
CallerLogger.INSTANCE.e(M_HMI + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
getSupportFragmentManager().beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss();
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
super.onPointerCaptureChanged(hasCapture);
}
}

View File

@@ -0,0 +1,410 @@
package com.mogo.eagle.core.function.main
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.provider.Settings
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.launcher.ARouter
import com.kwai.koom.base.MonitorManager.addMonitorConfig
import com.kwai.koom.nativeoom.leakmonitor.LeakListener
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitor.start
import com.kwai.koom.nativeoom.leakmonitor.LeakMonitorConfig
import com.kwai.koom.nativeoom.leakmonitor.LeakRecord
import com.mogo.commons.analytics.AnalyticsUtils
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.mvp.BaseFragment
import com.mogo.commons.mvp.MvpActivity
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.call.startup.CallerStartUpManager.initStageTwo
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
import com.mogo.eagle.core.function.main.modules.MogoModulesManager
import com.mogo.eagle.core.function.main.windowview.FloatingViewHandler
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ProcessUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
import com.mogo.map.uicontroller.EnumMapUI
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb
import com.zhjt.mogo_core_function_devatools.monitor.db.MonitorDb.Companion.getDb
import com.zhjt.service.chain.ChainLog
import com.zhjt.service.chain.TracingConstants.Endpoint.Companion.PAD
import kotlinx.android.synthetic.main.module_main_activity_main.*
import mogo.telematics.pad.MessagePad
import mogo_msg.MogoReportMsg
import system_master.SystemStatusInfo
/**
* @author congtaowang
* @since 2019-12-23
*
*
* 描述:加载各个模块
*/
open class MainActivity : MvpActivity<MainView?, MainPresenter?>(), MainView,
IMoGoAutopilotStatusListener {
companion object {
protected const val TAG = "MainActivity"
private const val REQUEST_CODE_DIALOG = 100
}
private var isFirst = false
private var mConnAdapter: ConnInfoAdapter? = null
private val dataList: List<AutopilotStatusInfo> = ArrayList()
private var mLastStatus = 0x00
private var isFloatingLayerHidden = false
override fun getLayoutId(): Int {
return R.layout.module_main_activity_main
}
override fun initViews() {
injectStatusBar()
window.setBackgroundDrawable(null)
initConnectInfoRV()
FloatingViewHandler.init(module_main_id_floating_view)
CallerHmiManager.init(this)
//申请悬浮窗权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 检查是否有悬浮窗权限
if (Settings.canDrawOverlays(this)) {
return
}
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG)
}
}
private fun injectStatusBar() {
val decorView = this.window.decorView as FrameLayout
val contentView =
(decorView.findViewById<View>(android.R.id.content) as ViewGroup).getChildAt(0)
contentView.fitsSystemWindows = false
decorView.clipToPadding = false
var statusBarView = decorView.findViewWithTag<View>("status_bar")
if (statusBarView == null) {
statusBarView = StatusBarView(this)
statusBarView.setTag("status_bar")
}
val statusBarLP = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
BarUtils.getStatusBarHeight()
)
statusBarLP.topMargin = 0
statusBarLP.gravity = Gravity.TOP
decorView.addView(statusBarView, statusBarLP)
}
/**
* 修改statusBar 重写实现,需要继承 StatusBarViewxml中基础系统控件不要修改其id拿来即用
* @return StatusBarView
*/
protected val statusBarView: StatusBarView
get() = StatusBarView(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
calculateStartTime()
ContextHolderUtil.holdContext(this)
// 监听工控机连接信息
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
initStageTwo()
// 加载模块
mPresenter!!.postLoadModuleMsg()
// 监听网络状态
NetworkUtils.listenNetStrength(this)
mPresenter!!.checkPermission(this)
// 同步AppInfo Config信息
CallerDevaToolsManager.syncConfig()
}
private fun calculateStartTime() {
val coldStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.COLD_START)
// 这里记录的TimeUtils.coldStartTime是指Application启动的时间最终的冷启动时间等于Application启动时间+热启动时间
AppLaunchTimeUtils.sColdStartTime = if (coldStartTime > 0) coldStartTime else 0
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.HOT_START)
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
if (hasFocus) {
// 统计代码
val properties: MutableMap<String, Any> = HashMap()
val hotStartTime = AppLaunchTimeUtils.getTimeCalculate(AppLaunchTimeUtils.HOT_START)
if (AppLaunchTimeUtils.sColdStartTime > 0 && hotStartTime > 0) {
// 真正的冷启动时间 = Application启动时间 + 热启动时间
val coldStartTime = AppLaunchTimeUtils.sColdStartTime + hotStartTime
// 过滤掉异常启动时间
if (coldStartTime < 50000) {
// 上传冷启动时间coldStartTime
i(SceneConstant.M_HMI + TAG, "coldStartTime:$coldStartTime")
properties["app_launch_coldStartTime"] = coldStartTime
}
} else if (hotStartTime > 0) {
// 过滤掉异常启动时间
if (hotStartTime < 30000) {
// 上传热启动时间hotStartTime
i(SceneConstant.M_HMI + TAG, "hotStartTime:$hotStartTime")
properties["app_launch_hotStartTime"] = hotStartTime
}
}
AnalyticsUtils.track("app_launch_time", properties)
}
}
private fun initConnectInfoRV() {
mConnAdapter = ConnInfoAdapter(this, dataList)
rvConnectInfo.layoutManager = LinearLayoutManager(this)
rvConnectInfo.adapter = mConnAdapter
}
override fun loadModules() {
val start = System.currentTimeMillis()
MogoStatusManager.getInstance().setVrMode(TAG, true)
MogoModulesManager.getInstance().init(this)
loadOthersModules()
mogoMapListenerHandler.registerHostMapListener(TAG, object : IMogoMapListener {
override fun onMapLoaded() {
// 延时加载其他模块
window.decorView.post {
HdMapBuildConfig.isMapLoaded = true
mPresenter!!.delayOperations()
loadFunctionFragment()
// 设置地图样式
mogoMapListenerHandler.onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR)
}
i(
SceneConstant.M_HMI + TAG,
"App launch timer cost " + (System.currentTimeMillis() - start) + "ms"
)
}
})
}
/**
* 加载其它模块
*/
protected open fun loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
MogoModulesManager.getInstance().loadFunctionModules()
MogoModulesManager.getInstance().loadFunctionModulesServer()
UiThreadHandler.postDelayed({
d(SceneConstant.M_HMI + TAG, "5秒已过启动基础服务……")
MogoModulesManager.getInstance().loadBaseModule()
}, 5000L)
if (DebugConfig.isDebug()) {
// 启动Native内存泄漏监测
startLeakMonitor()
}
checkMonitorDb()
}
private fun startLeakMonitor() {
val leakMonitorConfig: LeakMonitorConfig = LeakMonitorConfig.Builder()
.setLoopInterval(50000)
.setMonitorThreshold(16)
.setNativeHeapAllocatedThreshold(0)
.setSelectedSoList(
arrayOf(
"libhdmap", "libmap",
"libAMapSDK_NAVI_v8_0_1", "libZegoExpressEngine",
"libcntts"
)
)
.setEnableLocalSymbolic(DebugConfig.isDebug())
.setLeakListener(object : LeakListener {
override fun onLeak(leaks: MutableCollection<LeakRecord>) {
val stringBuilder = StringBuilder()
if (!leaks.isEmpty()) {
for (leakRecord in leaks) {
stringBuilder.append(leakRecord.toString())
}
printLeakMsg(stringBuilder.toString())
}
}
})
.build()
addMonitorConfig(leakMonitorConfig)
start()
}
private fun checkMonitorDb() {
Thread {
val limitId: Long = 50001
val file = getDatabasePath(MonitorDb.INTERNAL_DB_NAME)
try {
if (file != null && file.exists()) {
val cpuList = getDb(this).monitorDao().getAllCPUById(limitId)
val memList = getDb(this).monitorDao().getAllMemById(limitId)
// 大于5w条清除
if (cpuList.isNotEmpty() || memList.isNotEmpty()) {
deleteDatabase(MonitorDb.INTERNAL_DB_NAME)
}
}
} catch (e: Exception) {
e(TAG, e.message)
}
}.start()
}
@ChainLog(
linkChainLog = ChainConstant.CHAIN_LINK_LOG_NATIVE_LEAK,
linkCode = ChainConstant.CHAIN_LINK_LEAK,
endpoint = PAD,
nodeAliasCode = ChainConstant.CHAIN_ALIAS_CODE_RECORD_NATIVE_LEAK,
paramIndexes = [0],
clientPkFileName = "sn"
)
private fun printLeakMsg(leakRecord: String) {
d(SceneConstant.M_HMI + TAG, "内存泄漏日志如下:\n$leakRecord")
}
override fun hideCoverUpLayout() {
rvConnectInfo.visibility = View.GONE
window.setBackgroundDrawable(null)
module_main_id_cover_up!!.visibility = View.GONE
isFloatingLayerHidden = true
}
override fun loadFunctionFragment() {
d(SceneConstant.M_HMI + TAG, "loadFunctionFragment……")
// 加载 小地图 图层
val fragmentSmpMap = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_SMP)
.navigation() as BaseFragment
addFragment(fragmentSmpMap, fragmentSmpMap.tagName, R.id.module_main_id_smp_fragment)
}
override fun createPresenter(): MainPresenter {
return MainPresenter(this)
}
override fun onResume() {
super.onResume()
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true)
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false)
}
override fun onPause() {
super.onPause()
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false)
}
override fun onStop() {
super.onStop()
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true)
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val status = autoPilotStatusInfo.ipcConnStatus
if (mLastStatus != status) {
val statusInfo = autoPilotStatusInfo.clone()
rvConnectInfo.post { updateConnectInfoView(statusInfo) }
mLastStatus = status
}
}
private fun updateConnectInfoView(autoPilotStatusInfo: AutopilotStatusInfo) {
if (!isFloatingLayerHidden) { // 遮罩层显示的时候
mConnAdapter!!.updateData(autoPilotStatusInfo)
rvConnectInfo.scrollToPosition(mConnAdapter!!.itemCount - 1)
mLastStatus = autoPilotStatusInfo.ipcConnStatus
} else { // 遮罩层隐藏的时候
CallerAutoPilotStatusListenerManager.removeListener(TAG)
}
}
override fun onDestroy() {
super.onDestroy()
CallerAutoPilotStatusListenerManager.removeListener(TAG)
mogoMapListenerHandler.unregisterHostMapListener(TAG)
val mapUIController = getMapUIController()
mapUIController?.destroy()
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false)
d(SceneConstant.M_HMI + TAG, "destroy.")
ContextHolderUtil.releaseContext()
MogoModulesManager.getInstance().onDestroy()
FloatingViewHandler.clear()
ProcessUtils.killAllBackgroundProcesses()
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == MainPresenter.MOGO_PERMISSION_REQUEST_CODE) {
var isAllGranted = true
// 判断是否所有的权限都已经授予了
for (grant in grantResults) {
if (grant != PackageManager.PERMISSION_GRANTED) {
isAllGranted = false
break
}
}
if (isAllGranted) {
isFirst = false
} else {
// 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
if (!isFirst) {
PermissionsDialogUtils.openAppDetails(this, null, REQUEST_CODE_DIALOG)
isFirst = true
}
}
}
}
/**
* 由于应用是单页面的所以采用Fragment将各模块的UI进行分割解耦合
*
* @param newFragment 功能UI
* @param tagName UI绑定的Tag
* @param containerId 要加入的资源ID
*/
private fun addFragment(newFragment: Fragment, tagName: String, containerId: Int) {
var fragment = supportFragmentManager.findFragmentByTag(tagName)
if (fragment == null) {
fragment = newFragment
}
if (fragment == null) {
e(
SceneConstant.M_HMI + TAG,
"add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(
applicationContext, containerId
)
)
return
}
supportFragmentManager.beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss()
}
}

View File

@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_INIT;
import static com.mogo.eagle.core.data.deva.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_F;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.content.Intent;
import android.os.Bundle;
@@ -93,13 +94,6 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void initViews() {
super.initViews();
// 这里在初始化完GUI后做一些个性化的定制
// 小巴车的乘客屏幕
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
FrameLayout frameLayout = findViewById(R.id.module_main_id_map_fragment_container);
frameLayout.setPadding(0, 0, AutoSizeUtils.dp2px(getContext(), 700), 0);
}
}
@Override
@@ -134,7 +128,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void loadOthersModules() {
super.loadOthersModules();
CallerLogger.INSTANCE.d(M_HMI + TAG, "loadOthersModules");
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules");
loadOCHModule();
}

View File

@@ -15,14 +15,12 @@ import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
@@ -30,7 +28,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.main.moujie.BluetoothMonitorReceiver;
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.ToastUtils;
@@ -47,8 +44,6 @@ import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import me.jessyan.autosize.utils.AutoSizeUtils;
/**
* 针对作为Launcher的情况做个性化操作
*
@@ -91,13 +86,6 @@ public class PassengerLauncherActivity extends MainActivity implements IMogoInte
@Override
protected void initViews() {
super.initViews();
// 这里在初始化完GUI后做一些个性化的定制
// 小巴车的乘客屏幕
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
FrameLayout frameLayout = findViewById(R.id.module_main_id_map_fragment_container);
frameLayout.setPadding(0, 0, AutoSizeUtils.dp2px(getContext(),700), 0);
}
}
@Override

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.main.modules;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.app.Application;
import android.content.Context;
@@ -82,7 +83,7 @@ public class MogoModulesManager implements MogoModulesHandler {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMoGoFunctionProvider provider = loadFunction(module.getPath());
if (provider != null) {
mModuleFunctionProviders.put(module, provider);
@@ -97,7 +98,7 @@ public class MogoModulesManager implements MogoModulesHandler {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctionServers();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMoGoFunctionServerProvider provider = loadFunctionServer(module.getPath());
if (provider != null) {
mModuleFunctionServerProviders.put(module, provider);
@@ -114,7 +115,7 @@ public class MogoModulesManager implements MogoModulesHandler {
if (baseModule == null) {
continue;
}
CallerLogger.INSTANCE.d(M_HMI + TAG, "加载基本模块 : " + baseModule.getPath());
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath());
loadBaseProvider(baseModule.getPath());
}
}

View File

@@ -1,42 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_splash_bg"
android:orientation="vertical">
<!-- 地图 -->
<FrameLayout
android:id="@+id/module_main_id_map_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--浓雾预警动画-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_special_effect"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_wu1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu1"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/iv_wu2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:alpha="0"
android:src="@drawable/wu2"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

View File

@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/iv_wu1"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.map">
package="com.mogo.eagle.core.function.view">
</manifest>

View File

@@ -0,0 +1,29 @@
package com.mogo.eagle.core.function
import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
@Route(path = MogoServicePaths.PATH_MAP_BIZ)
class MapBizProvider :IMoGoFunctionServerProvider{
override val functionName: String
get() = "MapBizProvider"
override fun init(context: Context?) {
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
SpeedLimitDataManager.getInstance().start()
}
override fun onDestroy() {
}
}

View File

@@ -7,7 +7,7 @@ import android.annotation.SuppressLint;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
@@ -37,7 +37,7 @@ public class TrackObj {
lon = data.getLongitude();
s2LatLng = S2LatLng.fromDegrees(data.getLatitude(), data.getLongitude());
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22); //需要验证22前后
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, -1);
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(lon, lat, -1);
if (centerLine != null && centerLine.getAngle() != 0) {
roadAngle = centerLine.getAngle();
}
@@ -55,8 +55,8 @@ public class TrackObj {
}
private void correct() {
calAverageSpeedAndType();
calLoc();
// calAverageSpeedAndType();
// calLoc();
// calHeading();
}
@@ -109,7 +109,7 @@ public class TrackObj {
//更正数据,速度小于LIMIT_SPEED使用上一帧数据
if (relativeStatic()) {
if (roadAngle != 0.0) {
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(lon, lat, -1);
CenterLine centerLine = CallerMapUIServiceManager.INSTANCE.getMapUIController().getCenterLineInfo(lon, lat, -1);
if (centerLine != null && centerLine.getAngle() != 0) {
cacheData = cacheData.toBuilder().setHeading(centerLine.getAngle()).build();
} else {

View File

@@ -5,7 +5,7 @@ import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.function.impl.marker.AdasRecognizedType;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
/**
* @author congtaowang

View File

@@ -9,7 +9,7 @@ import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.map.marker.MogoMarkerOptions;
/**

View File

@@ -12,7 +12,7 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.eagle.core.utilcode.util.ViewUtils;

View File

@@ -13,7 +13,7 @@ import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.PoiWrapper;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.eagle.core.data.config.CloudPoiManager;

View File

@@ -5,7 +5,7 @@ import android.graphics.BitmapFactory;
import android.view.View;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.map.marker.IMogoMarker;
import java.lang.ref.SoftReference;

View File

@@ -1,48 +0,0 @@
package com.mogo.eagle.core.function.map
import android.content.Context
import android.os.Bundle
import chassis.Chassis
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.map.MogoMapView
class MapBizView(context: Context?) : MogoMapView(context), IMoGoSkinModeChangeListener,
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener {
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
map.uiController.showMyLocation(true)
CallerSkinModeListenerManager.addListener(MapFragment.functionName, this)
CallerChassisLocationWGS84ListenerManager.addListener(MapFragment.functionName, this)
CallerChassisLamplightListenerManager.addListener(MapFragment.functionName, this)
}
override fun onSkinModeChange(skinMode: Int) {
TODO("Not yet implemented")
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
TODO("Not yet implemented")
}
override fun onDestroy() {
// 先取消注册数据再onDestroy
CallerSkinModeListenerManager.removeListener(MapFragment.functionName)
CallerChassisLocationWGS84ListenerManager.removeListener(MapFragment.functionName)
CallerChassisLamplightListenerManager.removeListener(MapFragment.functionName)
super.onDestroy()
}
}

View File

@@ -1,336 +0,0 @@
package com.mogo.eagle.core.function.map
import android.content.Context
import android.os.Bundle
import android.view.View
import chassis.Chassis
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.map.CenterLine
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
import com.mogo.eagle.core.function.business.SpeedLimitDataManager
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.map.IMogoMap
import com.mogo.map.MogoMapView
import com.mogo.map.uicontroller.IMogoMapUIController
import com.zhidaoauto.map.sdk.open.MapAutoApi
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper
/**
* @author donghongyu
* @since 2021-11-09
* 高精度地图层UI
* 地图图层,地图操作都在这个图层完成 //todo 以view方式进行提供
*/
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
MapView,
IMoGoMapFragmentProvider,
IMoGoSkinModeChangeListener,
IMoGoChassisLocationWGS84Listener,
IMoGoChassisLamplightListener {
private var mMogoMapView: MogoMapView? = null
private var mMogoMap: IMogoMap? = null
companion object {
const val functionName = "MapFragment"
/**
* sight mode
*
* @param mode
*/
const val SIGHT_MODE_NORMAL = 0
const val SIGHT_MODE_TOP = 1
const val SIGHT_MODE_BACK = 2
const val SIGHT_MODE_CROSS = 3
const val SIGHT_MODE_FAR = 4
}
override fun getLayoutId(): Int {
return R.layout.module_map_fragment_map
}
override fun getTagName(): String {
return Companion.functionName
}
override fun initViews() {
}
override fun stepInVrMode(isDayMode: Boolean) {
try {
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
mMogoMapView!!.map.uiController.stepInVrMode(isDayMode)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun init(context: Context) {
// do not implement
}
override fun initViews(savedInstanceState: Bundle?) {
super.initViews(savedInstanceState)
mMogoMapView = findViewById(R.id.module_map_id_map)
mMogoMapView!!.onCreate(savedInstanceState)
mMogoMap = mMogoMapView!!.map
if (mMogoMap != null) {
mMogoMap!!.uiController.showMyLocation(true)
}
// 添加换肤监听
CallerSkinModeListenerManager.addListener(Companion.functionName, this)
CallerChassisLocationWGS84ListenerManager.addListener(Companion.functionName, this)
CallerChassisLamplightListenerManager.addListener(Companion.functionName, this)
}
override fun createPresenter(): MapPresenter {
return MapPresenter(this)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initMapView()
initMapBiz()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
if (mMogoMapView != null) {
mMogoMapView!!.onSaveInstanceState(outState)
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
override fun onPause() {
super.onPause()
if (mMogoMapView != null) {
mMogoMapView!!.onPause()
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
override fun onResume() {
super.onResume()
if (mMogoMapView != null) {
mMogoMapView!!.onResume()
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
override fun onLowMemory() {
super.onLowMemory()
if (mMogoMapView != null) {
mMogoMapView!!.onLowMemory()
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
private fun initMapView() {
mMogoMap = mMogoMapView!!.map
if (mMogoMap == null) {
return
}
val uiSettings = mMogoMap!!.uiSettings
if (uiSettings != null) {
//设置所有手势是否可用
uiSettings.setAllGesturesEnabled(true)
//设置指南针是否可见。
uiSettings.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
uiSettings.setIndoorSwitchEnabled(true)
//设置定位按钮是否可见。
uiSettings.setMyLocationButtonEnabled(false)
//设置旋转手势是否可用。
uiSettings.setRotateGesturesEnabled(false)
//设置比例尺控件是否可见
uiSettings.setScaleControlsEnabled(true)
//设置拖拽手势是否可用。
uiSettings.setScrollGesturesEnabled(true)
//设置倾斜手势是否可用。
uiSettings.setTiltGesturesEnabled(true)
//设置缩放按钮是否可见。
uiSettings.setZoomControlsEnabled(false)
//设置双指缩放手势是否可用。
uiSettings.setZoomGesturesEnabled(true)
}
}
private fun initMapBiz() {
// TODO 临时初始化地图监听工控机、OBU等数据监听器用于感知元素绘制
MapIdentifySubscriber.instance
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
SpeedLimitDataManager.getInstance().start()
}
override fun getUIController(): IMogoMapUIController {
return mMogoMap!!.uiController
}
override fun onDestroyView() {
CallerSkinModeListenerManager.removeListener(Companion.functionName)
CallerChassisLocationWGS84ListenerManager.removeListener(Companion.functionName)
CallerChassisLamplightListenerManager.removeListener(Companion.functionName)
if (mMogoMapView != null) {
mMogoMapView!!.onDestroy()
mMogoMapView = null
mMogoMap = null
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
super.onDestroyView()
}
override fun changeMaoViewAngle(type: Int) {
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
mMogoMapView!!.map.uiController.changeMapViewAngle(type)
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
override fun changeCurrentIcon(iconId: Int) {
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
mMogoMapView!!.map.uiController.changeCurrentIcon(iconId)
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
override fun setMapDAngle(mode: Int) {
val angle = getSightModeAngle(mode)
if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
mMogoMapView!!.map.uiController.setMapDAngle(angle)
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
}
}
private fun getSightModeAngle(mode: Int): Float { //todo 宏宇
var angle = 0.0f
when (mode) {
SIGHT_MODE_NORMAL -> {
angle = 16.5f
angle = 16.5f
angle = 16.5f
angle = 16.5f
angle = 16.5f
}
SIGHT_MODE_TOP -> {
angle = 16.5f
angle = 16.5f
angle = 16.5f
angle = 16.5f
}
SIGHT_MODE_BACK -> {
angle = 16.5f
angle = 16.5f
angle = 16.5f
}
SIGHT_MODE_CROSS -> {
angle = 16.5f
angle = 16.5f
}
SIGHT_MODE_FAR -> angle = 16.5f
}
return angle
}
override fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine? {
return if (mMogoMapView != null && mMogoMapView!!.map != null && mMogoMapView!!.map.uiController != null) {
mMogoMapView!!.map.uiController.getCenterLineInfo(lon, lat, angle)
} else {
e(SceneConstant.M_MAP + Companion.functionName, "mMogoMapView is null")
null //上层使用应该判空
}
}
override fun onSkinModeChange(skinMode: Int) {
if (skinMode == 0) {
CallerHDMapManager.stepInVrMode(false)
} else if (skinMode == 1) {
CallerHDMapManager.stepInVrMode(true)
}
}
override fun setPointCloudSize(pointCloudSize: Float) {
//设置点云大小
PointCloudHelper.setPointCloudSize(pointCloudSize)
}
override fun setPointCloudColor(color: String) {
// 设置点云颜色
PointCloudHelper.setPointCloudColor(color)
}
override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
try {
// 是否绘制点云
PointCloudHelper.setIsDrawPointCloud(isDrawPointCloud)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 设置地图是否是Debug模式
*
* @param debugMode 是否开启Debug模式
*/
override fun setDebugMode(debugMode: Boolean) {
MapAutoApi.setDebugMode(debugMode)
}
override val functionName: String
get() = functionName
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
mMogoMapView?.setExtraGPSData(gnssInfo)
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
lightSwitch?.let {
when (it.number) {
1 -> { //左转灯
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
}
2 -> { //右转灯
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
else -> {
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
}
}
}

View File

@@ -1,19 +0,0 @@
package com.mogo.eagle.core.function.map;
import com.mogo.commons.mvp.Presenter;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述
*/
public class MapPresenter extends Presenter<MapView> {
private static final String TAG = "MapPresenter";
public MapPresenter(MapView view) {
super(view);
}
}

View File

@@ -1,20 +0,0 @@
package com.mogo.eagle.core.function.map;
import com.mogo.commons.mvp.IView;
import com.mogo.map.uicontroller.IMogoMapUIController;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 地图view
*/
public interface MapView extends IView {
/**
* 地图控制接口
*
* @return
*/
IMogoMapUIController getUIController();
}

View File

@@ -13,13 +13,10 @@ import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.Polyline;
import com.amap.api.navi.AMapNaviView;
import com.autonavi.amap.mapcore.IPoint;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 包名: com.amap.api.navi.core

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.function.view.R
import kotlinx.android.synthetic.main.view_maker_with_count.view.*
class MakerWithCount @JvmOverloads constructor(

View File

@@ -35,7 +35,7 @@ import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;

View File

@@ -20,7 +20,7 @@ import com.mogo.eagle.core.function.api.map.smp.IMogoSmallMapProvider;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.function.map.R;
import com.mogo.eagle.core.function.view.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;

View File

@@ -6,7 +6,7 @@ import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.function.view.R
class V2XMarkerView @JvmOverloads constructor(
context: Context,

View File

@@ -21,7 +21,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.function.view.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger

View File

@@ -0,0 +1,112 @@
package com.mogo.eagle.core.function.view
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.lifecycle.LifecycleObserver
import chassis.Chassis
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.map.MogoMapView
class MapBizView(context: Context?, attrs: AttributeSet?) : MogoMapView(context, attrs), IMoGoSkinModeChangeListener,
IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener , LifecycleObserver {
companion object{
private const val TAG = "MapBizView"
}
override fun onCreate(bundle: Bundle?) {
super.onCreate(bundle)
map?.uiController?.showMyLocation(true)
initMapView()
CallerSkinModeListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
CallerChassisLamplightListenerManager.addListener(TAG, this)
}
private fun initMapView(){
map?.uiSettings?.let {
//设置所有手势是否可用
it.setAllGesturesEnabled(true)
//设置指南针是否可见。
it.setCompassEnabled(false)
//设置室内地图楼层切换控件是否可见。
it.setIndoorSwitchEnabled(true)
//设置定位按钮是否可见。
it.setMyLocationButtonEnabled(false)
//设置旋转手势是否可用。
it.setRotateGesturesEnabled(false)
//设置比例尺控件是否可见
it.setScaleControlsEnabled(true)
//设置拖拽手势是否可用。
it.setScrollGesturesEnabled(true)
//设置倾斜手势是否可用。
it.setTiltGesturesEnabled(true)
//设置缩放按钮是否可见。
it.setZoomControlsEnabled(false)
//设置双指缩放手势是否可用。
it.setZoomGesturesEnabled(true)
}
}
override fun onSaveInstanceState(outState: Bundle?) {
super.onSaveInstanceState(outState)
}
override fun onResume() {
super.onResume()
}
override fun onPause() {
super.onPause()
}
override fun onSkinModeChange(skinMode: Int) {
if (skinMode == 0) {
CallerMapUIServiceManager.getMapUIController()?.stepInVrMode(false)
} else if (skinMode == 1) {
CallerMapUIServiceManager.getMapUIController()?.stepInVrMode(true)
}
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
// 跟新地图控件
setExtraGPSData(gnssInfo)
}
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
super.onAutopilotLightSwitchData(lightSwitch)
lightSwitch?.let {
when (it.number) {
1 -> { //左转灯
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
}
2 -> { //右转灯
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
}
else -> {
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
}
}
}
}
override fun onDestroy() {
// 先取消注册数据再onDestroy
CallerSkinModeListenerManager.removeListener(TAG)
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
CallerChassisLamplightListenerManager.removeListener(TAG)
super.onDestroy()
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.overview.view
package com.mogo.eagle.core.function.view
import android.content.Context
import android.graphics.Bitmap
@@ -16,7 +16,6 @@ import com.amap.api.maps.CameraUpdate
import com.amap.api.maps.CameraUpdateFactory
import com.amap.api.maps.TextureMapView
import com.amap.api.maps.model.*
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.Infrastructure
import com.mogo.eagle.core.data.map.MogoLocation
@@ -29,7 +28,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20Lis
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.biz.CallerFuncBizListenerManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showVideoDialog
import com.mogo.eagle.core.function.map.R
import com.mogo.eagle.core.function.smp.MakerWithCount
import com.mogo.eagle.core.function.smp.MarkerDrawerManager
import com.mogo.eagle.core.function.smp.MarkerDrawerManager.callback
@@ -318,7 +316,7 @@ class OverMapView @JvmOverloads constructor(
val center = v2xEvent.center
if (center != null) {
val markerOption = MarkerOptions()
var latLng: LatLng =
val latLng: LatLng =
if (v2xEvent.coordinateType == null || v2xEvent.coordinateType == 0) {
LatLng(center.lat, center.lon)
} else {
@@ -584,12 +582,15 @@ class OverMapView @JvmOverloads constructor(
}
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
mLocation = gnssInfo
lonLat = Pair(gnssInfo!!.longitude, gnssInfo.latitude)
drawCarMarker(gnssInfo)
if (isFirstLocation) {
displayCustomOverView()
isFirstLocation = false
gnssInfo?.let {
mLocation = it
lonLat = Pair(it.longitude, it.latitude)
drawCarMarker(it)
if (isFirstLocation) {
displayCustomOverView()
isFirstLocation = false
}
}
}
}

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.mogo.map.MogoMapView
android:id="@+id/module_map_id_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -11,7 +11,7 @@ import com.mogo.eagle.core.function.startup.stageone.ThreadOptStartup
import com.mogo.eagle.core.function.startup.stagetwo.AutopilotStartUp
import com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp
import com.mogo.eagle.core.function.startup.stagetwo.ObuStartUp
import com.mogo.eagle.core.function.startup.stagetwo.V2XStartUp
import com.mogo.eagle.core.function.startup.stagetwo.MapBizStartUp
import com.rousetime.android_startup.StartupListener
import com.rousetime.android_startup.StartupManager
import com.rousetime.android_startup.model.CostTimesModel
@@ -79,7 +79,7 @@ class MogoStartUpProvider: IStartUpProvider {
.addStartup(DataCenterStartUp())
.addStartup(AutopilotStartUp())
.addStartup(ObuStartUp())
.addStartup(V2XStartUp())
.addStartup(MapBizStartUp())
.setConfig(config)
.build(it)
.start()

View File

@@ -5,10 +5,10 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.rousetime.android_startup.AndroidStartup
class V2XStartUp: AndroidStartup<Boolean>() {
class MapBizStartUp: AndroidStartup<Boolean>() {
override fun create(context: Context): Boolean? {
ARouter.getInstance().build(MogoServicePaths.PATH_V2X_MODULE).navigation()
override fun create(context: Context): Boolean {
ARouter.getInstance().build(MogoServicePaths.PATH_MAP_BIZ).navigation()
return true
}
@@ -20,7 +20,7 @@ class V2XStartUp: AndroidStartup<Boolean>() {
return false
}
override fun dependenciesByName(): List<String>? {
override fun dependenciesByName(): List<String> {
val deps = arrayListOf<String>()
deps.add("com.mogo.eagle.core.function.startup.stagetwo.DataCenterStartUp")
return deps

View File

@@ -8,13 +8,6 @@ import androidx.annotation.Keep;
@Keep
public class MoGoFragmentPaths {
/**
* 高精地图 Fragment
*/
@Keep
@Deprecated
public static final String PATH_FRAGMENT_MAP = "/hd_map_ui/";
/**
* 小地图 Fragment
*/

View File

@@ -20,9 +20,14 @@ public class MogoServicePaths {
* 地图服务接口ARouter实例化路径
*/
@Keep
@Deprecated
public static final String PATH_SERVICES_MAP = "/mapservices/api";
/**
* 地图业务 实现,包括感知物绘制,点云,绘制,采集相关
*/
@Keep
public static final String PATH_MAP_BIZ = "/mapbiz/api";
/**
* Float View
*/
@@ -33,6 +38,7 @@ public class MogoServicePaths {
/**
* v2x 模块
*/
@Deprecated
public static final String PATH_V2X_MODULE = "/v2x_api/module";
/**

View File

@@ -283,4 +283,11 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
* 福田清扫车业务指令下发
*/
fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd)
/**
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
}

View File

@@ -1,74 +0,0 @@
package com.mogo.eagle.core.function.api.map.hd
import androidx.annotation.RawRes
import com.mogo.eagle.core.data.map.CenterLine
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
/**
* @author donghongyu
* @date 12/10/20 1:36 PM
* 地图层控制
*/
interface IMoGoMapFragmentProvider : IMoGoFunctionServerProvider {
/**
* 修改地图中心点
* MapAutoApi.CAR_CENTER_100 1/4
* MapAutoApi.CAR_CENTER_100 2/5
* MapAutoApi.CAR_CENTER_100 80米
* MapAutoApi.CAR_CENTER_100 2/5
*/
fun changeMaoViewAngle(type: Int)
/**
* 修改高精地图自车图标
* 传入资源ID
*/
fun changeCurrentIcon(@RawRes iconId: Int)
/**
* 设置地图视线角度
*/
fun setMapDAngle(mode: Int)
/**
* 获取车道中心线信息
*/
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine?
/**
* 进入VR 模式
*
* @param isDayMode true-白天模式false-夜间模式
*/
fun stepInVrMode(isDayMode: Boolean)
/**
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
/**
* 设制点云大小
*
* @param pointCloudSize 点云的点大小
*/
fun setPointCloudSize(pointCloudSize: Float)
/**
* 设置点云颜色
*
* @param color // color:"#RRGGBB*
*/
fun setPointCloudColor(color: String)
/**
* 设置地图是否是Debug模式
* @param debugMode 是否开启Debug模式
*/
fun setDebugMode(debugMode: Boolean)
}

View File

@@ -104,14 +104,14 @@ object CallerAutoPilotControlManager {
/**
* 开启域控制器录制bag包
*/
@BizConfig(FuncBizConfig.FOUNDATION,"", FuncBizConfig.BIZ_BAG_RECORD)
@BizConfig(FuncBizConfig.FOUNDATION, "", FuncBizConfig.BIZ_BAG_RECORD)
fun recordPackage() {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt())
}
}
@BizConfig(FuncBizConfig.FOUNDATION,"", FuncBizConfig.BIZ_BAG_RECORD)
@BizConfig(FuncBizConfig.FOUNDATION, "", FuncBizConfig.BIZ_BAG_RECORD)
fun recordPackage(duration: Int) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.recordPackage(1, Random(SystemClock.elapsedRealtime()).nextInt(), duration)
@@ -136,8 +136,8 @@ object CallerAutoPilotControlManager {
}
}
fun recordPackage(type: Int,id: Int,duration: Int,bduration: Int,topics: List<String>){
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
fun recordPackage(type: Int, id: Int, duration: Int, bduration: Int, topics: List<String>) {
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
providerApi?.recordPackage(type, id, duration, bduration, topics)
}
}
@@ -240,7 +240,7 @@ object CallerAutoPilotControlManager {
* isEnable = false 关闭
* @return boolean
*/
fun sendDetouring(isEnable: Boolean): Boolean?{
fun sendDetouring(isEnable: Boolean): Boolean? {
return providerApi?.sendDetouring(isEnable)
}
@@ -249,7 +249,7 @@ object CallerAutoPilotControlManager {
* @param speed 速度阈值 m/s
* @return boolean
*/
fun sendDetouringSpeed(speed: Double): Boolean?{
fun sendDetouringSpeed(speed: Double): Boolean? {
return providerApi?.sendDetouringSpeed(speed)
}
@@ -259,11 +259,11 @@ object CallerAutoPilotControlManager {
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
* @param topicsNeedToCache
*/
fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List<String>): Boolean?{
fun getBadCaseConfig(reqType: Int, recordType: Int, topicsNeedToCache: List<String>): Boolean? {
// 司机屏才能查询数据采集的配置
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
return providerApi?.getBadCaseConfig(reqType, recordType, topicsNeedToCache)
}else{
} else {
return false
}
}
@@ -310,7 +310,13 @@ object CallerAutoPilotControlManager {
* @return boolean
*/
@JvmStatic
fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean) {
fun sendTripInfo(
type: Int,
lineName: String,
departureStopName: String,
arrivalStopName: String,
isLastStop: Boolean
) {
providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop)
}
@@ -401,4 +407,12 @@ object CallerAutoPilotControlManager {
fun sendSweeperFuTianTaskCmd(fuTianTaskCmd: SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd) {
providerApi?.sendSweeperFuTianTaskCmd(fuTianTaskCmd)
}
/**
* 打开点云绘制
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
providerApi?.setIsDrawPointCloud(isDrawPointCloud)
}
}

View File

@@ -14,7 +14,9 @@ object CallerPlanningRottingListenerManager : CallerBase<IMoGoPlanningRottingLis
private var globalPathResp: MessagePad.GlobalPathResp? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoPlanningRottingListener) {
listener.onAutopilotRotting(globalPathResp)
globalPathResp?.let {
listener.onAutopilotRotting(globalPathResp)
}
}
/**

View File

@@ -1,112 +0,0 @@
package com.mogo.eagle.core.function.call.map
import androidx.annotation.RawRes
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.map.CenterLine
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.common.Constants
import com.zhidao.support.adas.high.common.MessageType
/**
* @author xiaoyuzhou
* @date 2021/9/17 6:15 下午
* 高精度地图控制
*/
object CallerHDMapManager {
private val mapProviderApi: IMoGoMapFragmentProvider
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_MAP)
.navigation() as IMoGoMapFragmentProvider
/**
* 修改地图中心点
* MapAutoApi.CAR_CENTER_100 1/4
* MapAutoApi.CAR_CENTER_100 2/5
* MapAutoApi.CAR_CENTER_100 80米
* MapAutoApi.CAR_CENTER_100 2/5
*/
fun changeMaoViewAngle(type: Int) {
mapProviderApi.changeMaoViewAngle(type)
}
/**
* 修改高精地图自车图标
* 传入资源ID
*/
fun changeCurrentIcon(@RawRes iconId: Int) {
mapProviderApi.changeCurrentIcon(iconId)
}
/**
* 设置地图视线角度
*/
fun setMapDAngle(mode: Int) {
mapProviderApi.setMapDAngle(mode)
}
/**
* 获取车道中心线信息
*/
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine? {
return mapProviderApi.getCenterLineInfo(lon, lat, angle)
}
/**
* 切换到自研vr
* @param isDayMode true-白天模式false-夜间模式
*/
fun stepInVrMode(isDayMode: Boolean) {
return mapProviderApi.stepInVrMode(isDayMode)
}
/**
*
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
fun setIsDrawPointCloud(isDrawPointCloud: Boolean) {
if (isDrawPointCloud) {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
} else {
AdasManager.getInstance().subscribeInterface(
Constants.TERMINAL_ROLE.DRIVER,
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
MessageType.TYPE_RECEIVE_POINT_CLOUD)
}
FunctionBuildConfig.isDrawPointCloudData = isDrawPointCloud
return mapProviderApi.setIsDrawPointCloud(isDrawPointCloud)
}
/**
* 设制点云大小
* @param pointCloudSize 点云的点大小
*/
fun setPointCloudSize(pointCloudSize: Float) {
return mapProviderApi.setPointCloudSize(pointCloudSize)
}
/**
* 设置点云颜色
*
* @param color // color:"#RRGGBB*
*/
fun setPointCloudColor(color: String) {
return mapProviderApi.setPointCloudColor(color)
}
/**
* 设置地图是否是Debug模式
* @param debugMode 是否开启Debug模式
*/
fun setDebugMode(debugMode: Boolean) {
return mapProviderApi.setDebugMode(debugMode)
}
}

View File

@@ -1023,6 +1023,7 @@
<dimen name="dp_1200">1200dp</dimen>
<dimen name="dp_1300">1300dp</dimen>
<dimen name="dp_1600">1600dp</dimen>
<dimen name="dp_1860">1860dp</dimen>
<dimen name="dp_1920">1920dp</dimen>

View File

@@ -32,6 +32,13 @@ public interface IMogoMapUIController {
*/
MapControlResult changeZoom(float zoom);
/**
* 设置地图是否是Debug模式
*
* @param debugMode 是否开启Debug模式
*/
void setDebugMode(Boolean debugMode);
/**
* 进入VR 模式
*
@@ -333,4 +340,25 @@ public interface IMogoMapUIController {
* @param gnssInfo RTK 高精坐标,车辆惯导数据
*/
void setExtraGPSData(MogoLocation gnssInfo);
/**
* 打开点云绘制
*
* @param isDrawPointCloud 是否绘制点云
*/
void setIsDrawPointCloud(Boolean isDrawPointCloud);
/**
* 设制点云大小
*
* @param pointCloudSize 点云的点大小
*/
void setPointCloudSize(Float pointCloudSize);
/**
* 设置点云颜色
*
* @param color // color:"#RRGGBB*
*/
void setPointCloudColor(String color);
}

View File

@@ -62,6 +62,7 @@ import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapViewVisualAngleChangeListener;
import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener;
import com.zhidaoauto.map.sdk.open.abs.log.ILog;
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper;
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
@@ -88,8 +89,6 @@ import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
public class AMapViewWrapper implements IMogoMapView,
IMogoMapUIController,
LocationListener,
@@ -352,6 +351,10 @@ public class AMapViewWrapper implements IMogoMapView,
return MapControlResult.SUCCESS;
}
@Override
public void setDebugMode(Boolean debugMode) {
MapAutoApi.INSTANCE.setDebugMode(debugMode);
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
@@ -701,7 +704,7 @@ public class AMapViewWrapper implements IMogoMapView,
CallerMapLocationListenerManager.INSTANCE.setCurrentLocation(ObjectUtils.fromLocation(location));
// 将有效经纬度暂存本地提供给下一次的Http-DNS使用防止首次请求位置获取不到
if (location.getLat() > 0 && location.getLon() > 0) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
SharedPrefsMgr.getInstance(mMapView.getContext())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, location.getCityCode());
}
@@ -1068,5 +1071,27 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
try {
// 是否绘制点云
PointCloudHelper.INSTANCE.setIsDrawPointCloud(isDrawPointCloud);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void setPointCloudSize(Float pointCloudSize) {
//设置点云大小
PointCloudHelper.INSTANCE.setPointCloudSize(pointCloudSize);
}
@Override
public void setPointCloudColor(String color) {
// 设置点云颜色
PointCloudHelper.INSTANCE.setPointCloudColor(color);
}
}

View File

@@ -69,6 +69,13 @@ public class MogoMapUIController implements IMogoMapUIController {
return MapControlResult.ERROR;
}
@Override
public void setDebugMode(Boolean debugMode) {
initDelegate();
if (mDelegate != null) {
mDelegate.setDebugMode(debugMode);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
@@ -421,4 +428,28 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.setExtraGPSData(gnssInfo);
}
}
@Override
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
initDelegate();
if (mDelegate != null) {
mDelegate.setIsDrawPointCloud(isDrawPointCloud);
}
}
@Override
public void setPointCloudSize(Float pointCloudSize) {
initDelegate();
if (mDelegate != null) {
mDelegate.setPointCloudSize(pointCloudSize);
}
}
@Override
public void setPointCloudColor(String color) {
initDelegate();
if (mDelegate != null) {
mDelegate.setPointCloudColor(color);
}
}
}

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
import mogo.telematics.pad.MessagePad;
/**
* @author congtaowang

View File

@@ -62,6 +62,13 @@ public class AMapUIController implements IMogoMapUIController {
return MapControlResult.ERROR;
}
@Override
public void setDebugMode(Boolean debugMode) {
if (mClient != null) {
mClient.setDebugMode(debugMode);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
if (mClient != null) {
@@ -265,15 +272,20 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public int getLimitSpeed(double lon, double lat, float angle) {
return mClient.getLimitSpeed(lon, lat, angle);
if(mClient!= null){
return mClient.getLimitSpeed(lon, lat, angle);
}
return 0;
}
@Override
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
return mClient.getCenterLineInfo(lon, lat, angle);
if(mClient != null){
return mClient.getCenterLineInfo(lon, lat, angle);
}
return null;
}
@Override
public void rtkEnable(boolean enable) {
if (mClient != null) {
@@ -361,4 +373,25 @@ public class AMapUIController implements IMogoMapUIController {
mClient.setExtraGPSData(gnssInfo);
}
}
@Override
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
if (mClient != null) {
mClient.setIsDrawPointCloud(isDrawPointCloud);
}
}
@Override
public void setPointCloudSize(Float pointCloudSize) {
if (mClient != null) {
mClient.setPointCloudSize(pointCloudSize);
}
}
@Override
public void setPointCloudColor(String color) {
if (mClient != null) {
mClient.setPointCloudColor(color);
}
}
}