dev
This commit is contained in:
@@ -10,7 +10,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode rootProject.ext.android.versionCode
|
||||
versionCode generateVersionCode()
|
||||
versionName "${rootProject.ext.android.versionName}.${getMonthAndDay()}"
|
||||
applicationId rootProject.ext.android.applicationId
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -84,6 +84,41 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
def generateVersionCode() {
|
||||
String vn = rootProject.ext.android.versionName
|
||||
String[] versions = vn.split("\\.")
|
||||
if (versions.length == 3) {
|
||||
int num1 = Integer.valueOf(versions[0])
|
||||
int num2 = Integer.valueOf(versions[1])
|
||||
int num3 = Integer.valueOf(versions[2])
|
||||
if (num1 < 1 || num1 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
if (num2 < 0 || num2 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
if (num3 < 0 || num3 > 99){
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
StringBuilder builder = new StringBuilder()
|
||||
builder.append(num1)
|
||||
if( num2 > 9 ){
|
||||
builder.append(num2)
|
||||
} else {
|
||||
builder.append("0").append(num2)
|
||||
}
|
||||
if( num3 > 9 ){
|
||||
builder.append(num3)
|
||||
} else {
|
||||
builder.append("0").append(num3)
|
||||
}
|
||||
println("last versionCode ${builder}")
|
||||
return Integer.valueOf(builder.toString())
|
||||
} else {
|
||||
throw new GradleException("版本号必须定义为 x.y.z,x[1,99], y[0, 99], z[0, 99])")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
@@ -103,19 +138,19 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
implementation rootProject.ext.dependencies.guideshow
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.modulefreshnews,{
|
||||
exclude group:'com.mogo.module',module:'module-onlinecar'
|
||||
implementation rootProject.ext.dependencies.modulefreshnews, {
|
||||
exclude group: 'com.mogo.module', module: 'module-onlinecar'
|
||||
}
|
||||
|
||||
implementation rootProject.ext.dependencies.modulepush,{
|
||||
exclude group:'com.mogo.module',module:'module-common'
|
||||
implementation rootProject.ext.dependencies.modulepush, {
|
||||
exclude group: 'com.mogo.module', module: 'module-common'
|
||||
}
|
||||
implementation rootProject.ext.dependencies.moduleadcard
|
||||
|
||||
implementation rootProject.ext.dependencies.moduleonlinecar
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu,{
|
||||
exclude group:'com.mogo.module',module:'module-share'
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
exclude group: 'com.mogo.module', module: 'module-share'
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
@@ -145,7 +180,7 @@ android.applicationVariants.all { variant ->
|
||||
}
|
||||
|
||||
|
||||
def getMonthAndDay(){
|
||||
def getMonthAndDay() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MMddHH")
|
||||
return sdf.format(new Date())
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ ext {
|
||||
buildToolsVersion: "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
versionCode : 4,
|
||||
versionName : "1.0.3",
|
||||
versionName : "8.0.4",
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.utils;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AppUtils {
|
||||
|
||||
public static boolean isApplicationBroughtToBackground( final Context context ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > tasks = am.getRunningTasks( 1 );
|
||||
if ( !tasks.isEmpty() ) {
|
||||
ComponentName topActivity = tasks.get( 0 ).topActivity;
|
||||
if ( !topActivity.getPackageName().equals( context.getPackageName() ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -619,6 +619,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
public void displayOverview() {
|
||||
if ( checkAMapView() ) {
|
||||
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
loseLockMode();
|
||||
NaviClient.getInstance( getContext() ).displayOverview();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ import com.amap.api.navi.enums.AimLessMode;
|
||||
import com.amap.api.navi.enums.NaviType;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -151,7 +153,13 @@ public class NaviClient implements IMogoNavi {
|
||||
stopAimlessMode();
|
||||
mIsRealNavi = isRealNavi;
|
||||
|
||||
boolean isNaving = isNaviing();
|
||||
boolean result = mAMapNavi.startNavi( isRealNavi ? NaviType.GPS : NaviType.EMULATOR );
|
||||
if ( isNaving && !result ) {
|
||||
// 如果正在导航,又重新规划路线,startNavi 不会成功,不会重新回调 #onStartNavi
|
||||
MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
AMapMessageManager.getInstance().postNaviStarted();
|
||||
}
|
||||
Logger.d( TAG, "start navi status: %s", result );
|
||||
}
|
||||
|
||||
|
||||
@@ -452,6 +452,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
* 展示全程
|
||||
*/
|
||||
public void displayOverview(){
|
||||
showCalculatedPaths( null );
|
||||
showBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider, IMogoI
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mIntentManager.registerIntentListener( COMMAND_BACK, this );
|
||||
BackToMainHomeManager.init( mServiceApis.getFragmentManagerApi() );
|
||||
BackToMainHomeManager.init( mServiceApis.getFragmentManagerApi(), mServiceApis.getStatusManagerApi() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PixelFormat;
|
||||
@@ -12,31 +10,45 @@ import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.back.utils.Utils;
|
||||
import com.mogo.module.back.utils.WindowManagerViewHelper;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class BackToMainHomeManager {
|
||||
|
||||
private static final String TAG = "BackToMainHomeManager";
|
||||
|
||||
private static View mBackView;
|
||||
|
||||
private static IMogoFragmentManager mFragmentManager;
|
||||
private static IMogoStatusManager mStatusManager;
|
||||
|
||||
public static void init( IMogoFragmentManager manager ) {
|
||||
public static void init( IMogoFragmentManager manager, IMogoStatusManager statusManager ) {
|
||||
mFragmentManager = manager;
|
||||
mStatusManager = statusManager;
|
||||
}
|
||||
|
||||
public static void backToLauncher(){
|
||||
public static void backToLauncher() {
|
||||
|
||||
if ( mFragmentManager != null ) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
|
||||
if ( mStatusManager != null ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.d( TAG, "返回桌面" );
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction( Intent.ACTION_MAIN );
|
||||
intent.addCategory( Intent.CATEGORY_HOME );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
AbsMogoApplication.getApp().startActivity( intent );
|
||||
|
||||
if ( mFragmentManager != null ) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMainHomeView() {
|
||||
@@ -52,7 +64,7 @@ public class BackToMainHomeManager {
|
||||
return;
|
||||
}
|
||||
mBackView.setOnClickListener( view -> {
|
||||
backToLauncher();
|
||||
backToLauncher();
|
||||
} );
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
@@ -133,8 +133,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mIMogoAuthorizeModuleManager = (IMogoAuthorizeModuleManager) ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation(getContext());
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener(AUTHORIZE_TYPE_LAUNCHER_SHARE, this);
|
||||
mIMogoAuthorizeModuleManager = ( IMogoAuthorizeModuleManager ) ARouter.getInstance().build( AuthorizeConstant.PROVIDER_MODULE ).navigation( getContext() );
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener( AUTHORIZE_TYPE_LAUNCHER_SHARE, this );
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter( getContext(), this, mIMogoAuthorizeModuleManager );
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
@@ -177,8 +177,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
isClickShare = true;
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
traceData( "1" );
|
||||
@@ -206,12 +206,12 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mExitNavi = findViewById( R.id.module_entrance_id_exit_navi );
|
||||
mExitNavi.setOnClickListener( view -> {
|
||||
if ( mMogoNavi != null ) {
|
||||
//if ( mIsLock ) {
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
//} else {
|
||||
// mMApUIController.recoverLockMode();
|
||||
//}
|
||||
if ( mIsLock ) {
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -225,8 +225,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
ivMode.setSelected( !ivMode.isSelected() );
|
||||
ivMode.setText(
|
||||
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
ivMode.setText( getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -248,8 +247,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
} else if ( opera_type == 1 ) {
|
||||
ivMode.setSelected( true );
|
||||
}
|
||||
ivMode.setText(
|
||||
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
ivMode.setText( getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
@@ -258,14 +256,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
|
||||
protected void setMarkerStatus( boolean show ) {
|
||||
mMogoStatusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
|
||||
);
|
||||
mMogoStatusManager.setSearchUIShow( MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show );
|
||||
}
|
||||
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
"AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
@@ -299,14 +294,14 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
|
||||
isClickShare = false;
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void authorizeSuccess() {
|
||||
Log.d(TAG, "authorizeSuccess --------> isClickShare = " + isClickShare);
|
||||
if (isClickShare) {
|
||||
Log.d( TAG, "authorizeSuccess --------> isClickShare = " + isClickShare );
|
||||
if ( isClickShare ) {
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
traceData( "1" );
|
||||
} else {
|
||||
@@ -316,7 +311,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
@Override
|
||||
public void authorizeFailed( String errorMsg ) {
|
||||
Log.e( TAG, "authorizeFailed --------> errorMsg = " + errorMsg + " >> isClickShare = " + isClickShare);
|
||||
Log.e( TAG, "authorizeFailed --------> errorMsg = " + errorMsg + " >> isClickShare = " + isClickShare );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -419,7 +414,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
} else {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
mExitNavi.setText( R.string.module_ext_str_continue_navi );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -15,7 +13,6 @@ import androidx.viewpager.widget.ViewPager;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -24,8 +21,6 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.assist.MapBroadCastHelper;
|
||||
import com.mogo.module.main.cards.CardIntroduceConfig;
|
||||
import com.mogo.module.main.cards.CardIntroduceConfigs;
|
||||
import com.mogo.module.main.cards.CardModulesAdapter;
|
||||
import com.mogo.module.main.cards.HorizentalStackTransformer;
|
||||
@@ -33,26 +28,17 @@ import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.cards.OnPageChangeListenerAdapter;
|
||||
import com.mogo.module.main.cards.OrientedViewPager;
|
||||
import com.mogo.module.main.cards.VerticalStackTransformer;
|
||||
import com.mogo.module.main.constants.VoiceConstants;
|
||||
import com.mogo.module.main.windowview.WindowViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -373,14 +359,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
MapBroadCastHelper.getInstance( this ).mapFrount();
|
||||
super.onResume();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
MapBroadCastHelper.getInstance( this ).mapBackground();
|
||||
super.onPause();
|
||||
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
|
||||
CardIntroduceConfigs.flush( getApplicationContext() );
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.mogo.module.main.assist;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.impl.intent.IntentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-01-17.
|
||||
*/
|
||||
public class MapBroadCastHelper implements IMogoIntentListener {
|
||||
|
||||
private static volatile MapBroadCastHelper sInstance;
|
||||
private static final String ACTION_NAV_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
private static final int STATUS_NAV_FRONT = 3;
|
||||
private static final int STATUS_NAV_BACKGROUND = 4;
|
||||
private static final int STATUS_NAV_START = 8;
|
||||
private static final int STATUS_NAV_STOP = 9;
|
||||
private Context context;
|
||||
|
||||
private MapBroadCastHelper(Context context) {
|
||||
this.context = context;
|
||||
|
||||
IntentManager.getInstance().registerIntentListener(MogoReceiver.ACTION_VOICE_READY,this);
|
||||
}
|
||||
|
||||
public static MapBroadCastHelper getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MapBroadCastHelper.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MapBroadCastHelper( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void notifyXiaozhi(MogoNaviInfo naviinfo) {
|
||||
Intent intent = new Intent(ACTION_NAV_SEND);
|
||||
intent.putExtra("KEY_TYPE", 10001);
|
||||
intent.putExtra("NEXT_ROAD_NAME", naviinfo.getNextRoadName());
|
||||
intent.putExtra("ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime());
|
||||
intent.putExtra("ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance());
|
||||
intent.putExtra("ICON", naviinfo.getIconResId());
|
||||
context.sendBroadcast(intent);
|
||||
Log.v("MapBroadCastHelper","action="+ACTION_NAV_SEND+"NaviInfo");
|
||||
}
|
||||
|
||||
|
||||
public void notifyXizhiNavStatus(int status) {
|
||||
Intent intent =new Intent(ACTION_NAV_SEND);
|
||||
intent.putExtra("KEY_TYPE", 10019);
|
||||
intent.putExtra("EXTRA_STATE", status);
|
||||
intent.putExtra("SOURCE_APP", context.getPackageName());
|
||||
context.sendBroadcast(intent);
|
||||
Log.v("MapBroadCastHelper","NavStatus="+status);
|
||||
}
|
||||
|
||||
public void mapFrount(){
|
||||
notifyXizhiNavStatus(STATUS_NAV_FRONT);
|
||||
}
|
||||
|
||||
public void mapBackground(){
|
||||
notifyXizhiNavStatus(STATUS_NAV_BACKGROUND);
|
||||
}
|
||||
|
||||
public void startNavi(){
|
||||
notifyXizhiNavStatus(STATUS_NAV_START);
|
||||
}
|
||||
|
||||
public void stopNavi(){
|
||||
notifyXizhiNavStatus(STATUS_NAV_STOP);
|
||||
}
|
||||
|
||||
@Override public void onIntentReceived(String intentStr, Intent intent) {
|
||||
if (TextUtils.equals(intentStr, MogoReceiver.ACTION_VOICE_READY)) {
|
||||
mapFrount();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.main.cards;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -28,7 +27,6 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.assist.MapBroadCastHelper;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -442,7 +440,6 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
MapBroadCastHelper.getInstance( getApplicationContext() ).notifyXiaozhi( naviinfo );
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
if ( iterator == null ) {
|
||||
@@ -465,7 +462,6 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
mTrackManager.track( "Navigation_begin", new HashMap<>() );
|
||||
|
||||
MapBroadCastHelper.getInstance( getApplicationContext() ).startNavi();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -484,7 +480,6 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mTrackManager.track( "Navigation_end", new HashMap<>() );
|
||||
MapBroadCastHelper.getInstance( getApplicationContext() ).stopNavi();
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.AppUtils;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-01-17.
|
||||
*/
|
||||
public class MapBroadCastHelper implements IMogoStatusChangedListener {
|
||||
|
||||
private static final String TAG = "MapBroadCastHelper";
|
||||
|
||||
private static volatile MapBroadCastHelper sInstance;
|
||||
private static final String ACTION_NAV_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
private static final int STATUS_NAV_FRONT = 3;
|
||||
private static final int STATUS_NAV_BACKGROUND = 4;
|
||||
private static final int STATUS_NAV_START = 8;
|
||||
private static final int STATUS_NAV_STOP = 9;
|
||||
private Context mContext;
|
||||
|
||||
private MapBroadCastHelper( Context context ) {
|
||||
this.mContext = context;
|
||||
IMogoServiceApis api = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
|
||||
api.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.AI_ASSIST_READY, this );
|
||||
}
|
||||
|
||||
public static MapBroadCastHelper getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MapBroadCastHelper.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MapBroadCastHelper( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void notifyXiaozhi( MogoNaviInfo naviinfo ) {
|
||||
Intent intent = new Intent( ACTION_NAV_SEND );
|
||||
intent.putExtra( "KEY_TYPE", 10001 );
|
||||
intent.putExtra( "NEXT_ROAD_NAME", naviinfo.getNextRoadName() );
|
||||
intent.putExtra( "ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime() );
|
||||
intent.putExtra( "ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance() );
|
||||
intent.putExtra( "ICON", naviinfo.getIconResId() );
|
||||
mContext.sendBroadcast( intent );
|
||||
Log.v( "MapBroadCastHelper", "action=" + ACTION_NAV_SEND + " NaviInfo" );
|
||||
}
|
||||
|
||||
|
||||
public void notifyXizhiNavStatus( int status ) {
|
||||
Intent intent = new Intent( ACTION_NAV_SEND );
|
||||
intent.putExtra( "KEY_TYPE", 10019 );
|
||||
intent.putExtra( "EXTRA_STATE", status );
|
||||
intent.putExtra( "SOURCE_APP", mContext.getPackageName() );
|
||||
mContext.sendBroadcast( intent );
|
||||
Log.v( "MapBroadCastHelper", "NavStatus=" + status );
|
||||
}
|
||||
|
||||
public void mapFrount() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_FRONT );
|
||||
}
|
||||
|
||||
public void mapBackground() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_BACKGROUND );
|
||||
}
|
||||
|
||||
public void startNavi() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_START );
|
||||
}
|
||||
|
||||
public void stopNavi() {
|
||||
notifyXizhiNavStatus( STATUS_NAV_STOP );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor == StatusDescriptor.AI_ASSIST_READY ) {
|
||||
if ( isTrue ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
|
||||
mapBackground();
|
||||
} else {
|
||||
mapFrount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onPause();
|
||||
}
|
||||
MapBroadCastHelper.getInstance( getContext() ).mapBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +90,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onResume();
|
||||
}
|
||||
MapBroadCastHelper.getInstance( getContext() ).mapFrount();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,9 @@ import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
@@ -23,12 +26,15 @@ import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.service.voice.IMogoVoiceManager;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
@@ -44,7 +50,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class MapPresenter extends Presenter< MapView > implements
|
||||
IMogoIntentListener,
|
||||
IMogoVoiceCmdCallBack {
|
||||
IMogoVoiceCmdCallBack,
|
||||
IMogoNaviListener2 {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
@@ -53,12 +60,15 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private IMogoSearchManager mSearchManager;
|
||||
private IMogoRefreshStrategyController mRefreshStrategyController;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
private IMogoLauncher mLauncher;
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
super( view );
|
||||
initBroadcast();
|
||||
}
|
||||
private BroadcastReceiver broadcastReceiver;
|
||||
|
||||
private BroadcastReceiver broadcastReceiver;
|
||||
|
||||
/**
|
||||
* opera type为0:0 实时路况开;1实时路况关 type为1:0 放大地图; 1缩小地图 type为2:0切换2d车上; 1切换2d北上;2切换3d车上支持
|
||||
@@ -116,17 +126,17 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
boolean extra_endurance_data =
|
||||
intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extra_endurance_data ) {
|
||||
mView.getUIController().recoverLockMode();
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10006 ) {
|
||||
|
||||
int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
|
||||
|
||||
if (extra_is_show == 0) {
|
||||
if ( extra_is_show == 0 ) {
|
||||
mStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mView.getUIController().displayOverview();
|
||||
} else {
|
||||
mView.getUIController().recoverLockMode();
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
@@ -160,6 +170,24 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
getContext().registerReceiver( broadcastReceiver, inputFilter );
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
private void onContinueNavigation(){
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mView.getUIController().recoverLockMode();
|
||||
} else {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
try {
|
||||
mView.getUIController().recoverLockMode();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, 2_000L );
|
||||
}
|
||||
}
|
||||
|
||||
private void zoomMap( boolean zoomIn ) {
|
||||
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
|
||||
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
|
||||
@@ -195,6 +223,9 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mSearchManager = apis.getSearchManagerApi();
|
||||
mRefreshStrategyController = apis.getRefreshStrategyControllerApi();
|
||||
mStatusManager = apis.getStatusManagerApi();
|
||||
mRegisterCenter = apis.getRegisterCenterApi();
|
||||
mRegisterCenter.registerMogoNaviListener( TAG, this );
|
||||
mLauncher = apis.getLauncherApi();
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
@@ -217,10 +248,11 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
unregisterVoiceCmd();
|
||||
}
|
||||
|
||||
@Override public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
if (broadcastReceiver != null) {
|
||||
getContext().unregisterReceiver(broadcastReceiver);
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( broadcastReceiver != null ) {
|
||||
getContext().unregisterReceiver( broadcastReceiver );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +362,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mView.getUIController().displayOverview();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE:
|
||||
mView.getUIController().recoverLockMode();
|
||||
onContinueNavigation();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE_UN_WAKEUP:
|
||||
case VoiceConstants.CMD_MAP_CAR_UP_MODE:
|
||||
@@ -383,4 +415,54 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveDestination() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEndEmulatorNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
MapBroadCastHelper.getInstance( getContext() ).notifyXiaozhi( naviinfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
MapBroadCastHelper.getInstance( getContext() ).startNavi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
MapBroadCastHelper.getInstance( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic( MogoTraffic traffic ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.mogo.service.module.MogoAction;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -838,7 +839,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
* 切换卡片
|
||||
*/
|
||||
private void switchCard2( String card ) {
|
||||
if ( isApplicationBroughtToBackground( mContext ) ) {
|
||||
if ( AppUtils.isApplicationBroughtToBackground( mContext ) ) {
|
||||
mLauncher.backToLauncher( mContext );
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
if ( mStatusManager.isADASShow() ) {
|
||||
@@ -855,18 +856,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isApplicationBroughtToBackground( final Context context ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > tasks = am.getRunningTasks( 1 );
|
||||
if ( !tasks.isEmpty() ) {
|
||||
ComponentName topActivity = tasks.get( 0 ).topActivity;
|
||||
if ( !topActivity.getPackageName().equals( context.getPackageName() ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void changeCarHeadstockDirection( final double degree ) {
|
||||
if ( mNavi.isNaviing() ) {
|
||||
return;
|
||||
@@ -940,11 +929,9 @@ public class MogoServices implements IMogoMapListener,
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_PREV, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(),
|
||||
MogoAction.Prev );
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Prev );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKE_NEXT, cmd ) ) {
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(),
|
||||
MogoAction.Next );
|
||||
mActionManager.invoke( MapMarkerManager.getInstance().getCurrentModuleName(), MogoAction.Next );
|
||||
} else if ( TextUtils.equals( ServiceConst.CMD_UN_WAKEUP_MY_LOCATION, cmd ) ) {
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
mUiController.recoverLockMode();
|
||||
|
||||
Reference in New Issue
Block a user