Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -8,6 +8,7 @@ import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.AppsListActivity;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -28,11 +29,11 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
switch ( appInfo.getPackageName() ) {
|
||||
case "com.mogo.launcher.navi.search":
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction( "AUTONAVI_STANDARD_BROADCAST_RECV" );
|
||||
intent.putExtra( "KEY_TYPE", 10034 );
|
||||
intent.putExtra( "SOURCE_APP", "Third App" );
|
||||
context.sendBroadcast( intent );
|
||||
try {
|
||||
LaunchUtils.launchByPkg( context, "com.autonavi.amapauto" );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
AppServiceHandler.getApis().getSearchManagerApi().showSearch();
|
||||
}
|
||||
|
||||
@@ -15,13 +15,15 @@ public class NavigatorApps {
|
||||
|
||||
private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi, 1 );
|
||||
private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable, 1 );
|
||||
private static AppInfo app2 = new AppInfo( "音乐", "com.pvetec.musics", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app2 = new AppInfo( "音乐", "com.tencent.wecarflow", "", 0, null, R.drawable.module_apps_ic_navigator_media, 2 );
|
||||
private static AppInfo app3 = new AppInfo( "车聊聊", "com.zhidao.imdemo", "", 0, null, R.drawable.module_apps_ic_navigator_im, 6 );
|
||||
private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist, 4 );
|
||||
|
||||
public static List< AppInfo > getApps() {
|
||||
List< AppInfo > sApps = new ArrayList<>();
|
||||
sApps.add( app );
|
||||
sApps.add( app2 );
|
||||
sApps.add( app3 );
|
||||
sApps.add( app4 );
|
||||
return sApps;
|
||||
}
|
||||
@@ -30,6 +32,7 @@ public class NavigatorApps {
|
||||
List< AppInfo > sApps = new ArrayList<>();
|
||||
sApps.add( app );
|
||||
sApps.add( app2 );
|
||||
sApps.add( app3 );
|
||||
sApps.add( app4 );
|
||||
return sApps;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable/module_apps_ic_navigator_im.png
Executable file
BIN
modules/mogo-module-apps/src/main/res/drawable/module_apps_ic_navigator_im.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
@@ -14,14 +13,12 @@ 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.module.common.utils.CarSeries;
|
||||
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.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -30,12 +27,9 @@ import com.mogo.utils.logger.Logger;
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = BackToLauncherConst.MODULE_PATH )
|
||||
public class BackToLauncherModuleProvider implements IMogoModuleProvider, IMogoIntentListener {
|
||||
public class BackToLauncherModuleProvider implements IMogoModuleProvider {
|
||||
|
||||
private IMogoServiceApis mServiceApis;
|
||||
private IMogoIntentManager mIntentManager;
|
||||
|
||||
public static final String COMMAND_BACK = "com.ileja.launcher.back";
|
||||
|
||||
private static final String TAG = "BackToLauncherModuleProvider";
|
||||
|
||||
@@ -97,18 +91,10 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider, IMogoI
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
BackToMainHomeManager.addMainHomeView();
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
BackToMainHomeManager.addMainHomeView();
|
||||
}
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mIntentManager.registerIntentListener( COMMAND_BACK, this );
|
||||
BackToMainHomeManager.init( mServiceApis );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( COMMAND_BACK.equals( intentStr ) ) {
|
||||
Logger.d( TAG, "received back to home command." );
|
||||
BackToMainHomeManager.backToLauncher();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ public class MogoModulePaths {
|
||||
|
||||
private static List< MogoModule > mMogoModules = new ArrayList<>();
|
||||
|
||||
// 不需要启动APP也能运行的模块
|
||||
private static List< MogoModule > mMogoBaseModules = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 地图模块 fragment 路径
|
||||
*/
|
||||
@@ -50,7 +53,23 @@ public class MogoModulePaths {
|
||||
mMogoModules.add( module );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加卡片模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
public static void addBaseModule( MogoModule module ) {
|
||||
if ( module == null || TextUtils.isEmpty( module.getPath().replace( " ", "" ) ) ) {
|
||||
throw new IllegalArgumentException( "module path can't be empty or null or blank" );
|
||||
}
|
||||
mMogoBaseModules.add( module );
|
||||
}
|
||||
|
||||
public static List< MogoModule > getModules() {
|
||||
return mMogoModules;
|
||||
}
|
||||
|
||||
public static List< MogoModule > getBaseModules() {
|
||||
return mMogoBaseModules;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
/**
|
||||
* 天气,消息,个人头像
|
||||
*
|
||||
@@ -116,7 +118,9 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
|
||||
@Override
|
||||
public void renderUserInfo(UserInfo userInfo) {
|
||||
Logger.d(TAG, "renderUserInfo: " + userInfo);
|
||||
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).circleCrop().into(mUserHeadImg);
|
||||
if(userInfo != null){
|
||||
Logger.d(TAG, "renderUserInfo: " + userInfo);
|
||||
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).circleCrop().into(mUserHeadImg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class ExtensionsModuleConst {
|
||||
|
||||
//埋点
|
||||
//分享分类 1:路况,2:油价,3:交通检查,4:封路
|
||||
public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
|
||||
public static final String LAUNCHER_SHARE_TYPE = "v2x_share_type";
|
||||
//分享/上报按钮点击 from=1 手动点击 from=2 语音打开
|
||||
public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click";
|
||||
public static final String LAUNCHER_SHARE_CLICK = "v2x_share_click";
|
||||
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -48,6 +49,8 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
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.LaunchUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
@@ -63,7 +66,7 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresenter>
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter >
|
||||
implements EntranceView,
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
@@ -166,10 +169,10 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
private Runnable mLockCarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
if ( !mStatusManager.isDisplayOverview() ) {
|
||||
return;
|
||||
}
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
};
|
||||
@@ -179,21 +182,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
}
|
||||
|
||||
private List<View> demoCache = new ArrayList<>();
|
||||
private List< View > demoCache = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mEntrancePresenter = new EntrancePresenter( getContext(), this );
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
|
||||
mStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
|
||||
mUpload = findViewById(R.id.module_entrance_id_upload);
|
||||
mUploading = findViewById(R.id.module_entrance_id_uploading);
|
||||
mUploadRoadCondition.setOnClickListener(view -> {
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUpload = findViewById( R.id.module_entrance_id_upload );
|
||||
mUploading = findViewById( R.id.module_entrance_id_uploading );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
// // todo 测试动画
|
||||
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
||||
// TextView tv = v.findViewById(R.id.tvIndex);
|
||||
@@ -212,25 +215,25 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// });
|
||||
// 原始逻辑
|
||||
showShareDialog();
|
||||
});
|
||||
} );
|
||||
|
||||
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
|
||||
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
|
||||
mDisplayOverviewIcon = findViewById(R.id.module_ext_id_display_overview_icon);
|
||||
mDisplayOverview.setOnClickListener(view -> {
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
mMApUIController.displayOverview(mDisplayOverviewBounds);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
|
||||
mDisplayOverview = findViewById( R.id.module_ext_id_display_overview );
|
||||
mDisplayOverviewText = findViewById( R.id.module_ext_id_display_overview_text );
|
||||
mDisplayOverviewIcon = findViewById( R.id.module_ext_id_display_overview_icon );
|
||||
mDisplayOverview.setOnClickListener( view -> {
|
||||
if ( !mStatusManager.isDisplayOverview() ) {
|
||||
mMApUIController.displayOverview( mDisplayOverviewBounds );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 );
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
}
|
||||
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
|
||||
});
|
||||
mStatusManager.setDisplayOverview( TAG, !mStatusManager.isDisplayOverview() );
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mMove2CurrentLocation.setOnClickListener(view -> {
|
||||
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
|
||||
mMove2CurrentLocation.setOnClickListener( view -> {
|
||||
// // todo 测试动画
|
||||
// if(!toggle) {
|
||||
// TopViewAnimHelper.getInstance().showNaviView();
|
||||
@@ -246,105 +249,120 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// }
|
||||
// 原始逻辑
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if (location != null) {
|
||||
if (!mMogoStatusManager.isV2XShow()) {
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.setLockZoom(16);
|
||||
mMApUIController.changeZoom(16.0f);
|
||||
if ( location != null ) {
|
||||
if ( !mMogoStatusManager.isV2XShow() ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.setLockZoom( 16 );
|
||||
mMApUIController.changeZoom( 16.0f );
|
||||
}
|
||||
if (mStatusManager.isDisplayOverview()) {
|
||||
mMogoStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
if ( mStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
}
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
// mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel );
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
if (rootView != null) {
|
||||
TopViewAnimHelper.getInstance().init(rootView);
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
mMove2CurrentLocation.setOnLongClickListener( view -> {
|
||||
mApis.getSearchManagerApi().goSettings();
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
|
||||
mExitNavi.setOnClickListener(view -> {
|
||||
if (mMogoNavi != null) {
|
||||
if (mIsLock) {
|
||||
new WMDialog.Builder(getContext())
|
||||
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
|
||||
// mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel );
|
||||
ConstraintLayout rootView = findViewById( R.id.module_entrance_id_top_motion_layout );
|
||||
if ( rootView != null ) {
|
||||
TopViewAnimHelper.getInstance().init( rootView );
|
||||
}
|
||||
|
||||
mExitNavi = findViewById( R.id.module_entrance_id_exit_navi );
|
||||
mExitNavi.setOnClickListener( view -> {
|
||||
if ( mMogoNavi != null ) {
|
||||
if ( mIsLock ) {
|
||||
new WMDialog.Builder( getContext() )
|
||||
.setOkButton( R.string.module_commons_button_ok, ( dlg, which ) -> {
|
||||
dlg.dismiss();
|
||||
mMogoNavi.stopNavi();
|
||||
})
|
||||
.setCancelButton(R.string.module_commons_button_cancel,
|
||||
(dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
})
|
||||
.setContent(R.string.module_commons_exit_navi_content)
|
||||
} )
|
||||
.setCancelButton( R.string.module_commons_button_cancel,
|
||||
( dlg, which ) -> {
|
||||
dlg.dismiss();
|
||||
} )
|
||||
.setContent( R.string.module_commons_exit_navi_content )
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.NAVI );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mCameraMode = findViewById(R.id.module_ext_id_north);
|
||||
mCameraMode.setOnClickListener(view -> {
|
||||
if (mCameraMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
mCameraMode = findViewById( R.id.module_ext_id_north );
|
||||
mCameraMode.setOnClickListener( view -> {
|
||||
if ( mCameraMode.isSelected() ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
mCameraMode.setSelected(!mCameraMode.isSelected());
|
||||
mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
|
||||
R.string.mode_north_up));
|
||||
});
|
||||
mCameraMode.setSelected( !mCameraMode.isSelected() );
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up :
|
||||
R.string.mode_north_up ) );
|
||||
} );
|
||||
|
||||
|
||||
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV,
|
||||
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV,
|
||||
new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
int key_type = intent.getIntExtra("KEY_TYPE", 0);
|
||||
int type = intent.getIntExtra("EXTRA_TYPE", -1);
|
||||
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
|
||||
if (key_type == 10027) {
|
||||
if (opera_type == 0) {
|
||||
mCameraMode.setSelected(false);
|
||||
} else if (opera_type == 1) {
|
||||
mCameraMode.setSelected(true);
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( opera_type == 0 ) {
|
||||
mCameraMode.setSelected( false );
|
||||
} else if ( opera_type == 1 ) {
|
||||
mCameraMode.setSelected( true );
|
||||
}
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ?
|
||||
R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
}
|
||||
mCameraMode.setText(getString(mCameraMode.isSelected() ?
|
||||
R.string.mode_car_up : R.string.mode_north_up));
|
||||
}
|
||||
}
|
||||
});
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
|
||||
findViewById(R.id.module_entrance_id_button1));
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
|
||||
findViewById(R.id.module_entrance_id_button2));
|
||||
} );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1,
|
||||
findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2,
|
||||
findViewById( R.id.module_entrance_id_button2 ) );
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_left_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_top_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_right_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_bottom_margin)
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_top_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_bottom_margin )
|
||||
);
|
||||
|
||||
mNaviInfo = new NaviInfoView();
|
||||
mNaviInfo.inflate(rootView);
|
||||
mNaviInfo.inflate( rootView );
|
||||
|
||||
findViewById( R.id.module_map_id_navi_bg ).setOnClickListener( view -> {
|
||||
try {
|
||||
LaunchUtils.launchByPkg( getContext(), "com.autonavi.amapauto" );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public void showShareDialog() {
|
||||
isClickShare = true;
|
||||
mApis.getShareManager().showShareDialog();
|
||||
traceData("1");
|
||||
traceData( "1" );
|
||||
}
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
@@ -357,27 +375,27 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mService = mApis.getMapServiceApi();
|
||||
mMogoRegisterCenter = mApis.getRegisterCenterApi();
|
||||
mMApUIController = mService.getMapUIController();
|
||||
mMogoLocationClient = mService.getSingletonLocationClient(getContext());
|
||||
mMogoNavi = mService.getNavi(getContext());
|
||||
mMogoLocationClient = mService.getSingletonLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener(TAG, this);
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener( TAG, this );
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager(getContext());
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
|
||||
mMogoStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
|
||||
mMogoStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW,
|
||||
this);
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.DISPLAY_OVERVIEW,
|
||||
this );
|
||||
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController( mMApUIController );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,154 +405,150 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
if (naviinfo == null) {
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
if ( naviinfo == null ) {
|
||||
return;
|
||||
}
|
||||
if (mExitNavi.getVisibility() == View.GONE) {
|
||||
// 避免先导航,后启动app导致无法显示控件
|
||||
onStartNavi();
|
||||
}
|
||||
mNaviInfo.notifyChanged(naviinfo);
|
||||
mNaviInfo.notifyChanged( naviinfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
TopViewAnimHelper.getInstance().showNaviView();
|
||||
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
|
||||
EnumMapUI.CarUp_2D);
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
|
||||
mMApUIController.changeMapMode( mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
|
||||
EnumMapUI.CarUp_2D );
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay( mMApUIController, Scene.NAVI, 500
|
||||
, () -> {
|
||||
return !mMogoNavi.isNaviing();
|
||||
});
|
||||
if (CustomNaviInterrupter.getInstance().interrupt()) {
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
mExitNavi.setVisibility(View.GONE);
|
||||
return !mMogoNavi.isNaviing();
|
||||
} );
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
mDisplayOverview.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
} else {
|
||||
mExitNavi.setVisibility(View.VISIBLE);
|
||||
mDisplayOverview.setVisibility(View.VISIBLE);
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mDisplayOverview.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
}
|
||||
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
|
||||
mApis.getAnalyticsApi().track( "Navigation_begin", new HashMap<>() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
TopViewAnimHelper.getInstance().hideNaviView();
|
||||
mExitNavi.setVisibility(View.GONE);
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
mDisplayOverview.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.AIMLESS );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2(MogoTraffic traffic) {
|
||||
if (traffic == null) {
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
if ( traffic == null ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
public void onLockMap( boolean isLock ) {
|
||||
mIsLock = isLock;
|
||||
if (isLock) {
|
||||
mExitNavi.setText(R.string.module_ext_str_exit_navi);
|
||||
if (mMogoStatusManager.isDisplayOverview()) {
|
||||
mMogoStatusManager.setDisplayOverview(TAG, false);
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
if ( mMogoStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
}
|
||||
} else {
|
||||
mExitNavi.setText(R.string.module_ext_str_continue_navi);
|
||||
mExitNavi.setText( R.string.module_ext_str_continue_navi );
|
||||
}
|
||||
}
|
||||
|
||||
private void traceData(String from) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("from", from);
|
||||
mAnalytics.track("Launcher_Share_Click", properties);
|
||||
private void traceData( String from ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "from", from );
|
||||
mAnalytics.track( "v2x_share_click", properties );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (mUploadRoadCondition == null) {
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( mUploadRoadCondition == null ) {
|
||||
return;
|
||||
}
|
||||
if (descriptor == StatusDescriptor.UPLOADING) {
|
||||
if (isTrue) {
|
||||
mUploading.setVisibility(View.VISIBLE);
|
||||
mUpload.setVisibility(View.GONE);
|
||||
if (mUploadFrameAnimHandler != null) {
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_STOP_ANIM);
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_FRAME_ANIM);
|
||||
if ( descriptor == StatusDescriptor.UPLOADING ) {
|
||||
if ( isTrue ) {
|
||||
mUploading.setVisibility( View.VISIBLE );
|
||||
mUpload.setVisibility( View.GONE );
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
}
|
||||
doFrameAnimOnUploadButton();
|
||||
} else {
|
||||
mCurrentUploadFrame = 0;
|
||||
if (mUploadFrameAnimHandler != null) {
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_FRAME_ANIM);
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
}
|
||||
mUploading.setVisibility(View.GONE);
|
||||
mUpload.setVisibility(View.VISIBLE);
|
||||
mUploading.setVisibility( View.GONE );
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
|
||||
if (!mMogoNavi.isNaviing()) {
|
||||
} else if ( descriptor == StatusDescriptor.DISPLAY_OVERVIEW ) {
|
||||
if ( !mMogoNavi.isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
if (isTrue) {
|
||||
mDisplayOverviewText.setText("退出全览");
|
||||
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize));
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
if ( isTrue ) {
|
||||
mDisplayOverviewText.setText( "退出全览" );
|
||||
mDisplayOverviewText.setTextSize( TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize( R.dimen.module_ext_display_overview_textSize ) );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
} else {
|
||||
mDisplayOverviewText.setText("全览");
|
||||
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize_large));
|
||||
if (CustomNaviInterrupter.getInstance().interrupt()) {
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
mDisplayOverviewText.setText( "全览" );
|
||||
mDisplayOverviewText.setTextSize( TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize( R.dimen.module_ext_display_overview_textSize_large ) );
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
} else {
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doFrameAnimOnUploadButton() {
|
||||
if (mUploadFrameAnimHandler == null) {
|
||||
mUploadFrameAnimHandler = new Handler(Looper.getMainLooper()) {
|
||||
if ( mUploadFrameAnimHandler == null ) {
|
||||
mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_FRAME_ANIM) {
|
||||
if (mUploadingFrameRes == null || mUploadingFrameRes.length == 0) {
|
||||
if (mUploading != null) {
|
||||
mUploading.setVisibility(View.GONE);
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_FRAME_ANIM ) {
|
||||
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
|
||||
if ( mUploading != null ) {
|
||||
mUploading.setVisibility( View.GONE );
|
||||
}
|
||||
if (mUpload != null) {
|
||||
mUpload.setVisibility(View.VISIBLE);
|
||||
if ( mUpload != null ) {
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!mMogoStatusManager.isUploading()) {
|
||||
if ( !mMogoStatusManager.isUploading() ) {
|
||||
mCurrentUploadFrame = 0;
|
||||
return;
|
||||
}
|
||||
if (mUploading != null) {
|
||||
if (mCurrentUploadFrame == mUploadingFrameRes.length) {
|
||||
if ( mUploading != null ) {
|
||||
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
|
||||
mCurrentUploadFrame = 12;
|
||||
}
|
||||
mUploading.setImageResource(mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length]);
|
||||
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed(MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME);
|
||||
} else if (msg.what == MSG_STOP_ANIM) {
|
||||
mStatusManager.setUploadingStatus(TAG, false);
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME );
|
||||
} else if ( msg.what == MSG_STOP_ANIM ) {
|
||||
mStatusManager.setUploadingStatus( TAG, false );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessage(MSG_FRAME_ANIM);
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
// 30s 后无论成功与否,停止动画
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed(MSG_STOP_ANIM, 30_000);
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,11 @@ public class TopViewAnimHelper {
|
||||
|
||||
public void startTopInAnim(View view, ViewGroup.LayoutParams params,
|
||||
IMogoTopViewStatusListener statusListener) {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d(TAG, "startTopInAnim=====" + isTopViewOut);
|
||||
if (view == null) {
|
||||
throw new IllegalArgumentException("method addTopView params view is null");
|
||||
@@ -284,6 +289,11 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
public void startTopOutAnim(View view) {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "startTopOutAnim=====");
|
||||
if (!isTopViewOut && viewCaches.contains(view)) {
|
||||
if (topContainer.getChildCount() > 1) {
|
||||
@@ -379,6 +389,11 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
public void showNaviView() {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "showNaviView=====");
|
||||
setNaviVisibility(View.VISIBLE);
|
||||
int scene = 0;
|
||||
@@ -446,6 +461,11 @@ public class TopViewAnimHelper {
|
||||
}
|
||||
|
||||
public void hideNaviView() {
|
||||
|
||||
if ( topMotionLayout == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.d("TopViewAnimHelper", "hideNaviView=====");
|
||||
setNaviVisibility(View.GONE);
|
||||
remainDistanceGroup.setVisibility(View.GONE);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.gps.simulator;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
@@ -17,6 +18,7 @@ import org.java_websocket.handshake.ServerHandshake;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@@ -101,6 +103,18 @@ public class WebSocketManager {
|
||||
realTimeLocationVo.getDirection(),
|
||||
realTimeLocationVo.getLocationTime()
|
||||
);
|
||||
Iterator< IMogoLocationListener > listeners = mServiceApis.getRegisterCenterApi().getLocationListeners();
|
||||
MogoLocation location = new MogoLocation();
|
||||
location.setLatitude( realTimeLocationVo.getLat() );
|
||||
location.setLongitude( realTimeLocationVo.getLon() );
|
||||
location.setSpeed( realTimeLocationVo.getVehicleSpeed() );
|
||||
location.setAccuracy( 1 );
|
||||
location.setTime( realTimeLocationVo.getLocationTime() );
|
||||
if ( listeners != null ) {
|
||||
while ( listeners.hasNext() ) {
|
||||
listeners.next().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.tanluupload
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
package="com.mogo.module.main">
|
||||
|
||||
<application>
|
||||
|
||||
<service
|
||||
android:name=".service.MogoMainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.mogo.launcher.action.MAIN_SERVICE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -157,6 +157,7 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location latLng ) {
|
||||
|
||||
Iterator< IMogoCarLocationChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getCarLocationChangedListener();
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
@@ -370,7 +371,6 @@ public class EventDispatchCenter implements
|
||||
public void onStartNavi() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
|
||||
if ( iterator == null ) {
|
||||
return;
|
||||
}
|
||||
@@ -447,6 +447,7 @@ public class EventDispatchCenter implements
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
if ( iterator == null ) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.main.cards.MogoModulesHandler;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.main.windowview.FloatingViewHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -35,6 +36,9 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,7 +57,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected IMogoServiceApis mServiceApis;
|
||||
protected IMogoMapService mMogoMapService;
|
||||
protected IMogoMapUIController mMogoMapUIController;
|
||||
protected MogoModulesHandler mMogoModuleHandler;
|
||||
protected IMogoFragmentManager mMogoFragmentManager;
|
||||
protected IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
@@ -64,11 +67,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected FrameLayout mCoverUpLayout;
|
||||
protected View mLeftShadowFrame;
|
||||
|
||||
/**
|
||||
* 主模块管控定位,可以向各个模块发送统一定位信息
|
||||
*/
|
||||
private IMogoLocationClient mLocationClient;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
@@ -118,20 +116,20 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
}
|
||||
mMogoStatusManager = mServiceApis.getStatusManagerApi();
|
||||
AutopilotServiceManage.getInstance().init( getContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadModules() {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
mMogoModuleHandler = new MogoModulesManager( this, getApis() );
|
||||
MogoModulesManager.getInstance().init( this, getApis() );
|
||||
mMogoMapService = mServiceApis.getMapServiceApi();
|
||||
if ( mMogoMapService != null ) {
|
||||
mMogoMapService.getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() );
|
||||
mMogoMapService.getHostListenerRegister().registerHostNaviListener( EventDispatchCenter.getInstance() );
|
||||
mMogoMapService.getHostListenerRegister().registerHostAimlessModeListener( EventDispatchCenter.getInstance() );
|
||||
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
|
||||
mMogoMapService.getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
|
||||
}
|
||||
|
||||
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
|
||||
@@ -139,19 +137,17 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
|
||||
addModule();
|
||||
loadContainerModules();
|
||||
mMogoModuleHandler.loadModules();
|
||||
MogoModulesManager.getInstance().loadModules();
|
||||
mPresenter.delayOperations();
|
||||
mPresenter.initADAS();
|
||||
hideCoverUpLayout();
|
||||
|
||||
// 右移地图中心点
|
||||
mMogoMapUIController = mMogoMapService.getMapUIController();
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMogoMapUIController, Scene.AIMLESS );
|
||||
|
||||
// 开启定位
|
||||
startLocation();
|
||||
// 启动一些基本的服务:定位等
|
||||
startBaseService();
|
||||
} );
|
||||
mMogoModuleHandler.loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container );
|
||||
|
||||
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
|
||||
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
|
||||
@@ -166,22 +162,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
private void startBaseService() {
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
startService( intent );
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模块
|
||||
*/
|
||||
protected void addModule(){
|
||||
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
}
|
||||
protected void addModule() {
|
||||
|
||||
private void startLocation() {
|
||||
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
}
|
||||
|
||||
protected void loadContainerModules() {
|
||||
mMogoModuleHandler.loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
mMogoModuleHandler.loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
|
||||
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +188,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void loadCardModules() {
|
||||
|
||||
List< IMogoModuleProvider > providers = mMogoModuleHandler.loadCardsModule();
|
||||
List< IMogoModuleProvider > providers = MogoModulesManager.getInstance().loadCardsModule();
|
||||
// mCardModulesAdapter = new CardModulesAdapter( this, providers );
|
||||
// mCardsContainer.setOffscreenPageLimit( providers.size() );
|
||||
// mCardsContainer.setPageTransformer( true, mTransformer );
|
||||
@@ -214,16 +209,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
EventDispatchCenter.getInstance().onMarkerClicked( marker );
|
||||
if ( !mMogoStatusManager.isADASShow() ) {
|
||||
switch2Card( marker.getOwner(), false );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switch2Card( String cardType, boolean lockCar ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -243,13 +231,14 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if ( mMogoFragmentManager.getStackSize() == 0 ) {
|
||||
if(DebugConfig.isLauncher()) {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
if ( mMogoFragmentManager != null ) {
|
||||
if ( mMogoFragmentManager != null
|
||||
&& mMogoFragmentManager.getStackSize() > 0 ) {
|
||||
mMogoFragmentManager.pop();
|
||||
}
|
||||
}
|
||||
@@ -271,18 +260,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
mLocationClient.destroy();
|
||||
}
|
||||
mLocationClient = null;
|
||||
if ( mMogoModuleHandler != null ) {
|
||||
mMogoModuleHandler.destroy();
|
||||
}
|
||||
mMogoModuleHandler = null;
|
||||
mMogoMapService = null;
|
||||
mMogoMapUIController = null;
|
||||
mMogoFragmentManager = null;
|
||||
mServiceApis.getAdasControllerApi().release();
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.main.livedata.CardSwitchLiveData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -28,9 +29,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class MainPresenter extends Presenter< MainView > {
|
||||
|
||||
// 埋点接口
|
||||
private IMogoAnalytics mAnalytics;
|
||||
|
||||
private Handler mMsgHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
@@ -57,13 +55,6 @@ public class MainPresenter extends Presenter< MainView > {
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CardSwitchLiveData.getInstance().observeForever( cardInfo -> {
|
||||
if ( TextUtils.isEmpty( cardInfo.mCardName ) ) {
|
||||
return;
|
||||
}
|
||||
mView.switch2Card( cardInfo.mCardName, cardInfo.mLockCar );
|
||||
} );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,13 +11,6 @@ import com.mogo.service.IMogoServiceApis;
|
||||
*/
|
||||
public interface MainView extends IView {
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
*
|
||||
* @param cardType
|
||||
*/
|
||||
void switch2Card( String cardType, boolean lockCar );
|
||||
|
||||
/**
|
||||
* 加载卡片
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,10 @@ public interface MogoModulesHandler {
|
||||
void loadEntrancesModule( int containerId );
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
* 加载基本服务模块,需要不启动页面就能运行
|
||||
* <p>
|
||||
* 1. v2x
|
||||
* 2. mogo-module-service
|
||||
*/
|
||||
void destroy();
|
||||
void loadBaseModule();
|
||||
}
|
||||
|
||||
@@ -35,8 +35,27 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
private Map< MogoModule, IMogoModuleProvider > mModuleProviders = new HashMap<>();
|
||||
// 空间换效率
|
||||
private Map< String, IMogoModuleProvider > mModuleNameProviders = 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 MogoModulesManager( MainActivity activity, IMogoServiceApis apis ) {
|
||||
public void init( MainActivity activity, IMogoServiceApis apis ) {
|
||||
if ( activity == null ) {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
}
|
||||
@@ -111,6 +130,18 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
addFragment( provider, containerId );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBaseModule() {
|
||||
List<MogoModule> baseModules = MogoModulePaths.getBaseModules();
|
||||
for ( MogoModule baseModule : baseModules ) {
|
||||
if ( baseModule == null ) {
|
||||
continue;
|
||||
}
|
||||
Logger.d( TAG, "加载基本模块:%s", baseModule.getPath() );
|
||||
load( baseModule.getPath() );
|
||||
}
|
||||
}
|
||||
|
||||
private IMogoModuleProvider load( String path ) {
|
||||
return ( IMogoModuleProvider ) ARouter.getInstance().build( path ).navigation( getContext() );
|
||||
}
|
||||
@@ -129,13 +160,4 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
.add( containerId, fragment, provider.getModuleName() )
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mActivity = null;
|
||||
if ( mModuleProviders != null ) {
|
||||
mModuleProviders.clear();
|
||||
}
|
||||
mModuleProviders = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
@@ -57,6 +60,11 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener( moduleName, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
return MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener( moduleName );
|
||||
|
||||
@@ -158,6 +158,7 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
return mNavi.values().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
return mLocation.values().iterator();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.mogo.module.main.service;
|
||||
|
||||
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.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.main.EventDispatchCenter;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId ) {
|
||||
Logger.d( TAG, "基本服务启动" );
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
initAndStartLocation();
|
||||
initGpsSimulatorListener();
|
||||
loadBaseModules();
|
||||
startTanluService();
|
||||
initADAS();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d( TAG, "开始定位" );
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
}
|
||||
|
||||
private void initGpsSimulatorListener() {
|
||||
mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d( TAG, "加载基本模块" );
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
private void startTanluService() {
|
||||
MainService.Companion.launchService( getApplicationContext(), "0" );
|
||||
}
|
||||
|
||||
private void initADAS() {
|
||||
mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ dependencies {
|
||||
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")
|
||||
@@ -61,6 +62,7 @@ dependencies {
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-gps-simulator')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -60,6 +61,7 @@ public class MarkerServiceHandler {
|
||||
private static IMogoLauncher sLauncher;
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
private static MapMarkerManager sMapMarkerManager;
|
||||
|
||||
@@ -87,6 +89,8 @@ public class MarkerServiceHandler {
|
||||
|
||||
sMapMarkerManager = MapMarkerManager.getInstance();
|
||||
sMapMarkerManager.init( context );
|
||||
|
||||
sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class );
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis(){
|
||||
@@ -169,6 +173,9 @@ public class MarkerServiceHandler {
|
||||
return sCarChatting;
|
||||
}
|
||||
|
||||
public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
return sGpsSimulatorManager;
|
||||
}
|
||||
|
||||
//TODO -------------以下方法是临时过度使用的,后面统一使用,getMapMarkerManager进行调用
|
||||
|
||||
|
||||
@@ -312,6 +312,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION, this );
|
||||
mIntentManager.registerIntentListener( ServiceConst.COMMAND_BACK, this );
|
||||
|
||||
mADASController = MarkerServiceHandler.getADASController();
|
||||
mLauncher = MarkerServiceHandler.getLauncher();
|
||||
@@ -566,8 +567,8 @@ public class MogoServices implements IMogoMapListener,
|
||||
return false;
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
Logger.d( TAG, "move distance = %s, factor = %s", distance, factor );
|
||||
return distance > factor / 2;
|
||||
Logger.d( TAG, "move distance = %s, factor = %s", distance, ( factor / 2 ) );
|
||||
return distance > ( factor / 2 );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
return false;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ServiceConst {
|
||||
/**
|
||||
* 所有卡片显示的每类点的最大数据量
|
||||
*/
|
||||
public static final int MAX_AMOUNT_ALL = 5;
|
||||
public static final int MAX_AMOUNT_ALL = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 单个卡片显示时的最大数据量
|
||||
@@ -193,5 +193,8 @@ public class ServiceConst {
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION = "com.zhidao.nearby.friend.bylocation";
|
||||
|
||||
|
||||
/**
|
||||
* 返回桌面
|
||||
*/
|
||||
public static final String COMMAND_BACK = "com.ileja.launcher.back";
|
||||
}
|
||||
|
||||
@@ -5,10 +5,15 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
@@ -17,24 +22,26 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class AppOperationIntentHandler implements IntentHandler {
|
||||
|
||||
public final Map< String, String > sAppPackages = new HashMap<>();
|
||||
|
||||
public AppOperationIntentHandler() {
|
||||
sAppPackages.put( "车聊聊", "com.zhidao.imdemo" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
try {
|
||||
JSONObject object = new JSONObject( intent.getStringExtra( "data" ) );
|
||||
String app = object.optString( "object" );
|
||||
String operation = object.optString( "operation" );
|
||||
if ( TextUtils.equals( app, "车聊聊" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_CARS_CHATTING );
|
||||
}
|
||||
} else {
|
||||
if ( TextUtils.equals( app, "探路" ) ) {
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
SwitchCardIntentHandler.switchCard2( context, ServiceConst.CARD_TYPE_ROAD_CONDITION );
|
||||
}
|
||||
if ( TextUtils.equals( "打开", operation ) ) {
|
||||
try {
|
||||
LaunchUtils.launchByPkg( context, sAppPackages.get( app ) );
|
||||
} catch ( Exception e ) {
|
||||
TipToast.shortTip( "应用程序未安装" );
|
||||
}
|
||||
}
|
||||
} catch ( JSONException e ) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class IntentHandlerFactory {
|
||||
mHandlers.put( MogoReceiver.ACTION_ADAS_STATUS, ADASStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTIION_ADAS, ADASStatusIntentHandler.getInstance() );
|
||||
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
|
||||
mHandlers.put( ServiceConst.COMMAND_BACK, WholeVoiceCommandIntentHandler.getInstance() );
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
|
||||
@@ -70,7 +70,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
button1.setVisibility( View.VISIBLE );
|
||||
button1.setBackgroundColor( Color.RED );
|
||||
button1.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "测试" );
|
||||
} );
|
||||
}
|
||||
break;
|
||||
@@ -276,11 +275,17 @@ public class MockIntentHandler implements IntentHandler {
|
||||
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, options );
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( mogoLatLngs.get( 0 ) );
|
||||
WorkThreadHandler.getInstance().post( ()->{
|
||||
WorkThreadHandler.getInstance().post( () -> {
|
||||
marker.startSmooth( mogoLatLngs, duration );
|
||||
} );
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
MarkerServiceHandler.getGpsSimulatorManager().open();
|
||||
break;
|
||||
case 16:
|
||||
MarkerServiceHandler.getGpsSimulatorManager().close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.service.intent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/11
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class WholeVoiceCommandIntentHandler implements IntentHandler {
|
||||
|
||||
private static volatile WholeVoiceCommandIntentHandler sInstance;
|
||||
|
||||
private WholeVoiceCommandIntentHandler() {
|
||||
}
|
||||
|
||||
public static WholeVoiceCommandIntentHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( WholeVoiceCommandIntentHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new WholeVoiceCommandIntentHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle( Context context, Intent intent ) {
|
||||
String command = intent.getStringExtra( MogoReceiver.PARAM_COMMAND );
|
||||
if ( TextUtils.isEmpty( command ) ) {
|
||||
return;
|
||||
}
|
||||
switch ( command ) {
|
||||
case ServiceConst.COMMAND_BACK:
|
||||
MarkerServiceHandler.getLauncher().backToLauncher( context );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_living_light );
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2_light );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} );
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
trackData( mLastDataResult );
|
||||
|
||||
// 在首页时才埋点
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
|
||||
trackData( mLastDataResult );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -716,7 +720,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
};
|
||||
|
||||
public void stopAutoRefresh(){
|
||||
public void stopAutoRefresh() {
|
||||
UiThreadHandler.removeCallbacks( runnable );
|
||||
}
|
||||
|
||||
@@ -747,7 +751,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return;
|
||||
}
|
||||
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, limit, radius, new RefreshCallback() {
|
||||
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, new RefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess( Object o ) {
|
||||
MarkerResponse data = ( MarkerResponse ) o;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
default:
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news );
|
||||
ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
@@ -30,6 +31,8 @@ import io.reactivex.schedulers.Schedulers;
|
||||
*/
|
||||
public class RefreshModel {
|
||||
|
||||
private static final String TAG = "RefreshModel";
|
||||
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
|
||||
@@ -69,7 +72,12 @@ public class RefreshModel {
|
||||
refreshBody.dataType.add( ServiceConst.CARD_TYPE_SHARE_MUSIC );
|
||||
// refreshBody.dataType.add(ServiceConst.CARD_TYPE_USER_DATA);
|
||||
refreshBody.dataType.add( ServiceConst.CARD_TYPE_NOVELTY );
|
||||
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
|
||||
|
||||
String data = GsonUtil.jsonFromObject( refreshBody );
|
||||
query.put( "data", data );
|
||||
Logger.d( TAG, data );
|
||||
|
||||
|
||||
mRefreshApiService.refreshData( query )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
|
||||
@@ -11,7 +11,7 @@ public class ShareConstants {
|
||||
/**
|
||||
* 分享分类
|
||||
*/
|
||||
public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
|
||||
public static final String LAUNCHER_SHARE_TYPE = "v2x_share_type";
|
||||
/**
|
||||
* 分享/上报按钮点击
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user