This commit is contained in:
wangcongtao
2020-06-11 14:51:04 +08:00
parent 7408cb93b1
commit c2c67756b0
16 changed files with 124 additions and 45 deletions

View File

@@ -105,7 +105,7 @@ public class AbsMogoApplication extends Application {
Analytics.getInstance().setAppKey( "6bbe7e0e1ecd8e2f8dc336e1678a2791" );
// 0 - debug 近实时上报积累一条埋点上报或者积累3秒上报一次。
// 2 - 本地缓存聚合上报积累30条埋点上报或者积累60秒上报一次。
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 2 : 2 );
AnalyticsConfig.getInstance( sApp ).setMode( DebugConfig.isDebug() ? 0 : 2 );
AnalyticsConfig.getInstance( sApp ).shouldLog( DebugConfig.isDebug() );
Devices.checkBindState();

View File

@@ -29,10 +29,7 @@ public class MainLauncherActivity extends MainActivity {
@Override
protected void addModule() {
super.addModule();
// F 车机添加返回桌面浮窗
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
MogoModulePaths.addModule( new MogoModule( BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME ) );
}
MogoModulePaths.addModule( new MogoModule( BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME ) );
}
@Override

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -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();
}
}
}

View File

@@ -263,7 +263,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoMapService = null;
mMogoMapUIController = null;
mMogoFragmentManager = null;
AutopilotServiceManage.getInstance().release();
mServiceApis.getAdasControllerApi().release();
AIAssist.getInstance( this ).release();
}
}

View File

@@ -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;

View File

@@ -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";
}

View File

@@ -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();
}
}

View File

@@ -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 {

View File

@@ -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;
}
}
}

View File

@@ -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;

View File

@@ -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() )

View File

@@ -44,4 +44,6 @@ public interface IMogoADASController extends IProvider {
* @param open
*/
void setUseAlgorithm( boolean open );
void release();
}

View File

@@ -49,6 +49,8 @@ public class MogoADASController implements IMogoADASController {
private IMogoStatusManager mStatusManager = SingletonsHolder.get( IMogoStatusManager.class );
private boolean mIsReleased = true;
@Override
public void openADAS() {
showADAS();
@@ -66,8 +68,9 @@ public class MogoADASController implements IMogoADASController {
@Override
public void showADAS() {
Logger.d( TAG, Log.getStackTraceString( new Throwable( ) ) );
if ( !isProcessRunning( AbsMogoApplication.getApp(), getPackageUid( AbsMogoApplication.getApp(), "com.zhidiao.autopilot" ) ) ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
if ( !isProcessRunning( AbsMogoApplication.getApp(), getPackageUid( AbsMogoApplication.getApp(), "com.zhidiao.autopilot" ) )
|| mIsReleased ) {
init( AbsMogoApplication.getApp() );
}
@@ -133,6 +136,7 @@ public class MogoADASController implements IMogoADASController {
@Override
public void init( Context context ) {
AutopilotServiceManage.getInstance().init( context );
mIsReleased = false;
}
//获取已安装应用的 uid-1 表示未安装此应用或程序异常
@@ -178,4 +182,10 @@ public class MogoADASController implements IMogoADASController {
public void setUseAlgorithm( boolean open ) {
AutopilotServiceManage.getInstance().setUseAlgorithm( open );
}
@Override
public void release() {
mIsReleased = true;
AutopilotServiceManage.getInstance().release();
}
}