抽离导航中的悬浮按钮逻辑
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -52,6 +52,7 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-splash-noop" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-tanlu" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-v2x" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-widgets" />
|
||||
<option value="$PROJECT_DIR$/services" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service-api" />
|
||||
|
||||
@@ -294,6 +294,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.moduletanluapi
|
||||
|
||||
implementation rootProject.ext.dependencies.mogomonitor
|
||||
implementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
} else {
|
||||
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
|
||||
independentImplementation project(':main-extensions:mogo-module-main-independent')
|
||||
@@ -310,6 +311,7 @@ dependencies {
|
||||
}
|
||||
implementation project(':libraries:mogo-tanlu-api')
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-widgets')
|
||||
}
|
||||
|
||||
apply from: "./functions/baseservices.gradle"
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
@@ -22,6 +21,7 @@ import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.widgets.MogoWidgetsProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
@@ -58,14 +58,15 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
|
||||
//运营位卡片,需要默认显示,放在第一个加载
|
||||
if (DebugConfig.isLauncher() ) {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
|
||||
} else {
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoWidgetsProvider.PATH, MogoWidgetsProvider.NAME ) );
|
||||
}
|
||||
if(DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD){
|
||||
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
}
|
||||
MogoModulePaths.addModule(new MogoModule(TanluApiConst.MODULE_PATH,
|
||||
TanluApiConst.MODULE_NAME));
|
||||
MogoModulePaths.addModule( new MogoModule( TanluApiConst.MODULE_PATH, TanluApiConst.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
|
||||
@@ -101,13 +102,13 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
prepareBaseService(2_000L);
|
||||
prepareBaseService( 2_000L );
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础服务:passport、location、socket
|
||||
*/
|
||||
private void prepareBaseService(long delay) {
|
||||
private void prepareBaseService( long delay ) {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
// 第三方平台的sn是服务端生成的,所以必须在返回后才能开启
|
||||
|
||||
@@ -4,18 +4,18 @@ ext {
|
||||
android = [
|
||||
// applicationId : "com.mogo.launcher",
|
||||
// zhidadoApplicationId: "com.zhidao.launcher",
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
@@ -194,5 +194,8 @@ targetSdkVersion : 22,
|
||||
androidxroomruntime : "androidx.room:room-runtime:2.2.3",
|
||||
androidxroomcompiler : "androidx.room:room-compiler:2.2.3",
|
||||
androidxroomktx : "androidx.room:room-ktx:2.2.3",
|
||||
|
||||
//
|
||||
mogomodulewidgets : "com.mogo.module:module-widgets:${MOGO_MODULE_WIDGETS_VERSION}",
|
||||
]
|
||||
}
|
||||
@@ -89,6 +89,8 @@ MOGO_MODULE_EVENT_PANEL_NOOP_VERSION = 1.0.0-SNAPSHOT
|
||||
#左侧面板模块
|
||||
MOGO_MODULE_LEFT_PANEL_VERSION = 1.2.1.10-SNAPSHOT
|
||||
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION = 1.2.1.10-SNAPSHOT
|
||||
# 小控件
|
||||
MOGO_MODULE_WIDGETS_VERSION = 1.2.1.10-SNAPSHOT
|
||||
|
||||
# Boost分包
|
||||
BOOST_MULTIDEX_VERSION=1.0.0
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.service.intent.AutoNaviIntentHandler;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
@@ -304,11 +303,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
restartAutoRefreshAtTime( 2_000L );
|
||||
}
|
||||
mIsMainPageFirstResume = false;
|
||||
AutoNaviIntentHandler.getInstance().closeEntrance();
|
||||
} else {
|
||||
unregisterInternalUnWakeupWords();
|
||||
stopAutoRefreshStrategy();
|
||||
AutoNaviIntentHandler.getInstance().syncAutoNaviForgroundStatus( mContext );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,8 +398,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
initLocationServiceProcess( context );
|
||||
}
|
||||
|
||||
AutoNaviIntentHandler.getInstance().syncAutoNaviForgroundStatus( mContext );
|
||||
|
||||
}
|
||||
|
||||
private void initLocationServiceProcess( Context context ) {
|
||||
@@ -924,14 +919,4 @@ public class MogoServices implements IMogoMapListener,
|
||||
AIAssist.getInstance( mContext ).registerUnWakeupCommand( ServiceConst.CMD_BACK, ServiceConst.CMD_BACK_WORDS, this );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
AutoNaviIntentHandler.getInstance().preShowEntrance( mContext );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
AutoNaviIntentHandler.getInstance().closeEntrance();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ public class IntentHandlerFactory {
|
||||
mHandlers.put( MogoReceiver.ACTIION_ADAS, ADASStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_AUTO_NAVI_RECEIVER, AutoNaviIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_AUTO_NAVI_SEND, AutoNaviIntentHandler.getInstance() );
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/module_service_app_entrance_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_services_app_entrance_bkg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/module_service_app_entrance_size"
|
||||
android:layout_height="@dimen/module_service_app_entrance_size"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_service_app_entrance_text"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_service_app_entrance_textSize" />
|
||||
</LinearLayout>
|
||||
@@ -22,12 +22,4 @@
|
||||
<dimen name="module_service_content_minWidth">64px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight">6.5px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_textSize">20px</dimen>
|
||||
<dimen name="module_service_app_entrance_padding">15px</dimen>
|
||||
<dimen name="module_services_app_entrance_corner_size">2px</dimen>
|
||||
<dimen name="module_services_app_entrance_y">112px</dimen>
|
||||
<dimen name="module_services_app_entrance_x">929px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_service_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -22,12 +22,4 @@
|
||||
<dimen name="module_service_content_minWidth">64px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight">6.5px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_textSize">20px</dimen>
|
||||
<dimen name="module_service_app_entrance_padding">15px</dimen>
|
||||
<dimen name="module_services_app_entrance_corner_size">2px</dimen>
|
||||
<dimen name="module_services_app_entrance_y">112px</dimen>
|
||||
<dimen name="module_services_app_entrance_x">929px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_service_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -22,12 +22,4 @@
|
||||
<dimen name="module_service_tag_textSize">20px</dimen>
|
||||
<dimen name="module_service_content_minWidth">120px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
|
||||
<dimen name="module_service_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_service_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_services_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_services_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_services_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_service_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -22,12 +22,4 @@
|
||||
<dimen name="module_service_tag_textSize">20px</dimen>
|
||||
<dimen name="module_service_content_minWidth">120px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
|
||||
<dimen name="module_service_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_service_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_services_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_services_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_services_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_service_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -22,12 +22,4 @@
|
||||
<dimen name="module_service_tag_textSize">20px</dimen>
|
||||
<dimen name="module_service_content_minWidth">120px</dimen>
|
||||
<dimen name="module_service_id_marker_content_paddingRight_widthoutCall">20px</dimen>
|
||||
<dimen name="module_service_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_service_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_services_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_services_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_services_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_service_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_service_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
1
modules/mogo-module-widgets/.gitignore
vendored
Normal file
1
modules/mogo-module-widgets/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
3
modules/mogo-module-widgets/README.md
Normal file
3
modules/mogo-module-widgets/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# 项目介绍
|
||||
|
||||
一些独立于其他业务的悬浮小控件
|
||||
70
modules/mogo-module-widgets/build.gradle
Normal file
70
modules/mogo-module-widgets/build.gradle
Normal file
@@ -0,0 +1,70 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: '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"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [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
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.carcallprovider
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.gpssimulator
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
api project(":libraries:mogo-map-api")
|
||||
api project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
modules/mogo-module-widgets/consumer-rules.pro
Normal file
0
modules/mogo-module-widgets/consumer-rules.pro
Normal file
3
modules/mogo-module-widgets/gradle.properties
Normal file
3
modules/mogo-module-widgets/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-widgets
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-widgets/proguard-rules.pro
vendored
Normal file
21
modules/mogo-module-widgets/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
|
||||
4
modules/mogo-module-widgets/src/main/AndroidManifest.xml
Normal file
4
modules/mogo-module-widgets/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<manifest package="com.mogo.module.widgets">
|
||||
|
||||
|
||||
</manifest>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.intent;
|
||||
package com.mogo.module.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -8,8 +8,6 @@ import android.view.WindowManager;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -21,7 +19,7 @@ public
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AutoNaviIntentHandler implements IntentHandler {
|
||||
class AutoNaviIntentHandler {
|
||||
|
||||
private static final String TAG = "AutoNaviIntentHandler";
|
||||
|
||||
@@ -47,16 +45,11 @@ class AutoNaviIntentHandler implements IntentHandler {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
switch ( keyType ) {
|
||||
case 10021:
|
||||
closeEntrance();
|
||||
MarkerServiceHandler.getADASController().showADAS();
|
||||
break;
|
||||
case 20009:
|
||||
MarkerServiceHandler.getADASController().closeADAS();
|
||||
break;
|
||||
case 10019:
|
||||
int extraState = intent.getIntExtra( "EXTRA_STATE", -1 );
|
||||
@@ -90,15 +83,15 @@ class AutoNaviIntentHandler implements IntentHandler {
|
||||
private void showEntrance( Context context ) {
|
||||
if ( mWindowManagerView == null ) {
|
||||
mWindowManagerView = new WindowManagerView.Builder( AbsMogoApplication.getApp() )
|
||||
.contentView( R.layout.module_service_app_entrance )
|
||||
.contentView( R.layout.module_widgets_app_entrance )
|
||||
.size( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT )
|
||||
.gravity( Gravity.LEFT | Gravity.TOP )
|
||||
.position( ResourcesHelper.getDimensionPixelSize( context, R.dimen.module_services_app_entrance_x ), ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_services_app_entrance_y ) )
|
||||
.position( ResourcesHelper.getDimensionPixelSize( context, R.dimen.module_widgets_app_entrance_x ), ResourcesHelper.getDimensionPixelSize( AbsMogoApplication.getApp(), R.dimen.module_widgets_app_entrance_y ) )
|
||||
.showInWindowManager();
|
||||
mWindowManagerView.attachTouchEvent( view -> {
|
||||
try {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
MogoWidgetManger.getInstance().getApis().getLauncherApi().backToLauncher( context );
|
||||
} else {
|
||||
LaunchUtils.launchByPkg( context, "com.mogo.launcher.app" );
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.mogo.module.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/8/12
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoWidgetManger implements IMogoNaviListener2, IMogoIntentListener, IMogoStatusChangedListener {
|
||||
|
||||
// 接受其他app发给高德的广播
|
||||
public static final String ACTION_AUTO_NAVI_RECEIVER = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
// 接受高德发过来的广播
|
||||
public static final String ACTION_AUTO_NAVI_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
|
||||
private static final String TAG = "MogoWidgetManger";
|
||||
|
||||
private static volatile MogoWidgetManger sInstance;
|
||||
|
||||
private MogoWidgetManger() {
|
||||
}
|
||||
|
||||
public static MogoWidgetManger getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoWidgetManger.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoWidgetManger();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private IMogoServiceApis mApis;
|
||||
private Context mContext;
|
||||
|
||||
public IMogoServiceApis getApis() {
|
||||
return mApis;
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context;
|
||||
mApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
initMapStatusListener();
|
||||
initStatusListener();
|
||||
initIntentListener();
|
||||
AutoNaviIntentHandler.getInstance().syncAutoNaviForgroundStatus( mContext );
|
||||
}
|
||||
|
||||
private void initMapStatusListener() {
|
||||
mApis.getRegisterCenterApi().registerMogoNaviListener( TAG, this );
|
||||
}
|
||||
|
||||
private void initIntentListener() {
|
||||
mApis.getIntentManagerApi().registerIntentListener( ACTION_AUTO_NAVI_RECEIVER, this );
|
||||
mApis.getIntentManagerApi().registerIntentListener( ACTION_AUTO_NAVI_SEND, this );
|
||||
}
|
||||
|
||||
private void initStatusListener() {
|
||||
mApis.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
AutoNaviIntentHandler.getInstance().closeEntrance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
AutoNaviIntentHandler.getInstance().preShowEntrance( mContext );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
AutoNaviIntentHandler.getInstance().handle( mContext, intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor == StatusDescriptor.MAIN_PAGE_RESUME ) {
|
||||
if ( isTrue ) {
|
||||
AutoNaviIntentHandler.getInstance().closeEntrance();
|
||||
} else {
|
||||
AutoNaviIntentHandler.getInstance().syncAutoNaviForgroundStatus( mContext );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.mogo.module.widgets;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/8/12
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoWidgetsProvider.PATH )
|
||||
class MogoWidgetsProvider implements IMogoModuleProvider {
|
||||
|
||||
private static final String TAG = "MogoWidgetsProvider";
|
||||
|
||||
public static final String PATH = "/widgets/provider";
|
||||
public static final String NAME = "MogoWidgetProvider";
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init." );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MogoWidgetManger.getInstance().init( context );
|
||||
}, 5500 );
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<item>
|
||||
<shape>
|
||||
<gradient android:angle="180" android:endColor="#5CC1FF" android:startColor="#256BFF" />
|
||||
<corners android:radius="@dimen/module_services_app_entrance_corner_size" />
|
||||
<corners android:radius="@dimen/module_widgets_app_entrance_corner_size" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/module_widgets_app_entrance_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_widgets_app_entrance_bkg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/module_widgets_app_entrance_size"
|
||||
android:layout_height="@dimen/module_widgets_app_entrance_size"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_widgets_app_entrance_text"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/module_widgets_app_entrance_textSize" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_entrance_textSize">20px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">2px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">112px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">929px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_entrance_textSize">20px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">2px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">112px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">929px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
11
modules/mogo-module-widgets/src/main/res/values/dimens.xml
Normal file
11
modules/mogo-module-widgets/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_entrance_textSize">40px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_padding">30px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_corner_size">4px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_y">48px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_x">1000px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingTop">10px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_paddingLeft">15px</dimen>
|
||||
<dimen name="module_widgets_app_entrance_size">71px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-service</string>
|
||||
<string name="module_widgets_app_entrance_text">辅助\n驾驶</string>
|
||||
</resources>
|
||||
@@ -1,3 +1,4 @@
|
||||
include ':modules:mogo-module-widgets'
|
||||
include ':modules:mogo-module-monitor'
|
||||
include ':libraries:mogo-tanlu-api'
|
||||
include ':foudations:mogo-base-services-apk'
|
||||
|
||||
Reference in New Issue
Block a user