1
core/function-impl/mogo-core-function-main/.gitignore
vendored
Normal file
1
core/function-impl/mogo-core-function-main/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
64
core/function-impl/mogo-core-function-main/build.gradle
Normal file
64
core/function-impl/mogo-core-function-main/build.gradle
Normal file
@@ -0,0 +1,64 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
api rootProject.ext.dependencies.modulemain
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.mogo_core_function_smp
|
||||
} else {
|
||||
api project(":modules:mogo-module-main")
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':core:function-impl:mogo-core-function-smp')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.eagle.core.function.impl
|
||||
POM_ARTIFACT_ID=main
|
||||
VERSION_CODE=1
|
||||
21
core/function-impl/mogo-core-function-main/proguard-rules.pro
vendored
Normal file
21
core/function-impl/mogo-core-function-main/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.eagle.core.function.main">
|
||||
|
||||
<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.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name=".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>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,283 @@
|
||||
package com.mogo.eagle.core.function.main;
|
||||
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_NON;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
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.api.map.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IV2XWarningListener;
|
||||
import com.mogo.utils.ActivityLifecycleManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IV2XWarningListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
private static final int COUNT_DOWN_TIMER = 1_000;
|
||||
private static final int ALL_EXPIRE_TIMER = 3_000;
|
||||
private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
Log.d(TAG, "onCreate");
|
||||
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadContainerModules() {
|
||||
super.loadContainerModules();
|
||||
// 显示左边遮罩
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
} else {
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
MogoModulesManager.getInstance().loadAppsListModule(com.mogo.module.main.R.id.module_main_id_apps_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hideLayout() {
|
||||
super.hideLayout();
|
||||
mApps.setVisibility(View.GONE);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showLayout() {
|
||||
super.showLayout();
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@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 boolean shouldCloseADASPanelWhenPause() {
|
||||
return !mIsHomeKeyDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadOthersModules() {
|
||||
super.loadOthersModules();
|
||||
Logger.d(TAG, "loadOthersModules");
|
||||
loadOCHModule();
|
||||
loadSmpModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载网约车模块
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载小地图模块
|
||||
*/
|
||||
private void loadSmpModule() {
|
||||
IMogoSmallMapProvider smp = ARouter.getInstance().navigation(IMogoSmallMapProvider.class);
|
||||
if (smp != null) {
|
||||
smp.init(this, R.id.module_main_id_smp_fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mServiceApis.getStatusManagerApi().unregisterStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
mServiceApis.getV2XListenerManager().unregisterIntentListener(TAG, 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);
|
||||
Logger.d(TAG, "send msg to AI Voice");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void warningChangedWithDirection(int type) {
|
||||
Log.d(TAG, "显示红色预警蒙层");
|
||||
Log.d("MogoObu", "显示红色预警蒙层 ------> type = " + type);
|
||||
switch (type) {
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_NON:
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_TOP:
|
||||
mWarningTop.setVisibility(View.VISIBLE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningTop);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_LEFT:
|
||||
mWarningLeft.setVisibility(View.VISIBLE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningLeft);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
|
||||
mWarningRight.setVisibility(View.VISIBLE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningRight);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
|
||||
mWarningBottom.setVisibility(View.VISIBLE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningBottom);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT:
|
||||
mWarningBottom.setVisibility(View.VISIBLE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.VISIBLE);
|
||||
startCountDownWithView(mWarningBottom);
|
||||
startCountDownWithView(mWarningLeft);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT:
|
||||
mWarningBottom.setVisibility(View.VISIBLE);
|
||||
mWarningRight.setVisibility(View.VISIBLE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningBottom);
|
||||
startCountDownWithView(mWarningRight);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预警蒙层显示时间为3秒
|
||||
*/
|
||||
private void startCountDownWithView(ImageView view) {
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;
|
||||
Logger.d(TAG, "当前蒙层显示时间为 :" + EXPIRE_TIMER / COUNT_DOWN_TIMER + " 秒");
|
||||
if (EXPIRE_TIMER > 0) {
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
} else {
|
||||
view.setVisibility(View.GONE);
|
||||
stopCountDown();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
}
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
super.onStatusChanged(descriptor, isTrue);
|
||||
if (isTrue) {
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
mApps.setVisibility(View.GONE);
|
||||
} else {
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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" >444px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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" >444px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user