opt
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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() )
|
||||
|
||||
Reference in New Issue
Block a user