合并main与hmi模块

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-03-30 11:17:25 +08:00
parent 5c2eed3e53
commit 734d1d3efd
68 changed files with 181 additions and 346 deletions

View File

@@ -5,6 +5,7 @@ plugins {
id 'kotlin-kapt'
id 'com.alibaba.arouter'
}
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
@@ -50,39 +51,93 @@ dependencies {
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.flexbox
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.mogoaicloudtrafficlive
kapt rootProject.ext.dependencies.aroutercompiler
kapt rootProject.ext.dependencies.androidxroomcompiler
implementation rootProject.ext.dependencies.androidxroomruntime
implementation rootProject.ext.dependencies.androidxroomktx
//Crash日志收集
implementation rootProject.ext.dependencies.crashSdk
implementation rootProject.ext.dependencies.boostmultidex
debugImplementation rootProject.ext.dependencies.debugleakcanary
releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.mogoami
implementation rootProject.ext.dependencies.mogochainbase
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.modulecommon
compileOnly rootProject.ext.dependencies.mogoserviceapi
api rootProject.ext.dependencies.mogoaicloudservicesdk
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.modulecommon
api rootProject.ext.dependencies.mogoserviceapi
api rootProject.ext.dependencies.moduleservice
api rootProject.ext.dependencies.mogoservice
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.crashreportupgrade
// api rootProject.ext.dependencies.crashreportbugly
api rootProject.ext.dependencies.mogo_core_res
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_utils
api rootProject.ext.dependencies.mogo_core_network
api rootProject.ext.dependencies.mogo_core_function_obu_mogo
api rootProject.ext.dependencies.mogo_core_function_notice
api rootProject.ext.dependencies.mogo_core_function_bindingcar
api rootProject.ext.dependencies.mogo_core_function_autopilot
api rootProject.ext.dependencies.mogo_core_function_check
api rootProject.ext.dependencies.mogo_core_function_map
api rootProject.ext.dependencies.mogo_core_function_v2x
api rootProject.ext.dependencies.mogo_core_function_monitoring
api rootProject.ext.dependencies.mogo_core_function_devatools
api rootProject.ext.dependencies.mogo_core_function_carcorder
api rootProject.ext.dependencies.mogo_core_function_call
api rootProject.ext.dependencies.mogo_core_function_api
implementation project(':libraries:map-usbcamera')
implementation rootProject.ext.dependencies.mogo_core_res
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_network
implementation rootProject.ext.dependencies.mogo_core_function_call
} else {
implementation project(':modules:mogo-module-common')
implementation project(':services:mogo-service-api')
implementation project(':libraries:map-usbcamera')
api project(':foudations:mogo-aicloud-services-sdk')
api project(':foudations:mogo-commons')
api project(':modules:mogo-module-common')
api project(':services:mogo-service-api')
api project(':services:mogo-service')
implementation project(':core:mogo-core-res')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-network')
implementation project(':core:mogo-core-function-api')
implementation project(':core:mogo-core-function-call')
api project(':modules:mogo-module-service')
api project(':libraries:mogo-map')
api project(':test:crashreport-upgrade')
// api project(':test:crashreport-bugly')
api project(':test:crashreport-apmbyte')
api project(':core:mogo-core-res')
api project(':core:mogo-core-data')
api project(':core:mogo-core-utils')
api project(':core:function-impl:mogo-core-function-obu-mogo')
api project(':core:function-impl:mogo-core-function-autopilot')
api project(':core:function-impl:mogo-core-function-check')
api project(':core:function-impl:mogo-core-function-map')
api project(':core:function-impl:mogo-core-function-notice')
api project(':core:function-impl:mogo-core-function-v2x')
api project(':core:function-impl:mogo-core-function-monitoring')
api project(':core:function-impl:mogo-core-function-devatools')
api project(':core:function-impl:mogo-core-function-carcorder')
api project(':core:function-impl:mogo-core-function-dispatch')
api project(':core:function-impl:mogo-core-function-chat')
api project(':core:function-impl:mogo-core-function-bindingcar')
api project(':core:mogo-core-function-call')
api project(':core:mogo-core-function-api')
api project(':libraries:map-usbcamera')
}
}

View File

@@ -3,9 +3,73 @@
package="com.mogo.eagle.core.function.hmi">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application>
<!-- &lt;!&ndash;保活用&ndash;&gt;
<service
android:name="com.zhidao.boot.persistent.lib.PersistentAliveService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.zhidao.boot.persistent.lib.action" />
</intent-filter>
</service>
<activity
android:name="com.zhidao.boot.persistent.lib.PersistentAliveActivity"
android:resizeableActivity="false"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
-->
<activity
android:name="com.mogo.eagle.core.function.main.MainLauncherActivity"
android:clearTaskOnLaunch="true"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:launchMode="singleTop"
android:resizeableActivity="false"
android:resumeWhilePausing="true"
android:screenOrientation="landscape"
android:stateNotNeeded="true"
android:theme="@style/Main"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!--调试用暂时开启LAUNCHER这个属性-->
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data
android:host="launcher"
android:path="/main/switch2"
android:scheme="mogo" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
<service
android:name="com.mogo.eagle.core.function.main.service.MogoMainService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.mogo.launcher.action.MAIN_SERVICE" />
</intent-filter>
</service>
<receiver android:name="com.mogo.eagle.core.function.hmi.receiver.V2XWarningBroadcastReceiver">
<intent-filter>
<action android:name="com.hmi.v2x.notification" />

View File

@@ -0,0 +1,417 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.location.Location;
import android.view.MotionEvent;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.main.registercenter.MogoRegisterCenterHandler;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.VisualAngleMode;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author congtaowang
* @since 2020-04-24
* <p>
* 事件回调分发中心
*/
public class EventDispatchCenter implements
IMogoNaviListener,
IMogoMarkerClickListener,
IMogoCarLocationChangedListener2,
IMogoMapListener,
IMogoLocationListener {
private static volatile EventDispatchCenter sInstance;
private Runnable mMapLoadedCallback;
private EventDispatchCenter() {
}
public static EventDispatchCenter getInstance() {
if (sInstance == null) {
synchronized (EventDispatchCenter.class) {
if (sInstance == null) {
sInstance = new EventDispatchCenter();
}
}
}
return sInstance;
}
private static final String TAG = "DispatchCenter";
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener(marker.getOwner());
if (listener != null) {
try {
return listener.onMarkerClicked(marker);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMarkerClicked error : " + e);
}
}
return false;
}
@Override
public boolean onStaticMarkerClicked(IMogoMarker marker) {
ArrayList<IMogoMarkerClickListener> list = MogoRegisterCenterHandler.getInstance().getStaticMarkerListener(marker.getOwner());
if (list == null) {
return false;
}
try {
for (IMogoMarkerClickListener listener : list) {
return listener.onStaticMarkerClicked(marker);
}
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onStaticMarkerClicked error : " + e);
}
return false;
}
@Override
public void onCarLocationChanged2(Location latLng) {
Iterator<IMogoCarLocationChangedListener> iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
if (iterator == null) {
return;
}
MogoLatLng target = null;
while (iterator.hasNext()) {
IMogoCarLocationChangedListener listener = iterator.next();
if (listener instanceof IMogoCarLocationChangedListener2) {
try {
((IMogoCarLocationChangedListener2) listener).onCarLocationChanged2(latLng);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* 地图加载完成回调
*
* @param callback
*/
void setMapLoadedCallback(Runnable callback) {
this.mMapLoadedCallback = callback;
}
@Override
public void onMapLoaded() {
if (mMapLoadedCallback != null) {
mMapLoadedCallback.run();
mMapLoadedCallback = null;
}
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onMapLoaded();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMapLoaded error : " + e);
}
}
}
}
@Override
public void onTouch(MotionEvent motionEvent) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onTouch(motionEvent);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onTouch error : " + e);
}
}
}
}
@Override
public void onPOIClick(MogoPoi poi) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onPOIClick(poi);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onPOIClick error : " + e);
}
}
}
}
@Override
public void onMapClick(MogoLatLng latLng) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onMapClick(latLng);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMapClick error : " + e);
}
}
}
}
@Override
public void onLockMap(boolean isLock) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onLockMap(isLock);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onLockMap error : " + e);
}
}
}
}
@Override
public void onMapModeChanged(EnumMapUI ui) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onMapModeChanged(ui);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMapModeChanged error :" + e);
}
}
}
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onMapVisualAngleChanged(visualAngleMode);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMapVisualAngleChanged error : " + e);
}
}
}
}
@Override
public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
final long start = System.currentTimeMillis();
Iterator<IMogoMapListener> iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoMapListener listener = iterator.next();
if (listener != null) {
try {
listener.onMapChanged(location, zoom, tilt, bearing);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onMapChanged error :" + e);
}
}
}
}
@Override
public void onInitNaviFailure() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onInitNaviFailure();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onInitNaviFailure error : " + e);
}
}
}
}
@Override
public void onInitNaviSuccess() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onInitNaviSuccess();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onInitNaviSuccess error : " + e);
}
}
}
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onNaviInfoUpdate(naviinfo);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onNaviInfoUpdate error : " + e);
}
}
}
}
@Override
public void onStartNavi() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onStartNavi();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onStartNavi error : " + e);
}
}
}
}
@Override
public void onStopNavi() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onStopNavi();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onStopNavi error : " + e);
}
}
}
}
@Override
public void onCalculateSuccess() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onCalculateSuccess();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onCalculateSuccess error : " + e);
}
}
}
}
@Override
public void onoCalculateFailed() {
Iterator<IMogoNaviListener> iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoNaviListener listener = iterator.next();
if (listener != null) {
try {
listener.onoCalculateFailed();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onoCalculateFailed error : " + e);
}
}
}
}
@Override
public void onLocationChanged(MogoLocation location) {
Iterator<IMogoLocationListener> iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
if (iterator == null) {
return;
}
while (iterator.hasNext()) {
IMogoLocationListener listener = iterator.next();
if (listener != null) {
try {
listener.onLocationChanged(location);
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "onLocationChanged error : " + e);
}
}
}
}
}

View File

@@ -0,0 +1,476 @@
package com.mogo.eagle.core.function.main;
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_MAIN;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
import com.mogo.eagle.core.function.main.service.MogoMainService;
import com.mogo.eagle.core.function.main.utils.DisplayEffectsHelper;
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.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.map.listener.IMogoHosListenerRegister;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述:加载各个模块
*/
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
IMogoLocationListener,
IMogoStatusChangedListener,
IMogoADASControlStatusChangedListener,
FragmentStackTransactionListener {
protected static final String TAG = "MainActivity";
private static final int REQUEST_CODE_DIALOG = 100;
protected IMogoServiceApis mServiceApis;
protected IMogoFragmentManager mMogoFragmentManager;
protected IMogoStatusManager mMogoStatusManager;
protected View mEntrance;
protected FrameLayout mFloatingLayout;
protected View mCoverUpLayout;
protected ConstraintLayout clSpecialEffect;
private boolean isFirst = false;
@Override
protected int getLayoutId() {
return R.layout.module_main_activity_main;
}
@Override
protected void beforeSetContentView(Bundle savedInstanceState) {
init();
}
@Override
protected void initViews() {
getWindow().setBackgroundDrawable(null);
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
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);
FloatingViewHandler.init(mFloatingLayout);
// if (CallChatApi.getInstance().getApiProvider() != null) {
// CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
// }
//申请悬浮窗权限
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// 检查是否有悬浮窗权限
if (Settings.canDrawOverlays(this)) {
return;
}
PermissionsDialogUtils.openAppDetails(this, "显示悬浮窗", REQUEST_CODE_DIALOG);
}
}
// 隐藏布局
protected void hideLayout() {
mEntrance.setVisibility(View.GONE);
mFloatingLayout.setVisibility(View.GONE);
}
// 显示布局
protected void showLayout() {
mEntrance.setVisibility(View.VISIBLE);
mFloatingLayout.setVisibility(View.VISIBLE);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
calculateStartTime();
ContextHolderUtil.holdContext(this);
mPresenter.postLoadModuleMsg();
NetworkUtils.listenNetStrength(this);
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
mPresenter.checkPermission(this);
}
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) {
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_MAIN + TAG, "coldStartTime:" + coldStartTime);
properties.put("app_launch_coldStartTime", coldStartTime);
}
} else if (hotStartTime > 0) {
// 过滤掉异常启动时间
if (hotStartTime < 30000) {
// 上传热启动时间hotStartTime
CallerLogger.INSTANCE.i(M_MAIN + TAG, "hotStartTime:" + hotStartTime);
properties.put("app_launch_hotStartTime", hotStartTime);
}
}
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("app_launch_time", properties);
}
}
private void init() {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
mMogoStatusManager = mServiceApis.getStatusManagerApi();
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
}
@Override
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulesManager.getInstance().init(this);
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
if (listenerRegister != null) {
listenerRegister.registerHostMapListener(EventDispatchCenter.getInstance());
listenerRegister.registerMarkerClickListener(EventDispatchCenter.getInstance());
}
initAdasControlStatusListener();
if (DebugConfig.isMapBased()) {
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "map loaded." + Thread.currentThread().getName());
// 延时加载其他模块
getWindow().getDecorView().postDelayed(() -> {
loadOthersModules();
loadFunctionFragment();
// TODO 这里临时兼容进入VR模式
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
}, 3000);
CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
});
loadFunctionMapView();
} else {
loadOthersModules();
}
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
if (mMogoFragmentManager != null) {
mMogoFragmentManager.init(this, R.id.module_main_id_search_fragment);
mMogoFragmentManager.initMessageHistoryContainerId(R.id.module_main_id_message_history_fragment_container);
mMogoFragmentManager.registerMainFragmentStackTransactionListener(this);
}
}
@Override
public void onTransaction(int size) {
if (size == 0) {
showLayout();
} else if (size == 1) {
hideLayout();
}
}
/**
* 加载其它模块
*/
protected void loadOthersModules() {
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
loadContainerModules();
MogoModulesManager.getInstance().loadModules();
MogoModulesManager.getInstance().loadFunctionModules();
MogoModulesManager.getInstance().loadFunctionModulesServer();
mPresenter.delayOperations();
// 启动一些基本的服务:定位等
startBaseService();
}
private void initAdasControlStatusListener() {
mServiceApis.getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
}
private void startBaseService() {
Intent intentMainServicee = new Intent(this, MogoMainService.class);
startService(intentMainServicee);
// USB 摄像头行车记录仪进程
// Intent intentCarcorderService = new Intent(this, CarcorderService.class);
// startService(intentCarcorderService);
}
protected void loadContainerModules() {
//MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
}
@Override
public void hideCoverUpLayout() {
getWindow().setBackgroundDrawable(null);
mCoverUpLayout.setVisibility(View.GONE);
}
@Override
public void loadFunctionFragment() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadFunctionFragment……");
// 加载 HMI 图层
BaseFragment fragmentHdMap = (BaseFragment) ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation();
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_waring_fragment);
// 加载 小地图 图层
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();
addFragment(fragmentHdMap, fragmentHdMap.getTagName(), R.id.module_main_id_map_fragment_container);
}
@NonNull
@Override
protected MainPresenter createPresenter() {
return new MainPresenter(this);
}
@Override
public void onLocationChanged(MogoLocation location) {
EventDispatchCenter.getInstance().onLocationChanged(location);
}
@Override
public void onMapUiModeChanged(EnumMapUI mapUI) {
switch (mapUI) {
case Type_Night:
break;
case Type_Light:
break;
}
}
@Override
protected void onResume() {
super.onResume();
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
}
@Override
protected void onPause() {
super.onPause();
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
}
@Override
protected void onStop() {
super.onStop();
if (mMogoStatusManager != null) {
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
}
}
@Override
public void onBackPressed() {
if (mMogoFragmentManager == null
|| mMogoFragmentManager.getStackSize() <= 0) {
if (DebugConfig.isLauncher()) {
doWhenBackPressed();
return;
} else {
if (doWhenBackPressed()) {
return;
}
super.onBackPressed();
}
} else {
mMogoFragmentManager.pop();
}
}
protected boolean doWhenBackPressed() {
return false;
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
mPresenter.handleSchemeIntent(intent, true);
}
@Override
public IMogoServiceApis getApis() {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
return mServiceApis;
}
@Override
protected void onDestroy() {
super.onDestroy();
IMogoHosListenerRegister listenerRegister = CallerMapUIServiceManager.INSTANCE.getHostListenerRegister();
if (listenerRegister != null) {
listenerRegister.unregisterMarkerClickListener();
listenerRegister.unregisterHostMapListener();
}
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
if (mMogoFragmentManager != null) {
mMogoFragmentManager.unregisterMainFragmentStackTransactionListener();
mMogoFragmentManager.destroy();
mMogoFragmentManager = null;
}
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (mapUIController != null) {
mapUIController.destroy();
}
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy.");
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();
SchemeIntent.getInstance().clear();
FloatingViewHandler.clear();
ProcessUtils.killAllBackgroundProcesses();
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
if (isTrue) {
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
} else {
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
}
mEntrance.setLayoutParams(entranceParams);
if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
clSpecialEffect.setVisibility(View.VISIBLE);
} else {
clSpecialEffect.setVisibility(View.GONE);
}
}
}
@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;
}
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
CallerLogger.INSTANCE.d(M_MAIN + TAG, "requestCode: " + requestCode + " resultCode: " + resultCode);
if (requestCode == REQUEST_CODE_DIALOG) {
//申请悬浮窗权限
}
}
/**
* 由于应用是单页面的所以采用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_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
getSupportFragmentManager().beginTransaction()
.replace(containerId, fragment, tagName)
.commitAllowingStateLoss();
}
}

View File

@@ -0,0 +1,128 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Process;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.StatusDescriptor;
/**
* 针对作为Launcher的情况做个性化操作
*
* @author tongchenfei
*/
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
private final static Handler handlerV2XEvent = new Handler();
private static Runnable runnableV2XEvent;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DebugConfig.setNeedRequestUserInfo(true);
CallerLogger.INSTANCE.i(M_MAIN +TAG, "onCreate");
}
@Override
protected void initViews() {
super.initViews();
}
@Override
protected void onStart() {
super.onStart();
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
//ActivityLifecycleManager.getInstance().setAppActive(true);
}
@Override
protected void onPause() {
super.onPause();
mIsHomeKeyDown = false;
}
@Override
protected void onStop() {
super.onStop();
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
//ActivityLifecycleManager.getInstance().setAppActive(false);
}
@Override
public void onIntentReceived(String intentStr, Intent intent) {
if (TextUtils.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr)) {
mIsHomeKeyDown = intent.getBooleanExtra("isHomeKeyDown", true);
}
}
@Override
protected void loadOthersModules() {
super.loadOthersModules();
CallerLogger.INSTANCE.d(M_MAIN + TAG, "loadOthersModules");
loadOCHModule();
}
/**
* 加载网约车模块
*/
private void loadOCHModule() {
IMoGoFunctionProvider ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/och/api")
.navigation(getContext());
if (ochProvider != null) {
ochProvider.createCoverage(this, R.id.module_main_id_och_fragment);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mServiceApis.getStatusManagerApi().unregisterStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
stopCountDown();
try {
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
Process.killProcess(Process.myPid());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onMapUiModeChanged(EnumMapUI mapUI) {
super.onMapUiModeChanged(mapUI);
Intent intent = new Intent("com.mogo.style.SKIN_CHANGED");
intent.putExtra("type", -1);
if (mapUI == EnumMapUI.Type_Light) {
intent.putExtra("type", 1);
} else if (mapUI == EnumMapUI.Type_Night) {
intent.putExtra("type", 0);
}
sendBroadcast(intent);
CallerLogger.INSTANCE.d(M_MAIN + TAG, "send msg to AI Voice");
}
private void stopCountDown() {
if (runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
runnableV2XEvent = null;
}
}
}

View File

@@ -0,0 +1,368 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.content.Context;
import android.os.Process;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.mogo.cloud.httpdns.MogoHttpDnsConfig;
import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation;
import com.mogo.cloud.passport.IMoGoTokenCallback;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.Utils;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.notice.PushUIConstants;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
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.ProcessUtils;
import com.mogo.map.MapApiPath;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.common.constants.HostConst;
import com.mogo.module.service.ServiceConst;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.cloud.socket.IMogoLifecycleListener;
import com.mogo.test.crashreport.CrashReportConstants;
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants;
import com.zhidao.support.obu.ami.AmiClientManager;
import java.lang.reflect.Field;
/**
* 默认初始化一些基础服务配置
*/
public abstract class MainMoGoApplication extends AbsMogoApplication {
private static final String TAG = "MogoApplication";
// 配置云服务API
protected MoGoAiCloudClientConfig clientConfig = MoGoAiCloudClientConfig.getInstance();
private long start;
@Override
public void onCreate() {
initBuildConfig();
initConfigWithSP();
super.onCreate();
if (!shouldInit()) {
return;
}
start = System.currentTimeMillis();
// Crash 日志收集
initCrashConfig();
initLogConfig();
initTipToast();
initModules();
initCloudClientConfig();
}
@Override
protected boolean shouldInit() {
CallerLogger.INSTANCE.w(M_MAIN + TAG, "evaluate shouldInit() with: " + ProcessUtils.getProcessName(Process.myPid()));
return ProcessUtils.isMainProcess(this);
}
/**
* BuildConfig中渠道配置赋值
*/
protected abstract void initBuildConfig();
/**
* 从SP本地设置中恢复数据
*/
protected abstract void initConfigWithSP();
/**
* 初始化异常采集配置
*/
protected abstract void initCrashConfig();
/**
* 初始化异常采集配置
*/
protected abstract void initAnalyticsConfig();
/**
* 初始化日志
*/
protected void initLogConfig() {
// 为了不引入maven的情况下修改日志控制字段值采用反射
try {
Class clazz = Class.forName("com.mogo.cloud.location.LocationConfig");
Field nameField = clazz.getField("isPrintLog");
nameField.setBoolean(null, false);
} catch (Exception e) {
e.printStackTrace();
}
SocketBuildConfig.isPrintLog = false;
}
/**
* 初始化 MoGoAiCloudClientConfig
*/
protected abstract void initCloudClientConfig();
@Override
protected void asyncInitImpl() {
super.asyncInitImpl();
initAnalyticsConfig();
}
@Override
protected void initHttpDns() {
super.initHttpDns();
prepareBaseService();
}
/**
* 基础服务passport、location、socket
*/
private void prepareBaseService() {
// 第三方平台的sn是由AI云SDK中服务调用通过服务端生成的
preparePassportEnvironment();
}
private void preparePassportEnvironment() {
// 设置网络环境HTTP_DNS_ENV_QA、HTTP_DNS_ENV_RELEASE、HTTP_DNS_ENV_DEV
switch (DebugConfig.getNetMode()) {
case DebugConfig.NET_MODE_DEV:
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_DEV);
break;
case DebugConfig.NET_MODE_QA:
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_QA);
break;
case DebugConfig.NET_MODE_DEMO:
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO);
break;
default:
clientConfig.setNetMode(MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE);
}
// 设置是否是第三APP登录
clientConfig.setThirdLogin(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE);
// 设置是否输出日志
clientConfig.setShowDebugLog(true);
// 设置是否是直播推流的主播
clientConfig.setAnchor(true);
// 设置从蘑菇AI开放平台获取的APPKey
switch (DebugConfig.getCarMachineType()) {
// 比亚迪
case DebugConfig.CAR_MACHINE_TYPE_BYD:
clientConfig.setThirdPartyAppKey("bydauto");
break;
// 衡阳-鹰眼项目
case DebugConfig.CAR_MACHINE_TYPE_LENOVO:
clientConfig.setThirdPartyAppKey("pfieouqg");
break;
// 自研车机
default:
clientConfig.setThirdPartyAppKey("wbvpzgar");
break;
}
// 设置应用服务AppId 长链、鉴权
if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE) {
clientConfig.setServiceAppId("com_mogo_launcher");
} else {
clientConfig.setServiceAppId("com.mogo.launcher");
}
// 设置AI云平台分配给三方应用的签名密钥需要从AI云平台申请
// 设置车机设备的唯一标识(这些表识必须是通过后台录入的设备)
clientConfig.setThirdPartyDeviceId(Utils.getDevicesId());
// 设置循环检测间隔时间每隔2小时loop一次httpDnsConfig
clientConfig.setLoopCheckDelay(60 * 60 * 2 * 1000);
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.setSecretKey("YMj2VFDFxJ3Q4gNoZceJ");
//连接ami
connectAmiIp();
// todo 使用旧链路
// clientConfig.setUseOriginSocket(true);
clientConfig.setIHttpDnsCurrentLocation(() -> {
MogoLocation mogoLocation = null;
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApp());
if (locationClient != null) {
mogoLocation = locationClient.getLastKnowLocation();
}
HttpDnsSimpleLocation httpDnsSimpleLocation;
if (mogoLocation != null
&& mogoLocation.getLatitude() != 0
&& mogoLocation.getLongitude() != 0) {
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
mogoLocation.getCityCode(),
mogoLocation.getLatitude(),
mogoLocation.getLongitude());
} else {
String ciyCode = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_CITY_CODE);
String latitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LATITUDE);
String longitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LONGITUDE);
try {
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
ciyCode,
Double.parseDouble(latitude),
Double.parseDouble(longitude));
} catch (NumberFormatException e) {
// e.printStackTrace();
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
}
//CallerLogger.INSTANCE.d(M_MAIN + TAG, "使用缓存GPS信息" + httpDnsSimpleLocation);
}
return httpDnsSimpleLocation;
});
// 初始化SDK可以设置状态回调来监听
MoGoAiCloudClient.getInstance().init(this, clientConfig).addTokenCallbacks(
new IMoGoTokenCallback() {
@Override
public void onTokenGot(String token, String sn) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "onTokenGot ");
clientConfig.setToken(token);
// 异步初始化NetConfig
asyncInit();
// HttpDns ttl回调 --- socketTTL
registerSocketHttpDnsTTL(HostConst.SOCKET_CENTER_DOMAIN);
// 开启每5s/次定位上报
uploadLocPerFiveSecond();
}
@Override
public void onError(int code, String msg) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "初始化MogoAiCloudSdk failed ,reason : " + msg + " , 未能开启长链服务和初始化Modules服务");
}
}
);
}
/**
* 连接ami
*/
private void connectAmiIp() {
String ipAddress = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().getBaseContext()).getString(MoGoConfig.OBU_IP, "192.168.1.199");
AmiClientManager.getInstance().setObuIp(ipAddress);
}
/**
* 上传自车位置信息到云端
*/
private void uploadLocPerFiveSecond() {
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
apis.getLocationInfoApi().start();
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApplicationContext());
if (locationClient != null) {
locationClient.addLocationListener(location -> {
apis.getLocationInfoApi().provideLocation(location);
});
}
}
}
private void startSocketService() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "startSocketService");
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
MogoLocation location = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getApp()).getLastKnowLocation();
// 关闭长链服务
apis.getSocketManagerApi(getApplicationContext()).destroy();
apis.getSocketManagerApi(this).registerLifecycleListener(10020, new IMogoLifecycleListener() {
@Override
public void onConnectFailure() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "socket-onConnectFailure");
DebugConfig.setDownloadSnapshot(false);
}
@Override
public void onConnectSuccess() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "socket-onConnectSuccess");
DebugConfig.setDownloadSnapshot(true);
}
@Override
public void onConnectLost() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "socket-onConnectLost");
DebugConfig.setDownloadSnapshot(false);
}
});
// 开启Socket长链服务
double lat = location.getLatitude();
double lon = location.getLongitude();
apis.getSocketManagerApi(getApplicationContext()).init(getApplicationContext(), DebugConfig.getSocketAppId(),lat,lon);
}
@Override
protected void socketTTL() {
// 鉴权成功后开启socket长链服务
startSocketService();
}
private void initModules() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "initModules");
//mogo deva tools
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_DEVA_TOOLS, "IMoGoDevaToolsProvider"));
// 初始化 bugly 升级
MogoModulePaths.addBaseModule(new MogoModule(UpgradeReportConstants.PATH, UpgradeReportConstants.NAME));
// 初始化 apm 日志采集
MogoModulePaths.addBaseModule(new MogoModule(CrashReportConstants.PATH, CrashReportConstants.NAME));
MogoModulePaths.addBaseModule(new MogoModule(MapApiPath.PATH, "CustomMapApiBuilder"));
MogoModulePaths.addBaseModule(new MogoModule(ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY));
// MogoModulePaths.addBaseModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME));
// 域控制器模块(新)
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AUTO_PILOT, "IMoGoAutoPilotProvider"));
// OBU 模块
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_V2X_OBU_MOGO, "IMoGoObuProvider"));
// 超视距,路测、行车记录仪监控
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_MONITORING, "IMoGoMonitoringProvider"));
// 云公告发布
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_AI_NOTICE, "IMoGoNoticeProvider"));
// 车聊聊IM
MogoModulePaths.addModuleFunctionServer(new MogoModule(ChatConsts.CHAT_PROVIDER_PATH, ChatConsts.CHAT_MODULE_NAME));
// 调度
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_AI_DISPATCH, "IDispatchProvider"));
// V2X 模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider"));
// 自动驾驶系统检测模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, "PUSH_UI"));
// 绑定车辆
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_BINDING_CAR, "IMoGoBindingcarProvider"));
// 司机身份专属模块
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// 地图数据收集模块
MogoModulePaths.addModuleFunctionServer(new MogoModule(MogoServicePaths.PATH_MAP_DATA_COLLECT_PROVIDER, "MoGoMapDataCollector"));
}
CallerLogger.INSTANCE.i(M_MAIN + TAG, "App launch timer cost " + (System.currentTimeMillis() - start) + "ms");
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
/*如果是主进程**/
if (ProcessUtils.isMainProcess(this)) {
AppLaunchTimeUtils.beginTimeCalculate(AppLaunchTimeUtils.COLD_START);
}
BoostMultiDex.install(base);
}
}

View File

@@ -0,0 +1,120 @@
package com.mogo.eagle.core.function.main;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.main.constants.MainConstants;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述
*/
public class MainPresenter extends Presenter< MainView > {
private Handler mMsgHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
switch ( msg.what ) {
case MainConstants.MSG_HIDE_MAP_COVER_FRAME:
mView.hideCoverUpLayout();
break;
case MainConstants.MSG_LOAD_MODULES:
mView.loadModules();
break;
}
}
};
public static final int MOGO_PERMISSION_REQUEST_CODE = 10000;
public MainPresenter( MainView view ) {
super( view );
SchemeIntent.getInstance().init( getContext(), mView.getApis() );
}
@Override
public void onCreate( @NonNull LifecycleOwner owner ) {
super.onCreate( owner );
}
public void checkPermission(Activity activity) {
boolean isAllGranted = checkPermissionAllGranted(
new String[]{
Manifest.permission.RECORD_AUDIO,
// Manifest.permission.CAMERA,
Manifest.permission.BLUETOOTH,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
Manifest.permission.ACCESS_FINE_LOCATION
}
);
if (isAllGranted) {
return;
}
/**
* 请求权限
*/
ActivityCompat.requestPermissions(
activity,
new String[]{
Manifest.permission.RECORD_AUDIO,
// Manifest.permission.CAMERA,前行
Manifest.permission.BLUETOOTH,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS,
Manifest.permission.ACCESS_FINE_LOCATION
}, MOGO_PERMISSION_REQUEST_CODE);
}
/**
* 检查是否拥有指定的所有权限
*/
private boolean checkPermissionAllGranted(String[] permissions) {
for (String permission : permissions) {
if (ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
// 只要有一个权限没有被授予, 则直接返回 false
return false;
}
}
return true;
}
/**
* 延时操作
*/
public void delayOperations() {
mMsgHandler.sendEmptyMessageDelayed( MainConstants.MSG_HIDE_MAP_COVER_FRAME, 150L );
}
public void postLoadModuleMsg() {
Message msg = Message.obtain();
msg.what = MainConstants.MSG_LOAD_MODULES;
mMsgHandler.sendMessageDelayed( msg, 500 );
}
public void handleSchemeIntent( Intent intent, boolean isOnNewIntent ) {
SchemeIntent.getInstance().handle( intent, isOnNewIntent );
}
public void initADAS(){
}
}

View File

@@ -0,0 +1,36 @@
package com.mogo.eagle.core.function.main;
import com.mogo.commons.mvp.IView;
import com.mogo.service.IMogoServiceApis;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 主页 view 接口
*/
public interface MainView extends IView {
/**
* 隐藏背景
*/
void hideCoverUpLayout();
/**
* 加载各模块中的Fragment
*/
void loadFunctionFragment();
/**
* 加载模块
*/
void loadModules();
/**
* 接口水龙头
*
* @return
*/
IMogoServiceApis getApis();
}

View File

@@ -0,0 +1,204 @@
package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.CommonUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-20
* <p>
* scheme 意图处理
* <p>
* 导航adb shell am start -d "mogo://launcher/main/switch2?type=navi'&'lon=116.327007'&'lat=39.977639"
*/
public class SchemeIntent implements IMogoStatusChangedListener {
private static final String TAG = "SchemeIntent";
public static final String TYPE_NAVI = "navi";
public static final String TYPE_SEARCH_ROAD_CONDITION = "search-road-condition";
public static final String TYPE_LAUNCH = "launch";
public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel";
public static final String TYPE_SHOW_SHARE_PANEL = "showSharePanel";
public static final String TYPE_SHOW_HISTORY_PANEL = "showHistoryPanel";
public static final String TYPE_SHOW_SURROUNDING_PANEL = "showSurroundingPanel";
private IMogoServiceApis mApis;
private Context mContext;
private IntentWrapper mNextIntent;
private static class IntentWrapper {
public Intent mIntent;
public long mDelay;
public IntentWrapper(Intent intent, long delay) {
this.mIntent = intent;
this.mDelay = delay;
}
}
private static volatile SchemeIntent sInstance;
private SchemeIntent() {
}
public static SchemeIntent getInstance() {
if (sInstance == null) {
synchronized (SchemeIntent.class) {
if (sInstance == null) {
sInstance = new SchemeIntent();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
public void init(Context context, IMogoServiceApis apis) {
mContext = context;
mApis = apis;
mApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
}
public void clear() {
mApis.getStatusManagerApi().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this);
mContext = null;
mApis = null;
}
/**
* 处理scheme
*
* @param intent 跳转的intent
* @param isOnNewIntent 根据这个参数判断是从onCreate过来还是从onNewIntent过来从而可以在{@link #isDelay(Intent, boolean)}里面确定延时逻辑如果是从onNewIntent过来是不需要延时的
*/
public void handle(Intent intent, boolean isOnNewIntent) {
if (intent == null || intent.getData() == null) {
return;
}
Uri target = intent.getData();
String path = target.getPath();
if (path == null || path.isEmpty()) {
return;
}
if (!mApis.getStatusManagerApi().isMainPageOnResume()) {
long delay = 0L;
if (isDelay(intent, isOnNewIntent)) {
delay = 5_000L;
}
mNextIntent = new IntentWrapper(intent, delay);
return;
}
switch (path) {
case "/main/switch2":
handleSwitch2Action(target);
break;
case "/main/share":
CallerLogger.INSTANCE.d(M_MAIN + TAG, "收到打开分享框的scheme准备打开分享框");
// Map<String, Object> properties = new HashMap<>();
// properties.put("from", "1");
// mApis.getAnalyticsApi().track("v2x_share_click", properties);
// mApis.getShareManager().showShareDialog();
break;
default:
break;
}
mNextIntent = null;
}
private boolean isDelay(Intent intent, boolean isOnNewIntent) {
if (isOnNewIntent || intent == null || intent.getData() == null) {
return false;
}
Uri target = intent.getData();
String type = target.getQueryParameter("type");
return TextUtils.equals(TYPE_NAVI, type) || TextUtils.equals(TYPE_SHOW_SHARE_PANEL, type);
}
private void handleSwitch2Action(Uri target) {
String type = target.getQueryParameter("type");
if (TextUtils.isEmpty(type)) {
return;
}
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + type);
switch (type) {
case TYPE_LAUNCH:
handleLaunchIntent(target);
break;
case TYPE_SHOW_HISTORY_PANEL:
handleShowEventPanel(0);
break;
case TYPE_SHOW_SURROUNDING_PANEL:
handleShowEventPanel(1);
break;
case TYPE_SHOW_SHARE_PANEL:
handleShowEventPanel(2);
break;
default:
break;
}
}
private void handleLaunchIntent(Uri uri) {
String type = uri.getQueryParameter("channelType");
Map<String, Object> properties = new HashMap<>();
properties.put("appname", CommonUtils.getAppName(mContext));
properties.put("appversion", CommonUtils.getVersionName(mContext));
properties.put("from", type);
mApis.getAnalyticsApi().track("appenterfront", properties);
}
/**
* 语音打开事件面板
*/
private void handleShowEventPanel(int item) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "语音打开事件面板" + item);
//mApis.getEventPanelManager().showPanelWithSelectedItem(item);
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) {
if (mNextIntent == null) {
return;
}
if (isTrue) {
// 保证回到桌面后在开始该规划路线。
UiThreadHandler.postDelayed(() -> {
if (mNextIntent == null) {
return;
}
handle(mNextIntent.mIntent, false);
}, mNextIntent.mDelay);
}
}
}
}

View File

@@ -0,0 +1,38 @@
package com.mogo.eagle.core.function.main.cards;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 卡片管理
*/
public interface MogoModulesHandler {
/**
* 加载模块
*/
void loadModules();
/**
* 架构升级v1.1加载功能模块
*/
void loadFunctionModules();
/**
* 架构升级v1.1加载功能模块
*/
void loadFunctionModulesServer();
/**
* 加载基本服务模块,需要不启动页面就能运行
* <p>
* 1. v2x
* 2. mogo-module-service
*/
void loadBaseModule();
/**
* 释放各个模块资源
*/
void onDestroy();
}

View File

@@ -0,0 +1,256 @@
package com.mogo.eagle.core.function.main.cards;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.app.Application;
import android.content.Context;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.main.MainActivity;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.service.module.IMogoModuleProvider;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author congtaowang
* @since 2019-12-24
* <p>
* 卡片加载
*/
public class MogoModulesManager implements MogoModulesHandler {
private static final String TAG = "MogoModulesManager";
private MainActivity mActivity;
private Application mApp;
private Map<MogoModule, IMogoModuleProvider> mModuleProviders = new HashMap<>();
// 空间换效率
private Map<String, IMogoModuleProvider> mModuleNameProviders = new HashMap<>();
// 架构升级后的加载功能模块的方式
private Map<MogoModule, IMoGoFunctionProvider> mModuleFunctionProviders = new HashMap<>();
private Map<String, IMoGoFunctionProvider> mModuleNameFunctionProviders = new HashMap<>();
// 架构升级后的加载功能模块的方式
private Map<MogoModule, IMoGoFunctionServerProvider> mModuleFunctionServerProviders = new HashMap<>();
private Map<String, IMoGoFunctionServerProvider> mModuleNameFunctionServerProviders = new HashMap<>();
private static volatile MogoModulesManager sInstance;
private MogoModulesManager() {
}
public static MogoModulesManager getInstance() {
if (sInstance == null) {
synchronized (MogoModulesManager.class) {
if (sInstance == null) {
sInstance = new MogoModulesManager();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
public void init(MainActivity activity) {
if (activity == null) {
throw new NullPointerException("activity can't be null.");
}
this.mActivity = activity;
mApp = mActivity.getApplication();
}
private Context getContext() {
return getApplicationContext();
}
private Context getApplicationContext() {
return mApp;
}
@Override
public void loadModules() {
final List<MogoModule> modules = MogoModulePaths.getModules();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "module.getPath():" + module.getPath() + " name: " + module.getName());
IMogoModuleProvider provider = load(module.getPath());
if (provider != null) {
mModuleProviders.put(module, provider);
mModuleNameProviders.put(module.getName(), provider);
}
}
}
}
@Override
public void loadFunctionModules() {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctions();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
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);
mModuleNameFunctionProviders.put(module.getName(), provider);
}
}
}
}
@Override
public void loadFunctionModulesServer() {
final List<MogoModule> modules = MogoModulePaths.getModuleFunctionServers();
if (modules != null && !modules.isEmpty()) {
for (MogoModule module : modules) {
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);
mModuleNameFunctionServerProviders.put(module.getName(), provider);
}
}
}
}
@Override
public void loadBaseModule() {
List<MogoModule> baseModules = MogoModulePaths.getBaseModules();
for (MogoModule baseModule : baseModules) {
if (baseModule == null) {
continue;
}
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块 : " + baseModule.getPath());
loadBaseProvider(baseModule.getPath());
}
}
private IProvider loadBaseProvider(String path) {
try {
return (IProvider) ARouter.getInstance().build(path).navigation(getContext());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private IMogoModuleProvider load(String path) {
try {
return (IMogoModuleProvider) ARouter.getInstance().build(path).navigation(getContext());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private IMoGoFunctionProvider loadFunction(String path) {
try {
return (IMoGoFunctionProvider) ARouter.getInstance().build(path).navigation(getContext());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private IMoGoFunctionServerProvider loadFunctionServer(String path) {
try {
return (IMoGoFunctionServerProvider) ARouter.getInstance().build(path).navigation(getContext());
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private void addFragment(IMogoModuleProvider provider, int containerId) {
if (provider == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause provider == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
Fragment fragment = null;
fragment = mActivity.getSupportFragmentManager().findFragmentByTag(provider.getModuleName());
if (fragment == null) {
fragment = provider.createFragment(getContext(), null);
}
if (fragment == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "add fragment fail cause fragment == null, container is " + ResourcesHelper.getResNameById(getApplicationContext(), containerId));
return;
}
mActivity.getSupportFragmentManager().beginTransaction()
.replace(containerId, fragment, provider.getModuleName())
.commitAllowingStateLoss();
}
@Override
public void onDestroy() {
if (mModuleNameProviders != null) {
Collection<IMogoModuleProvider> modules = mModuleNameProviders.values();
if (modules != null) {
for (IMogoModuleProvider module : modules) {
try {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getModuleName());
module.onDestroy();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
}
}
}
mModuleNameProviders.clear();
}
if (mModuleProviders != null) {
mModuleProviders.clear();
}
if (mModuleFunctionProviders != null) {
Collection<IMoGoFunctionProvider> modules = mModuleFunctionProviders.values();
if (modules != null) {
for (IMoGoFunctionProvider module : modules) {
try {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
module.onDestroy();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
}
}
}
mModuleNameFunctionProviders.clear();
}
if (mModuleFunctionProviders != null) {
mModuleFunctionProviders.clear();
}
if (mModuleFunctionServerProviders != null) {
Collection<IMoGoFunctionServerProvider> modules = mModuleFunctionServerProviders.values();
if (modules != null) {
for (IMoGoFunctionServerProvider module : modules) {
try {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "destroy module: " + module.getFunctionName());
module.onDestroy();
} catch (Exception e) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, e + " onDestroy");
}
}
}
mModuleNameFunctionProviders.clear();
}
if (mModuleFunctionServerProviders != null) {
mModuleFunctionServerProviders.clear();
}
mActivity = null;
}
}

View File

@@ -0,0 +1,20 @@
package com.mogo.eagle.core.function.main.constants;
/**
* @author congtaowang
* @since 2020-02-12
* <p>
* 描述
*/
public class MainConstants {
/**
* 消息:隐藏地图遮罩(避免地图加载白屏)
*/
public static final int MSG_HIDE_MAP_COVER_FRAME = 5004;
/**
* 加载模块
*/
public static final int MSG_LOAD_MODULES = 5005;
}

View File

@@ -0,0 +1,35 @@
package com.mogo.eagle.core.function.main.delaycheck;
import com.mogo.eagle.core.data.BaseData;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
/**
* 时延验证相关接口
*
* @author tongchenfei
*/
public interface DelayCheckApiServices {
/**
* 空接口
* @return 什么都不返回
*/
@GET("/yycp-test-service/net/delay/heartbeat")
Observable<BaseData> emptyInterface();
/**
* 时延上报接口 接口文档如下
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48967034
* @param params 相关参数,详见文档
* @return 相关返回值,详见文档
*/
@POST("/yycp-test-service/net/delay/log")
@Headers({"Content-type:application/json;charset=UTF-8"})
Observable<DelayCheckResponse> uploadDelayCheckData(@Body RequestBody params);
}

View File

@@ -0,0 +1,28 @@
package com.mogo.eagle.core.function.main.delaycheck;
import com.mogo.commons.debug.DebugConfig;
/**
* dzt base url
*
* @author tongchenfei
*/
public class DelayCheckHttpConstant {
public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com";
public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com";
public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com";
public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com";
public static String getBaseUrl(){
switch ( DebugConfig.getNetMode() ) {
case DebugConfig.NET_MODE_DEV:
return HOST_DEV;
case DebugConfig.NET_MODE_QA:
return HOST_TEST;
case DebugConfig.NET_MODE_DEMO:
return HOST_DEMO;
default:
return HOST_PRODUCT;
}
}
}

View File

@@ -0,0 +1,29 @@
package com.mogo.eagle.core.function.main.delaycheck;
import com.mogo.eagle.core.data.BaseData;
/**
* 延迟检测response
*
* @author tongchenfei
*/
public class DelayCheckResponse extends BaseData {
private DelayCheckResult result;
public DelayCheckResult getResult() {
return result;
}
public void setResult(DelayCheckResult result) {
this.result = result;
}
@Override
public String toString() {
return "DelayCheckResponse{" +
"result=" + result +
", code=" + code +
", msg='" + msg + '\'' +
'}';
}
}

View File

@@ -0,0 +1,41 @@
package com.mogo.eagle.core.function.main.delaycheck;
/**
* 延迟检查返回结果
*
* @author tongchenfei
*/
public class DelayCheckResult {
/**
* 是否保持心跳
*/
private boolean necessary;
/**
* 心跳间隔,单位 s
*/
private int beatSeconds;
public boolean isNecessary() {
return necessary;
}
public void setNecessary(boolean necessary) {
this.necessary = necessary;
}
public int getBeatSeconds() {
return beatSeconds;
}
public void setBeatSeconds(int beatSeconds) {
this.beatSeconds = beatSeconds;
}
@Override
public String toString() {
return "DelayCheckResult{" +
"necessary=" + necessary +
", beatSeconds=" + beatSeconds +
'}';
}
}

View File

@@ -0,0 +1,111 @@
package com.mogo.eagle.core.function.main.delaycheck;
/**
* 时延检测上报请求参数
*
* @author tongchenfei
*/
public class DelayCheckUploadRequest {
private String sn;
private long startTime;
private long endTime;
/**
* 请求时长
*/
private long burning;
/**
* 信号强度
*/
private int netState;
private String place;
private String cityCode;
private double lat;
private double lon;
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public long getStartTime() {
return startTime;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public long getEndTime() {
return endTime;
}
public void setEndTime(long endTime) {
this.endTime = endTime;
}
public long getBurning() {
return burning;
}
public void setBurning(long burning) {
this.burning = burning;
}
public int getNetState() {
return netState;
}
public void setNetState(int netState) {
this.netState = netState;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
@Override
public String toString() {
return "DelayCheckUploadRequest{" +
"sn='" + sn + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", burning=" + burning +
", netState=" + netState +
", place='" + place + '\'' +
", cityCode='" + cityCode + '\'' +
", lat=" + lat +
", lon=" + lon +
'}';
}
}

View File

@@ -0,0 +1,155 @@
package com.mogo.eagle.core.function.main.delaycheck;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.map.location.IMogoLocationClient;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
* 延时验证工具类
*
* @author tongchenfei
*/
public class DelayCheckUtil implements Handler.Callback {
private final Handler handler = new Handler(this);
private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001;
/**
* 首次延时检测时间间隔暂定10分钟等待机器稳定后再做打算
*/
private static final long FIRST_CHECK_NET_CONNECT_STATUS_DELAY = 10 * 60 * 1000;
private static final long CHECK_NET_CONNECT_STATUS_DELAY = 5000L;
private static final int MSG_START_DELAY_CHECK = 1002;
/**
* 默认检测时间间隔,若服务端正确返回,以服务端返回为主
*/
private static final long DELAY_CHECK_DELAY = 10 * 60 * 1000;
private final Context context;
public DelayCheckUtil(Context context) {
this.context = context;
}
/**
* 每5s检查一下网络状态网络状态为连接状态时开始空接口请求以及后续的参数上报
*/
public void waitingForCheck() {
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY);
}
private long requestTime, netDelay, requestStartSystemTime, requestEndSystem;
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case MSG_CHECK_NET_CONNECT_STATUS:
if (NetworkUtils.isConnected(context)) {
handler.sendEmptyMessage(MSG_START_DELAY_CHECK);
} else {
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
}
return true;
case MSG_START_DELAY_CHECK:
// 请求空接口
startEmptyRequest();
return true;
default:
return false;
}
}
private void startEmptyRequest() {
requestTime = SystemClock.elapsedRealtime();
requestStartSystemTime = System.currentTimeMillis();
MoGoRetrofitFactory.getInstance(DelayCheckHttpConstant.getBaseUrl()).create(DelayCheckApiServices.class)
.emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(context)) {
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
requestEndSystem = System.currentTimeMillis();
netDelay = SystemClock.elapsedRealtime() - requestTime;
startUpload();
}
@Override
public void onError(Throwable e) {
super.onError(e);
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
}
});
}
private void startUpload() {
IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
MogoLocation lastLocation = null;
if (locationClient != null) {
lastLocation = locationClient.getLastKnowLocation();
}
if (lastLocation == null) {
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY);
return;
}
DelayCheckUploadRequest request = new DelayCheckUploadRequest();
request.setSn(MoGoAiCloudClientConfig.getInstance().getSn());
request.setStartTime(requestStartSystemTime);
request.setEndTime(requestEndSystem);
request.setNetState(NetworkUtils.netStrengthLevel);
request.setPlace(lastLocation.getAddress());
request.setCityCode(lastLocation.getCityCode());
request.setLat(lastLocation.getLatitude());
request.setLon(lastLocation.getLongitude());
request.setBurning(netDelay);
RequestBody params = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(request));
MoGoRetrofitFactory.getInstance(DelayCheckHttpConstant.getBaseUrl()).create(DelayCheckApiServices.class)
.uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io())
.subscribe(new SubscribeImpl<DelayCheckResponse>(RequestOptions.create(context)) {
@Override
public void onSuccess(DelayCheckResponse o) {
super.onSuccess(o);
DelayCheckResult result = o.getResult();
if (result.isNecessary()) {
handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000L);
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
}
@Override
public void onError(Throwable e) {
super.onError(e);
handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY);
}
});
}
}

View File

@@ -0,0 +1,70 @@
package com.mogo.eagle.core.function.main.monitoring;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
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.check.CallerCheckManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* @author liujing
* @description 车辆监控
* @since: 8/16/21
*/
public class VehicleMonitoring implements Handler.Callback {
private static final String TAG = "VehicleMonitoring";
private final Context mContext;
private final Handler mHandler = new Handler(this);
//自动驾驶状态下**分钟间隔弹框提示一次 后期根据需求做修改,暂定30秒自检一次
private static final long AUTO_CHECK_STATUS_DELAY = 30 * 1000;
//非自动驾驶测试数据 后期根据需求做修改
private static final long MANUAL_CHECK_STATUS_DELAY = 30 * 1000;
//自动驾驶状态
private static int AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
public VehicleMonitoring(Context context) {
mContext = context;
}
public void vehicleCheck() {
if (AutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "自动驾驶中...");
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
} else {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "非自动驾驶状态");
//非自动驾驶状态只展示一次
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
}
}
@Override
public boolean handleMessage(Message msg) {
AutopilotStatus = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState();
switch (msg.what) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
vehicleMonitor();
mHandler.sendEmptyMessageDelayed(AutopilotStatus, AUTO_CHECK_STATUS_DELAY);
return true;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
vehicleMonitor();
mHandler.sendEmptyMessageDelayed(AutopilotStatus, MANUAL_CHECK_STATUS_DELAY);
return true;
default:
}
return false;
}
public void vehicleMonitor() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "vehicleMonitor");
CallerCheckManager.checkMonitor(mContext);
}
}

View File

@@ -0,0 +1,120 @@
package com.mogo.eagle.core.function.main.registercenter;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoRegisterCenter;
import java.util.Iterator;
/**
* @author congtaowang
* @since 2020-01-09
* <p>
* 描述
*/
@Route(path = MogoServicePaths.PATH_REGISTER_CENTER)
public class MogoRegisterCenter implements IMogoRegisterCenter {
@Override
public void registerMogoModuleLifecycle(String moduleName, IMogoModuleLifecycle lifecycle) {
MogoRegisterCenterHandler.getInstance().registerMogoModuleLifecycle(moduleName, lifecycle);
}
@Override
public void unregisterMogoModuleLifecycle(String moduleName) {
MogoRegisterCenterHandler.getInstance().unregisterMogoModuleLifecycle(moduleName);
}
@Override
public void registerMogoMapListener(String moduleName, IMogoMapListener listener) {
MogoRegisterCenterHandler.getInstance().registerMogoMapListener(moduleName, listener);
}
@Override
public void unregisterMogoMapListener(String moduleName) {
MogoRegisterCenterHandler.getInstance().unregisterMogoMapListener(moduleName);
}
@Override
public void registerMogoNaviListener(String moduleName, IMogoNaviListener listener) {
MogoRegisterCenterHandler.getInstance().registerMogoNaviListener(moduleName, listener);
}
@Override
public void unregisterMogoNaviListener(String moduleName) {
MogoRegisterCenterHandler.getInstance().unregisterMogoNaviListener(moduleName);
}
@Override
public void registerMogoLocationListener(String moduleName, IMogoLocationListener listener) {
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener(moduleName, listener);
}
@Override
public Iterator<IMogoLocationListener> getLocationListeners() {
return MogoRegisterCenterHandler.getInstance().getLocationListeners();
}
@Override
public void unregisterMogoLocationListener(String moduleName) {
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener(moduleName);
}
@Override
public void registerMogoMarkerClickListener(String moduleName, IMogoMarkerClickListener listener) {
MogoRegisterCenterHandler.getInstance().registerMogoMarkerClickListener(moduleName, listener);
}
@Override
public void unregisterMogoMarkerClickListener(String moduleName) {
MogoRegisterCenterHandler.getInstance().unregisterMogoMarkerClickListener(moduleName);
}
@Override
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
MogoRegisterCenterHandler.getInstance().registerMogoStaticMarkerClickListener(tag, listener);
}
@Override
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener ) {
MogoRegisterCenterHandler.getInstance().unregisterMogoStaticMarkerClickListener(tag, listener);
}
@Override
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
MogoRegisterCenterHandler.getInstance().registerCarLocationChangedListener(tag, listener);
}
@Override
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener(tag, listener);
}
@Override
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
MogoRegisterCenterHandler.getInstance().registerADASControlStatusChangedListener(tag, listener);
}
@Override
public void unregisterADASControlStatusChangedListener(String tag) {
MogoRegisterCenterHandler.getInstance().unregisterADASControlStatusChangedListener(tag);
}
@Override
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
return MogoRegisterCenterHandler.getInstance().getAdasControlStatusChangedListeners();
}
@Override
public void init(Context context) {
}
}

View File

@@ -0,0 +1,182 @@
package com.mogo.eagle.core.function.main.registercenter;
import android.content.Context;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoRegisterCenter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author congtaowang
* @since 2020-01-09
* <p>
* 描述
*/
public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
private static volatile MogoRegisterCenterHandler sInstance;
private final Map<String, IMogoModuleLifecycle> mLifecycle = new HashMap<>();
private final Map<String, IMogoMapListener> mMap = new HashMap<>();
private final Map<String, IMogoNaviListener> mNavi = new ConcurrentHashMap<>();
private final Map<String, IMogoLocationListener> mLocation = new HashMap<>();
private final Map<String, IMogoMarkerClickListener> mMarker = new HashMap<>();
private final Map<String, ArrayList<IMogoMarkerClickListener>> mStaticMarker = new HashMap<>();
private final Map<String, IMogoCarLocationChangedListener> mCarLocations = new ConcurrentHashMap<>();
private final Map<String, IMogoADASControlStatusChangedListener> mADAS = new HashMap<>();
private MogoRegisterCenterHandler() {
}
public static MogoRegisterCenterHandler getInstance() {
if (sInstance == null) {
synchronized (MogoRegisterCenterHandler.class) {
if (sInstance == null) {
sInstance = new MogoRegisterCenterHandler();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public void registerMogoModuleLifecycle(String tag, IMogoModuleLifecycle lifecycle) {
mLifecycle.put(tag, lifecycle);
}
@Override
public void unregisterMogoModuleLifecycle(String tag) {
mLifecycle.remove(tag);
}
@Override
public void registerMogoMapListener(String tag, IMogoMapListener listener) {
mMap.put(tag, listener);
}
@Override
public void unregisterMogoMapListener(String tag) {
mMap.remove(tag);
}
@Override
public void registerMogoNaviListener(String tag, IMogoNaviListener listener) {
mNavi.put(tag, listener);
}
@Override
public void unregisterMogoNaviListener(String tag) {
mNavi.remove(tag);
}
@Override
public void registerMogoLocationListener(String tag, IMogoLocationListener listener) {
mLocation.put(tag, listener);
}
@Override
public void unregisterMogoLocationListener(String tag) {
mLocation.remove(tag);
}
@Override
public void registerMogoMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
mMarker.put(tag, listener);
}
@Override
public void unregisterMogoMarkerClickListener(String tag) {
mMarker.remove(tag);
}
@Override
public void registerMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
if (list == null) {
list = new ArrayList<>();
list.add(listener);
mStaticMarker.put(tag, list);
}
list.add(listener);
mStaticMarker.put(tag, list);
}
@Override
public void unregisterMogoStaticMarkerClickListener(String tag, IMogoMarkerClickListener listener) {
ArrayList<IMogoMarkerClickListener> list = mStaticMarker.get(tag);
if (list == null) {
return;
}
list.remove(listener);
}
@Override
public void registerCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
mCarLocations.put(tag, listener);
}
@Override
public void unregisterCarLocationChangedListener(String tag, IMogoCarLocationChangedListener listener) {
mCarLocations.remove(tag);
}
@Override
public void registerADASControlStatusChangedListener(String tag, IMogoADASControlStatusChangedListener listener) {
mADAS.put(tag, listener);
}
@Override
public void unregisterADASControlStatusChangedListener(String tag) {
mADAS.remove(tag);
}
@Override
public void init(Context context) {
}
public IMogoMarkerClickListener getMarkerListener(String tag) {
return mMarker.get(tag);
}
public ArrayList<IMogoMarkerClickListener> getStaticMarkerListener(String tag){
return mStaticMarker.get(tag);
}
public Iterator<IMogoMapListener> getMapListeners() {
return mMap.values().iterator();
}
public Iterator<IMogoNaviListener> getNaviListeners() {
return mNavi.values().iterator();
}
@Override
public Iterator<IMogoLocationListener> getLocationListeners() {
return mLocation.values().iterator();
}
public Iterator<IMogoCarLocationChangedListener> getCarLocationChangedListener() {
return mCarLocations.values().iterator();
}
@Override
public Iterator<IMogoADASControlStatusChangedListener> getAdasControlStatusChangedListeners() {
return mADAS.values().iterator();
}
}

View File

@@ -0,0 +1,115 @@
package com.mogo.eagle.core.function.main.service;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.annotation.Nullable;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.main.EventDispatchCenter;
import com.mogo.eagle.core.function.main.cards.MogoModulesManager;
import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil;
import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
public
/**
* @author congtaowang
* @since 2020/6/10
*
* 描述
*/
@Route(path = "/service/base/info")
class MogoMainService extends Service implements IMogoLocationListener {
private static final String TAG = "MogoMainService";
private IMogoServiceApis mServiceApis;
/**
* 主模块管控定位,可以向各个模块发送统一定位信息
*/
private IMogoLocationClient mLocationClient;
@Override
public void onCreate() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "基本服务启动");
mServiceApis = MogoApisHandler.getInstance().getApis();
initAndStartLocation();
UiThreadHandler.postDelayed(() -> {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "5秒已过启动基础服务……");
loadBaseModules();
initGpsSimulatorListener();
HdMapBuildConfig.isMapLoaded = true;
}, 5_000L
);
// 开启延时检测
DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this);
delayCheckUtil.waitingForCheck();
// 车辆检测
VehicleMonitoring monitoring = new VehicleMonitoring(this);
monitoring.vehicleCheck();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
return START_STICKY;
}
private void initAndStartLocation() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "开始定位");
mLocationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp());
if (mLocationClient != null) {
mLocationClient.addLocationListener(this);
mLocationClient.start(2_000L);
}
}
/**
* 初始化自车定位监听
*/
private void initGpsSimulatorListener() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "注册自车位置监听");
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener(EventDispatchCenter.getInstance());
}
private void loadBaseModules() {
CallerLogger.INSTANCE.d(M_MAIN + TAG, "加载基本模块");
MogoModulesManager.getInstance().loadBaseModule();
}
@Override
public void onLocationChanged(MogoLocation location) {
EventDispatchCenter.getInstance().onLocationChanged(location);
}
@Override
public void onDestroy() {
super.onDestroy();
if (mLocationClient != null) {
mLocationClient.removeLocationListener(this);
mLocationClient.stop();
mLocationClient.destroy();
mLocationClient = null;
}
mServiceApis = null;
}
}

View File

@@ -0,0 +1,55 @@
package com.mogo.eagle.core.function.main.utils;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.View;
import com.mogo.eagle.core.function.hmi.R;
/**
* created by wujifei on 2021/3/30 14:05
* describe:
*/
public class DisplayEffectsHelper {
private volatile static DisplayEffectsHelper instance = null;
private AnimatorSet animatorSet;
public static DisplayEffectsHelper getInstance() {
if (instance == null) {
synchronized (DisplayEffectsHelper.class) {
if (instance == null) {
instance = new DisplayEffectsHelper();
}
}
}
return instance;
}
public void init(View rootView) {
View view1 = rootView.findViewById(R.id.iv_wu1);
View view2 = rootView.findViewById(R.id.iv_wu2);
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view1, "alpha", 0f, 1f, 0f);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view1, "translationX", -500, 100f, 300f);
ObjectAnimator animator3 = ObjectAnimator.ofFloat(view1, "scaleX", 1f, 1.5f, 2f);
ObjectAnimator animator4 = ObjectAnimator.ofFloat(view1, "scaleY", 1f, 1.5f, 2f);
ObjectAnimator animator5 = ObjectAnimator.ofFloat(view2, "alpha", 0f, 1f, 0f);
ObjectAnimator animator6 = ObjectAnimator.ofFloat(view2, "translationX", 500, -100f, -300f);
ObjectAnimator animator7 = ObjectAnimator.ofFloat(view2, "scaleX", 1f, 1.5f, 2f);
ObjectAnimator animator8 = ObjectAnimator.ofFloat(view2, "scaleY", 1f, 1.5f, 2f);
animatorSet = new AnimatorSet();
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5, animator6, animator7, animator8);
animatorSet.setDuration(5000);
}
public void display() {
animatorSet.start();
}
private float dp2px(float dp) {
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
return dp * metrics.density;
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.eagle.core.function.main.utils;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.v2x.DisplayEffectsInterface;
/**
* created by wujifei on 2021/3/30 15:45
* describe:
*/
@Route(path = MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER)
public class DisplayEffectsManager implements DisplayEffectsInterface {
private Context context;
@Override
public void init(Context context) {
this.context = context;
}
@Override
public void displayEffects(String type) {
DisplayEffectsHelper.getInstance().display();
}
}

View File

@@ -0,0 +1,137 @@
package com.mogo.eagle.core.function.main.windowview;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
public class DispatchTouchEventWrapper {
private IWindowViewHandler mWindowViewHandler;
int mActionDownX = -1;
int mActionDownY = -1;
/**
* Flag whether move after touch down.
*/
boolean mMoveFlag = false;
private static volatile DispatchTouchEventWrapper INST;
private DispatchTouchEventWrapper() {
}
public static DispatchTouchEventWrapper getInstance() {
if ( INST == null ) {
synchronized ( DispatchTouchEventWrapper.class ) {
if ( INST == null ) {
INST = new DispatchTouchEventWrapper();
}
}
}
return INST;
}
public DispatchTouchEventWrapper attach( View windowView, WindowManager.LayoutParams params ) {
if ( mWindowViewHandler == null || mWindowViewHandler.getWindowView() != windowView ) {
mWindowViewHandler = new IWindowViewHandler.DefaultHandler( windowView, params );
}
return this;
}
public boolean handle( MotionEvent event ) {
switch ( event.getAction() & MotionEvent.ACTION_MASK ) {
case MotionEvent.ACTION_DOWN:
if ( onActionDown( event ) ) {
return true;
}
break;
case MotionEvent.ACTION_MOVE:
if ( onActionMove( event ) ) {
return true;
}
break;
case MotionEvent.ACTION_UP:
if ( onActionUp( event ) ) {
return true;
}
break;
}
return false;
}
private boolean onActionDown( MotionEvent event ) {
mActionDownX = ( ( int ) event.getRawX() );
mActionDownY = ( ( int ) event.getRawY() );
if ( mWindowViewHandler != null ) {
mWindowViewHandler.recordNewPosition();
return true;
}
return false;
}
private boolean onActionMove( MotionEvent event ) {
if ( Math.abs( event.getRawX() - mActionDownX ) >= 20
|| Math.abs( event.getRawY() - mActionDownY ) >= 20 ) {
mMoveFlag = false;
}
if ( isLastDownValueLegal() ) {
moveWindowView( event );
return true;
}
return false;
}
private boolean onActionUp( MotionEvent event ) {
if ( isClickEventLike() ) {
if ( mWindowViewHandler != null ) {
mWindowViewHandler.performClickLike();
}
} else {
if ( mWindowViewHandler != null ) {
mWindowViewHandler.moveToEdge();
mWindowViewHandler.recordNewPosition();
}
}
mMoveFlag = false;
clearLastDownAxisValue();
return true;
}
private void clearLastDownAxisValue() {
mActionDownX = mActionDownY = -1;
}
private boolean isLastDownValueLegal() {
return mActionDownX != -1 && mActionDownY != -1;
}
private void moveWindowView( MotionEvent event ) {
if ( mWindowViewHandler != null ) {
mWindowViewHandler.move( event, mActionDownX, mActionDownY );
}
}
/**
* Simulate click event just like set {@link View.OnClickListener}
*
* @return
*/
private boolean isClickEventLike() {
System.out.println( mMoveFlag );
return isLastDownValueLegal() && !mMoveFlag;
}
public void release() {
if ( mWindowViewHandler != null ) {
mWindowViewHandler.release();
}
mWindowViewHandler = null;
mActionDownX = -1;
mActionDownY = -1;
mMoveFlag = false;
INST = null;
}
}

View File

@@ -0,0 +1,218 @@
package com.mogo.eagle.core.function.main.windowview;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAIN;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* @author congtaowang
* @since 2020-01-06
* <p>
* 描述
*/
public class FloatingViewHandler {
private static final String TAG = "FloatingViewHandler";
/**
* 上次显示的优先级
*/
private static int sPriority = Integer.MIN_VALUE;
/**
* 上次添加的view
*/
private static View sView = null;
private static int sX, sY;
private static FrameLayout.LayoutParams sParams;
/**
* 是否可手指拖动
*/
private static boolean sMovable = false;
private static FrameLayout sFloatingLayout = null;
public static void init(FrameLayout frameLayout) {
sFloatingLayout = frameLayout;
}
public static void clear() {
sFloatingLayout = null;
}
/**
* 添加任意view到布局不考虑优先级
*
* @param view
* @param x
* @param y
* @param movable
*/
public static void addView(View view, int x, int y, boolean movable) {
if (view == null) {
return;
}
if (sFloatingLayout == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
return;
}
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = x;
params.topMargin = y;
sFloatingLayout.addView(view, params);
}
/**
* 添加view到布局优先级大的展示
*
* @param view
* @param params
* @param movable
*/
public static void addView(View view, FrameLayout.LayoutParams params, boolean movable) {
if (view == null) {
return;
}
if (sFloatingLayout == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
return;
}
sFloatingLayout.addView(view, params);
}
/**
* 添加view到布局优先级大的展示
*
* @param view
* @param priority
* @param x
* @param y
* @param movable
*/
public static void addView(View view, int priority, int x, int y, boolean movable) {
if (view == null) {
return;
}
if (sFloatingLayout == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
return;
}
if (sView == view) {
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
return;
}
if (sView != null) {
if (priority < sPriority) {
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
return;
}
sFloatingLayout.removeView(sView);
}
sView = view;
sMovable = movable;
sPriority = priority;
sX = x;
sY = y;
addView();
}
/**
* 添加view到布局优先级大的展示
*
* @param view
* @param priority
* @param params
* @param movable
*/
public static void addView(View view, int priority, FrameLayout.LayoutParams params, boolean movable) {
if (view == null) {
return;
}
if (sFloatingLayout == null) {
CallerLogger.INSTANCE.e(M_MAIN + TAG, "no floating frame. ");
return;
}
if (sView == view) {
CallerLogger.INSTANCE.w(M_MAIN + TAG, "改布局已添加且没有移除,不操作");
return;
}
if (sView != null) {
if (priority < sPriority) {
CallerLogger.INSTANCE.w(M_MAIN + TAG, "过滤低优先级布局");
return;
}
sFloatingLayout.removeView(sView);
}
sView = view;
sMovable = movable;
sPriority = priority;
sParams = params;
addView();
}
public static void removeView(View view) {
if (sFloatingLayout == null) {
return;
}
if (view == null) {
return;
}
sFloatingLayout.removeView(view);
if (sView == view) {
sView = null;
sPriority = Integer.MIN_VALUE;
sMovable = false;
sParams = null;
}
}
private static void addView() {
if (sView == null) {
return;
}
FrameLayout.LayoutParams params = sParams;
if (params == null) {
params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = sX;
params.topMargin = sY;
}
sFloatingLayout.addView(sView, params);
}
public static void attachMovementEvent(View view, WindowManager.LayoutParams params) {
if (view == null) {
return;
}
view.setOnTouchListener((v, event) -> {
DispatchTouchEventWrapper.getInstance()
.attach(view, params)
.handle(event);
return false;
});
}
public static void setVisible(boolean visible) {
if (sFloatingLayout != null) {
sFloatingLayout.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
}
}

View File

@@ -0,0 +1,107 @@
package com.mogo.eagle.core.function.main.windowview;
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.WindowUtils;
/**
* Created by congtaowang on 2017/6/20.
*/
public interface IWindowViewHandler {
View getWindowView();
void recordNewPosition();
void move( MotionEvent event, int downX, int downY );
void release();
void moveToEdge();
void performClickLike();
class DefaultHandler implements IWindowViewHandler {
protected View mWindowView;
protected int mWindowViewLeft = -1;
protected int mWindowViewTop = -1;
private WindowManager.LayoutParams mParams;
public DefaultHandler( View windowView, WindowManager.LayoutParams params ) {
this.mWindowView = windowView;
mParams = params;
}
@Override
public View getWindowView() {
return mWindowView;
}
@Override
public void recordNewPosition() {
mWindowViewLeft = mParams.x;
mWindowViewTop = mParams.y;
}
@Override
public void move( MotionEvent event, int downX, int downY ) {
move( ( ( int ) ( event.getRawX() - downX ) ),
( ( int ) ( event.getRawY() - downY ) ) );
}
private void move( int distanceX, int distanceY ) {
if ( mWindowView == null ) {
return;
}
mParams.x = mWindowViewLeft + distanceX;
mParams.y = mWindowViewTop + distanceY;
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
if ( wm == null ) {
return;
}
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
}
@Override
public void moveToEdge() {
if ( mWindowView == null ) {
return;
}
WindowManager wm = ( ( WindowManager ) mWindowView.getContext().getSystemService( Context.WINDOW_SERVICE ) );
if ( mParams.x > WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) / 2 ) {
mParams.x = WindowUtils.getScreenWidth( AbsMogoApplication.getApp() ) - mWindowView.getMeasuredWidth();
} else {
mParams.x = 0;
}
wm.updateViewLayout( mWindowView, alignLayoutParamsBoundary( mParams ) );
}
protected WindowManager.LayoutParams alignLayoutParamsBoundary( WindowManager.LayoutParams params ) {
return params;
}
@Override
public void performClickLike() {
}
@Override
public void release() {
mWindowView = null;
mWindowViewLeft = -1;
mWindowViewTop = -1;
}
}
}

View File

@@ -0,0 +1,64 @@
package com.mogo.eagle.core.function.main.windowview;
import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.windowview.IMogoWindowManager;
/**
* @author congtaowang
* @since 2020-01-06
* <p>
* 根据优先级控制显示 window view.
*/
@Route( path = MogoServicePaths.PATH_WINDOW_MANAGER )
public class MogoWindowManager implements IMogoWindowManager {
@Override
public void addView( View view, int x, int y, boolean movable ) {
FloatingViewHandler.addView( view, x, y, movable );
}
@Override
public void addView( View view, FrameLayout.LayoutParams params, boolean movable ) {
FloatingViewHandler.addView( view, params, movable );
}
@Override
public void addView( int priority, View view, int x, int y, boolean movable ) {
FloatingViewHandler.addView( view, priority, x, y, movable );
}
@Override
public void addView( int priority, View view, FrameLayout.LayoutParams params, boolean movable ) {
FloatingViewHandler.addView( view, priority, params, movable );
}
@Override
public void removeView( View view ) {
FloatingViewHandler.removeView( view );
}
@Override
public void hideAll() {
FloatingViewHandler.setVisible( false );
}
@Override
public void showAll() {
FloatingViewHandler.setVisible( true );
}
@Override
public void init( Context context ) {
}
@Override
public void addTopView(View view) {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#00F03232"
android:startColor="#66FF0808"
android:type="linear"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:endColor="#00F03232"
android:startColor="#66FF0808"
android:type="linear"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="180"
android:endColor="#00F03232"
android:startColor="#66FF0808"
android:type="linear"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="#00FF0606"
android:startColor="#66FF0808"
android:type="linear"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--黑色矩形 作为背景色-->
<item>
<shape>
<gradient
android:angle="270"
android:centerX="0.6"
android:endColor="#0B0F17"
android:startColor="#171D2B"
android:type="linear" />
</shape>
</item>
<!--单独的slogan图片 并且设置下间距-->
<!--如果使用svg可以直接 drawable-->
<item>
<bitmap
android:gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/mogo_slogan"
android:tileMode="disabled" />
</item>
</layer-list>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--单独的slogan图片 并且设置下间距-->
<!--如果使用svg可以直接 drawable-->
<item>
<bitmap
android:gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/mogo_slogan"
android:tileMode="disabled" />
</item>
</layer-list>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:centerX="0.6"
android:endColor="#0B0F17"
android:startColor="#171D2B"
android:type="linear" />
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:angle="0" android:centerX="0.6" android:centerColor="#7f000000" android:endColor="#00000000" android:startColor="#000000" android:type="linear" />
</shape>
</item>
</selector>

View File

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

View File

@@ -0,0 +1,116 @@
<?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" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:paddingTop="25dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_special_effect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
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>
<!--预警视图 OBU、云端下发、自车感知、自车策略-->
<FrameLayout
android:id="@+id/module_main_id_waring_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 快捷操作浮层 -->
<FrameLayout
android:id="@+id/module_main_id_entrance_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft"
android:paddingLeft="@dimen/module_main_apps_fragment_container_padding"
android:paddingTop="@dimen/module_main_apps_fragment_container_paddingTop"
android:paddingRight="@dimen/module_main_apps_fragment_container_padding"
android:paddingBottom="@dimen/module_main_apps_fragment_container_paddingTop" />
<!-- 浮层-->
<FrameLayout
android:id="@+id/module_main_id_floating_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 目的地车友 -->
<FrameLayout
android:id="@+id/module_main_id_message_history_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft" />
<!--搜索视图-->
<FrameLayout
android:id="@+id/module_main_id_search_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--网约车视图-->
<FrameLayout
android:id="@+id/module_main_id_och_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--小地图视图-->
<FrameLayout
android:id="@+id/module_main_id_smp_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--冷启动过渡Logo-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_main_id_cover_up"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main_splash_bg">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/main_bitmap_splash_icon"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.47" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</FrameLayout>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
<!-- module_main_activity_main.xml-->
<dimen name="module_main_map_left_shadow_frame_width">350px</dimen>
<dimen name="module_main_card_container_marginTop">10px</dimen>
<dimen name="module_main_card_container_width">660px</dimen>
<dimen name="module_main_card_container_height">690px</dimen>
<dimen name="module_main_card_container_marginLeft">60px</dimen>
<dimen name="module_main_card_container_marginBottom">211px</dimen>
<dimen name="module_main_card_container_paddingBottom">30px</dimen>
<dimen name="module_main_card_card_shadow_width_div">30px</dimen>
<dimen name="module_main_card_card_shadow_height_div">15px</dimen>
<dimen name="module_main_top_shadow_height">270px</dimen>
<dimen name="module_main_card_cover_up_margin">660px</dimen>
<dimen name="cards_container_dp_600">600px</dimen>
<dimen name="cards_container_shadow_dp_margin_top">599px</dimen>
<dimen name="module_main_apps_fragment_container_width">200px</dimen>
<dimen name="module_main_apps_fragment_container_padding">20px</dimen>
<dimen name="module_main_header_fragment_container_marginTop">30px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">830px</dimen>
<dimen name="module_main_id_entrance_fragment_container_marginLeft">590px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_padding">30px</dimen>
<dimen name="module_main_entrance_fragment_container_padding_top">70px</dimen>
<dimen name="module_main_id_left_panel_fragment_container_width">635px</dimen>
<dimen name="module_main_entrance_fragment_container_width">1263px</dimen>
<dimen name="module_event_fragment_container_padding">20px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">20px</dimen>
<dimen name="module_main_apps_fragment_container_paddingBottom">20px</dimen>
<dimen name="module_ext_top_view_max_width">1920px</dimen>
<dimen name="module_main_panel_margin_right">0px</dimen>
</resources>

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_main_window_background_color">#212831</color>
<color name="notice_blue">#2B6EFF</color>
<color name="notice_text_blue">#1F9BFE</color>
<color name="notice_banner_blue">#5A8EFD</color>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >0px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
<!-- module_main_activity_main.xml-->
<dimen name="module_main_map_left_shadow_frame_width">350px</dimen>
<dimen name="module_main_card_container_marginTop">8px</dimen>
<dimen name="module_main_card_container_width">352px</dimen>
<dimen name="module_main_card_container_height">370px</dimen>
<dimen name="module_main_card_container_marginLeft">32px</dimen>
<dimen name="module_main_card_container_marginBottom">140.5px</dimen>
<dimen name="module_main_card_container_paddingBottom">18px</dimen>
<dimen name="module_main_card_card_shadow_width_div">20px</dimen>
<dimen name="module_main_card_card_shadow_height_div">10px</dimen>
<dimen name="module_main_top_shadow_height">144px</dimen>
<dimen name="module_main_card_cover_up_margin">352px</dimen>
<dimen name="cards_container_dp_600">320px</dimen>
<dimen name="cards_container_shadow_dp_margin_top">319px</dimen>
<dimen name="module_main_apps_fragment_container_width">110px</dimen>
<dimen name="module_main_apps_fragment_container_padding">6px</dimen>
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
<dimen name="module_event_fragment_container_padding">8px</dimen>
<dimen name="module_main_apps_fragment_container_paddingBottom">2px</dimen>
<dimen name="module_ext_top_view_max_width">1920px</dimen>
<dimen name="module_main_panel_margin_right">0px</dimen>
<!--事件面板-->
<dimen name="module_main_event_panel_fragment_paddingTop">2px</dimen>
<dimen name="module_main_event_panel_fragment_paddingBottom">2px</dimen>
<dimen name="module_main_event_panel_fragment_paddingLeft">2px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">4px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">8px</dimen>
</resources>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Main" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowOverscan">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowEnterAnimation">@null</item>
<item name="android:windowExitAnimation">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@drawable/main_bitmap_splash_bg</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowAnimationStyle">@style/MainAnimation</item>
<item name="checkboxStyle">@style/noCheckboxStyle</item>
<item name="android:windowFullscreen">false</item>
<item name="radioButtonStyle">@style/noCheckboxStyle</item>
</style>
<style name="MainAnimation">
<item name="android:activityOpenEnterAnimation">@null</item>
<item name="android:activityOpenExitAnimation">@null</item>
<item name="android:activityCloseEnterAnimation">@null</item>
<item name="android:activityCloseExitAnimation">@null</item>
<item name="android:taskOpenEnterAnimation">@null</item>
<item name="android:taskOpenExitAnimation">@null</item>
<item name="android:taskCloseEnterAnimation">@null</item>
<item name="android:taskCloseExitAnimation">@null</item>
<item name="android:taskToFrontEnterAnimation">@null</item>
<item name="android:taskToFrontExitAnimation">@null</item>
<item name="android:taskToBackEnterAnimation">@null</item>
<item name="android:taskToBackExitAnimation">@null</item>
</style>
<style name="noCheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="buttonCompat">@null</item>
<item name="android:background">@null</item>
</style>
<style name="noRadioButtonStyle" parent="Widget.AppCompat.CompoundButton.RadioButton">
<item name="buttonCompat">@null</item>
<item name="android:background">@null</item>
</style>
</resources>