rm online car module

This commit is contained in:
wangcongtao
2020-06-08 09:45:33 +08:00
parent 62728c227e
commit d6a65d0ca8
22 changed files with 698 additions and 281 deletions

View File

@@ -148,28 +148,6 @@ def generateVersionCode() {
}
}
configurations {
f8xxLauncherQaDebugImplementation
f8xxLauncherDemoDebugImplementation
f8xxLauncherOnlineDebugImplementation
e8xxLauncherQaDebugImplementation
e8xxLauncherDemoDebugImplementation
e8xxLauncherOnlineDebugImplementation
d8xxIndependentQaDebugImplementation
d8xxIndependentDemoDebugImplementation
d8xxIndependentOnlineDebugImplementation
f8xxLauncherQaReleaseImplementation
f8xxLauncherDemoReleaseImplementation
f8xxLauncherOnlineReleaseImplementation
e8xxLauncherQaReleaseImplementation
e8xxLauncherDemoReleaseImplementation
e8xxLauncherOnlineReleaseImplementation
d8xxIndependentQaReleaseImplementation
d8xxIndependentDemoReleaseImplementation
d8xxIndependentOnlineReleaseImplementation
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
@@ -182,8 +160,6 @@ dependencies {
testImplementation rootProject.ext.dependencies.leakcanary
releaseImplementation rootProject.ext.dependencies.leakcanarynoop
// implementation rootProject.ext.dependencies.moduledemo
// implementation rootProject.ext.dependencies.moduledemo2
implementation rootProject.ext.dependencies.carcallprovider
implementation rootProject.ext.dependencies.carcall
implementation rootProject.ext.dependencies.guideshowprovider
@@ -194,7 +170,6 @@ dependencies {
}
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'
@@ -206,7 +181,6 @@ dependencies {
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.modulesearch
implementation rootProject.ext.dependencies.mogomoduleback
implementation rootProject.ext.dependencies.mogomoduleguide
implementation rootProject.ext.dependencies.mogomoduleauth
debugImplementation rootProject.ext.dependencies.gpssimulatordebug
@@ -219,7 +193,6 @@ dependencies {
implementation project(':foudations:mogo-commons')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-search')
implementation project(':modules:mogo-module-back')
implementation project(':modules:mogo-module-guide')
implementation project(':modules:mogo-module-authorize')
debugImplementation project(':modules:mogo-module-gps-simulator-debug')

107
app/libs/t.txt Normal file
View File

@@ -0,0 +1,107 @@
mogoLatLngs.add( new MogoLatLng(39.615986, 116.396716));
mogoLatLngs.add( new MogoLatLng(39.616007, 116.396995));
mogoLatLngs.add( new MogoLatLng(39.616012, 116.397169));
mogoLatLngs.add( new MogoLatLng(39.616017, 116.397343));
mogoLatLngs.add( new MogoLatLng(39.616022, 116.397517));
mogoLatLngs.add( new MogoLatLng(39.616029, 116.397693));
mogoLatLngs.add( new MogoLatLng(39.616039, 116.397896));
mogoLatLngs.add( new MogoLatLng(39.616051, 116.3981));
mogoLatLngs.add( new MogoLatLng(39.616058, 116.39827));
mogoLatLngs.add( new MogoLatLng(39.616066, 116.398441));
mogoLatLngs.add( new MogoLatLng(39.616074, 116.398612));
mogoLatLngs.add( new MogoLatLng(39.616083, 116.398787));
mogoLatLngs.add( new MogoLatLng(39.616093, 116.39899));
mogoLatLngs.add( new MogoLatLng(39.616105, 116.399195));
mogoLatLngs.add( new MogoLatLng(39.616112, 116.399334));
mogoLatLngs.add( new MogoLatLng(39.61612, 116.399473));
mogoLatLngs.add( new MogoLatLng(39.616128, 116.399612));
mogoLatLngs.add( new MogoLatLng(39.616136, 116.399751));
mogoLatLngs.add( new MogoLatLng(39.616148, 116.399893));
mogoLatLngs.add( new MogoLatLng(39.616153, 116.40008));
mogoLatLngs.add( new MogoLatLng(39.616159, 116.400301));
mogoLatLngs.add( new MogoLatLng(39.616167, 116.400471));
mogoLatLngs.add( new MogoLatLng(39.616175, 116.400642));
mogoLatLngs.add( new MogoLatLng(39.616183, 116.400813));
mogoLatLngs.add( new MogoLatLng(39.616192, 116.400988));
mogoLatLngs.add( new MogoLatLng(39.616201, 116.401191));
mogoLatLngs.add( new MogoLatLng(39.616213, 116.401396));
mogoLatLngs.add( new MogoLatLng(39.616235, 116.401728));
mogoLatLngs.add( new MogoLatLng(39.616246, 116.401986));
mogoLatLngs.add( new MogoLatLng(39.61625, 116.402146));
mogoLatLngs.add( new MogoLatLng(39.616255, 116.402307));
mogoLatLngs.add( new MogoLatLng(39.61626, 116.402468));
mogoLatLngs.add( new MogoLatLng(39.616267, 116.40263));
mogoLatLngs.add( new MogoLatLng(39.616272, 116.402762));
mogoLatLngs.add( new MogoLatLng(39.616277, 116.402894));
mogoLatLngs.add( new MogoLatLng(39.616282, 116.403026));
mogoLatLngs.add( new MogoLatLng(39.616287, 116.403158));
mogoLatLngs.add( new MogoLatLng(39.616292, 116.40329));
mogoLatLngs.add( new MogoLatLng(39.616297, 116.403422));
mogoLatLngs.add( new MogoLatLng(39.616302, 116.403554));
mogoLatLngs.add( new MogoLatLng(39.616307, 116.403686));
mogoLatLngs.add( new MogoLatLng(39.616321, 116.403821));
mogoLatLngs.add( new MogoLatLng(39.616331, 116.404045));
mogoLatLngs.add( new MogoLatLng(39.616343, 116.404272));
mogoLatLngs.add( new MogoLatLng(39.616353, 116.404551));
mogoLatLngs.add( new MogoLatLng(39.616363, 116.404753));
mogoLatLngs.add( new MogoLatLng(39.616375, 116.404958));
mogoLatLngs.add( new MogoLatLng(39.616375, 116.405055));
mogoLatLngs.add( new MogoLatLng(39.616379, 116.405184));
mogoLatLngs.add( new MogoLatLng(39.616384, 116.405313));
mogoLatLngs.add( new MogoLatLng(39.616389, 116.405442));
mogoLatLngs.add( new MogoLatLng(39.616394, 116.405571));
mogoLatLngs.add( new MogoLatLng(39.616399, 116.4057));
mogoLatLngs.add( new MogoLatLng(39.616404, 116.405829));
mogoLatLngs.add( new MogoLatLng(39.616409, 116.405958));
mogoLatLngs.add( new MogoLatLng(39.616414, 116.406087));
mogoLatLngs.add( new MogoLatLng(39.616419, 116.406216));
mogoLatLngs.add( new MogoLatLng(39.616424, 116.406345));
mogoLatLngs.add( new MogoLatLng(39.616429, 116.406474));
mogoLatLngs.add( new MogoLatLng(39.61644, 116.406611));
mogoLatLngs.add( new MogoLatLng(39.616461, 116.406879));
mogoLatLngs.add( new MogoLatLng(39.616465, 116.407033));
mogoLatLngs.add( new MogoLatLng(39.616469, 116.407187));
mogoLatLngs.add( new MogoLatLng(39.616473, 116.407341));
mogoLatLngs.add( new MogoLatLng(39.616477, 116.407495));
mogoLatLngs.add( new MogoLatLng(39.616483, 116.407694));
mogoLatLngs.add( new MogoLatLng(39.616493, 116.407876));
mogoLatLngs.add( new MogoLatLng(39.616504, 116.408059));
mogoLatLngs.add( new MogoLatLng(39.616515, 116.408327));
mogoLatLngs.add( new MogoLatLng(39.616526, 116.408596));
mogoLatLngs.add( new MogoLatLng(39.616536, 116.408757));
mogoLatLngs.add( new MogoLatLng(39.616547, 116.409025));
mogoLatLngs.add( new MogoLatLng(39.616556, 116.409227));
mogoLatLngs.add( new MogoLatLng(39.616568, 116.409432));
mogoLatLngs.add( new MogoLatLng(39.616579, 116.409711));
mogoLatLngs.add( new MogoLatLng(39.61659, 116.409914));
mogoLatLngs.add( new MogoLatLng(39.616601, 116.410119));
mogoLatLngs.add( new MogoLatLng(39.616601, 116.410387));
mogoLatLngs.add( new MogoLatLng(39.616601, 116.410602));
mogoLatLngs.add( new MogoLatLng(39.616622, 116.410816));
mogoLatLngs.add( new MogoLatLng(39.616633, 116.411084));
mogoLatLngs.add( new MogoLatLng(39.616643, 116.411395));
mogoLatLngs.add( new MogoLatLng(39.616654, 116.411492));
mogoLatLngs.add( new MogoLatLng(39.616665, 116.411771));
mogoLatLngs.add( new MogoLatLng(39.616674, 116.411974));
mogoLatLngs.add( new MogoLatLng(39.616686, 116.412178));
mogoLatLngs.add( new MogoLatLng(39.616697, 116.412447));
mogoLatLngs.add( new MogoLatLng(39.616697, 116.412586));
mogoLatLngs.add( new MogoLatLng(39.616718, 116.412876));
mogoLatLngs.add( new MogoLatLng(39.616729, 116.413144));
mogoLatLngs.add( new MogoLatLng(39.616738, 116.413347));
mogoLatLngs.add( new MogoLatLng(39.61675, 116.413551));
mogoLatLngs.add( new MogoLatLng(39.61675, 116.41383));
mogoLatLngs.add( new MogoLatLng(39.616761, 116.414002));
mogoLatLngs.add( new MogoLatLng(39.616761, 116.414098));
mogoLatLngs.add( new MogoLatLng(39.616767, 116.414279));
mogoLatLngs.add( new MogoLatLng(39.616774, 116.414461));
mogoLatLngs.add( new MogoLatLng(39.616782, 116.414645));
mogoLatLngs.add( new MogoLatLng(39.616792, 116.41483));
mogoLatLngs.add( new MogoLatLng(39.616802, 116.415016));
mogoLatLngs.add( new MogoLatLng(39.616814, 116.415203));
mogoLatLngs.add( new MogoLatLng(39.616824, 116.415395));
mogoLatLngs.add( new MogoLatLng(39.616836, 116.415589));
mogoLatLngs.add( new MogoLatLng(39.616842, 116.415745));
mogoLatLngs.add( new MogoLatLng(39.616849, 116.415902));
mogoLatLngs.add( new MogoLatLng(39.616857, 116.416061));
mogoLatLngs.add( new MogoLatLng(39.616868, 116.416307));

View File

@@ -14,15 +14,15 @@
android:supportsRtl="true"
android:theme="@style/AppTheme.App"
tools:replace="android:label">
<!-- <provider-->
<!-- android:name="com.mogo.module.navi.cp.AddressContentProvider"-->
<!-- android:authorities="com.zhidao.auto.personal.provider"-->
<!-- android:enabled="true"-->
<!-- android:exported="true" />-->
<provider
android:name="com.mogo.module.navi.cp.AddressContentProvider"
android:authorities="com.zhidao.auto.personal.provider"
android:enabled="true"
android:exported="true" />
<meta-data
tools:replace="android:value"
android:name="com.amap.api.v2.apikey"
android:value="40e2e7e773c7562b1f2b13699a93992c" />
android:value="40e2e7e773c7562b1f2b13699a93992c"
tools:replace="android:value" />
<!-- 高德地图 -->
</application>

View File

@@ -11,16 +11,13 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.adcard.AdCardConstants;
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
import com.mogo.module.back.BackToLauncherConst;
import com.mogo.module.carchatting.card.CallChatConstant;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.onlinecar.OnLineCarConstants;
import com.mogo.module.push.PushUIConstants;
import com.mogo.module.tanlu.constant.TanluConstants;
import com.mogo.module.v2x.V2XConst;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.utils.logger.LogLevel;
import com.mogo.utils.logger.Logger;
@@ -56,11 +53,9 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE));
MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME));
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, OnLineCarConstants.MODULE_NAME));
// MogoModulePaths.addModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI));
MogoModulePaths.addModule(new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI));
MogoModulePaths.addModule(new MogoModule(PushUIConstants.TAG, PushUIConstants.TAG));
MogoModulePaths.addModule(new MogoModule(BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME));
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );

View File

@@ -13,12 +13,12 @@ public interface IMogoGeoSearchListener {
*
* @param regeocodeResult
*/
void onRegeocodeSearched( MogoRegeocodeResult regeocodeResult );
default void onRegeocodeSearched( MogoRegeocodeResult regeocodeResult ){}
/**
* 根据名称和城市获取地理位置信息
*
* @param geocodeResult
*/
void onGeocodeSearched( MogoGeocodeResult geocodeResult );
default void onGeocodeSearched( MogoGeocodeResult geocodeResult ){}
}

View File

@@ -5,6 +5,10 @@ import android.view.View;
import androidx.annotation.Nullable;
import com.mogo.module.back.BackToLauncherConst;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.module.extensions.utils.ExtensionsConfig;
import com.mogo.module.main.MainActivity;
import com.mogo.utils.logger.Logger;
@@ -18,7 +22,16 @@ public class MainLauncherActivity extends MainActivity {
@Override
protected void onCreate( @Nullable Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
ExtensionsConfig.setNeedRequestUserInfo(true);
ExtensionsConfig.setNeedRequestUserInfo( true );
}
@Override
protected void addModule() {
super.addModule();
// F 车机添加返回桌面浮窗
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
MogoModulePaths.addModule( new MogoModule( BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME ) );
}
}
@Override

View File

@@ -2,10 +2,12 @@ package com.mogo.module.apps.applaunch;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
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;
/**
* @author congtaowang
@@ -25,7 +27,15 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
public void launch( Context context, AppInfo appInfo ) {
switch ( appInfo.getPackageName() ) {
case "com.mogo.launcher.navi.search":
AppServiceHandler.getApis().getSearchManagerApi().showSearch();
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 );
} else {
AppServiceHandler.getApis().getSearchManagerApi().showSearch();
}
break;
case "com.mogo.launcher.applist":
AppsListActivity.start( mActivity );

View File

@@ -1,73 +0,0 @@
package com.mogo.module.extensions.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.module.extensions.R;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.map.IMogoMapService;
import com.mogo.utils.logger.Logger;
/**
* @author lixiaopeng
* @description 通用分享dialog
* @since 2020-01-10
*/
public class NaviNoticeDialog extends Dialog implements View.OnClickListener {
private TextView txtOk;
private Context mContext;
private View tvCancel;
private IMogoMapService mMogoMapService;
public NaviNoticeDialog(@NonNull Context context) {
super(context, R.style.Theme_AppCompat_Dialog);
this.mContext = context;
mMogoMapService = (IMogoMapService) ARouter.getInstance()
.build(MogoServicePaths.PATH_SERVICES_MAP)
.navigation(getContext());
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}
public NaviNoticeDialog(@NonNull Context context, int themeResId) {
super(context, R.style.Theme_AppCompat_Dialog);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
initListener();
}
private void initView() {
setContentView(R.layout.dialog_navi_notice);
txtOk = findViewById(R.id.tv_dialog_ok);
tvCancel = findViewById(R.id.tv_dialog_cancel);
}
private void initListener() {
txtOk.setOnClickListener(this);
tvCancel.setOnClickListener(this);
}
@Override
public void onClick(View view) {
int id = view.getId();
if (id == R.id.tv_dialog_ok) {
mMogoMapService.getNavi(getContext()).stopNavi();
} else if (id == R.id.tv_dialog_cancel) {
}
dismiss();
}
}

View File

@@ -51,6 +51,7 @@ dependencies {
api rootProject.ext.dependencies.moduleapps
api rootProject.ext.dependencies.mogoconnection
api rootProject.ext.dependencies.moduleextensions
api rootProject.ext.dependencies.mogomoduleback
} else {
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
@@ -62,6 +63,7 @@ dependencies {
api project(':modules:mogo-module-apps')
api project(':foudations:mogo-connection')
api project(':modules:mogo-module-extensions')
api project(':modules:mogo-module-back')
}
}

View File

@@ -123,8 +123,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
mMogoModuleHandler = new MogoModulesManager( this, getApis() );
mMogoMapService = mServiceApis.getMapServiceApi();
if ( mMogoMapService != null ) {
@@ -138,6 +136,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
// 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。
addModule();
loadContainerModules();
mMogoModuleHandler.loadModules();
mPresenter.delayOperations();
@@ -166,6 +165,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
}
/**
* 添加模块
*/
protected void addModule(){
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
}
private void startLocation() {
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
mLocationClient.addLocationListener( this );

View File

@@ -1,9 +1,12 @@
package com.mogo.module.navi.manager;
import android.content.Context;
import android.content.Intent;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.module.navi.constants.SearchApisHolder;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoSearchManager;

View File

@@ -23,13 +23,11 @@ import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoCongestionInfo;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -235,7 +233,6 @@ public class MogoServices implements IMogoMapListener,
mLoopRequest = false;
// 用户手动操作地图刷新成功后,设置状态为 true引发延时策略
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
}
@Override
@@ -316,6 +313,11 @@ public class MogoServices implements IMogoMapListener,
mIntentManager.registerIntentListener( ServiceConst.COMMAND_OPERATION, this );
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_READY, this );
mIntentManager.registerIntentListener( MogoReceiver.ACTION_MOCK, this );
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE, this );
mIntentManager.registerIntentListener( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE, this );
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 );
mADASController = MarkerServiceHandler.getADASController();
mLauncher = MarkerServiceHandler.getLauncher();
@@ -756,94 +758,16 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onIntentReceived( String command, Intent intent ) {
if ( MogoReceiver.ACTIION_ADAS.equals( command ) ) {
if ( intent == null ) {
return;
}
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
mStatusManager.setADASUIShow( ServiceConst.TYPE, status == 1 );
} else if ( Intent.ACTION_POWER_CONNECTED.equals( command ) ) {
mStatusManager.setAccStatus( ServiceConst.TYPE, true );
Logger.d( TAG, "acc status: %s", true );
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( command ) ) {
mStatusManager.setAccStatus( ServiceConst.TYPE, false );
Logger.d( TAG, "acc status: %s", false );
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( command ) ) {
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
Logger.d( TAG, "acc status: %s", state == 1 );
mStatusManager.setAccStatus( ServiceConst.TYPE, state == 1 );
} else if ( MogoReceiver.ACTION_VOICE_UI.equals( command ) ) {
String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS );
if ( TextUtils.equals( val, MogoReceiver.VALUE_DISMISS ) ) {
mStatusManager.setVoiceUIShow( TAG, false );
} else if ( TextUtils.equals( val, MogoReceiver.VALUE_SHOW ) ) {
mStatusManager.setVoiceUIShow( TAG, true );
}
} else if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
if ( ServiceConst.COMMAND_NEXT.equals( command ) ) {
onActionDone( MogoAction.Next );
} else if ( ServiceConst.COMMAND_PREVIOUS.equals( command ) ) {
onActionDone( MogoAction.Prev );
} else if ( ServiceConst.COMMAND_SWITCH_CARD.equals( command ) ) {
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
} else if ( MogoReceiver.ACTION_ADAS_STATUS.equals( command ) ) {
String msg = intent.getStringExtra( "adasMsg" );
if ( TextUtils.isEmpty( msg ) ) {
return;
}
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
if ( stateInfo != null ) {
changeCarHeadstockDirection( stateInfo.getValues().getHeading() );
// changeMyLocation( stateInfo.getValues() );
}
} else if ( ServiceConst.COMMAND_OPERATION.equals( command ) ) {
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
} else if ( MogoReceiver.ACTION_VOICE_READY.equals( command ) ) {
AIAssist.getInstance( mContext ).flush();
mStatusManager.setAIAssistReady( TAG, true );
} else if ( ServiceConst.COMMAND_MY_LOCATION.equals( command ) ) {
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
} else if ( MogoReceiver.ACTION_MOCK.equals( command ) ) {
} else {
IntentHandlerFactory.getInstance().handle( mContext, command, intent );
}
}
private void changeCarHeadstockDirection( final double degree ) {
if ( mNavi.isNaviing() ) {
return;
}
if ( mStatusManager.isSearchUIShow() ) {
return;
}
if ( !mStatusManager.isMainPageOnResume() ) {
return;
}
if ( mStatusManager.isSeekHelping() ) {
return;
}
if ( mUiController.getCurrentUiMode() != EnumMapUI.NorthUP_2D ) {
return;
}
UiThreadHandler.post( () -> {
mUiController.showMyLocation( inflateCursorView( degree ) );
} );
}
private View inflateCursorView( double degree ) {
View view = View.inflate( mContext, R.layout.map_amap_cursor, null );
view.setRotation( ( float ) degree );
return view;
}
private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) {
if ( valuesBean == null ) {
return;
}
Location location = new Location( LocationManager.GPS_PROVIDER );
location.setAltitude( valuesBean.getAlt() );
location.setLatitude( valuesBean.getLat() );
location.setLongitude( valuesBean.getLon() );
}
/**
* 注册桌面免唤醒指令
*/

View File

@@ -159,4 +159,39 @@ public class ServiceConst {
public static final String[] CMD_BACK_WORDS = new String[]{"关闭", "返回"};
/**
* 查询附近的人
* "data"="{"op":"查询","location":"附近","obj":"人"}"
*/
public static final String COMMAND_ZHIDAO_NEARBY_CAR_ONLINE = "com.zhidao.nearby.car.online";
/**
* 查询附近的好友
* 搜索当前车机所在位置同城市本人有好友关系
* (如果一期做不了根据车机所在位置同城查询,则根据车机激活城市查询)
* "data"="{"op":"查询","status":"","location":"","obj":"好友"}"
*/
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE = "com.zhidao.nearby.friend.online";
/**
* 查询在线的好友
* "data"="{"op":"查询","status":"在线","obj":"好友"}"
*/
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND = "com.zhidao.nearby.friend";
/**
* 查询在线的人
* <p>
* "data"="{"op":"查询","status":"在线","obj":"车主"}"
*/
public static final String COMMAND_ZHIDAO_NEARBY_USER_ONLINE = "com.zhidao.nearby.user.online";
/**
* 查询指定位置的好友
* <p>
* "data"="{"op":"看看","obj":"好友","location":"中关村"}"
*/
public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION = "com.zhidao.nearby.friend.bylocation";
}

View File

@@ -0,0 +1,106 @@
package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.text.TextUtils;
import android.view.View;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.carinfo.CarStateInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.network.utils.GsonUtil;
public
/**
* @author congtaowang
* @since 2020/6/5
* <p>
* 描述
*/
class ADASStatusIntentHandler implements IntentHandler {
private static volatile ADASStatusIntentHandler sInstance;
private ADASStatusIntentHandler() {
}
public static ADASStatusIntentHandler getInstance() {
if ( sInstance == null ) {
synchronized ( ADASStatusIntentHandler.class ) {
if ( sInstance == null ) {
sInstance = new ADASStatusIntentHandler();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public void handle( Context context, Intent intent ) {
if ( MogoReceiver.ACTIION_ADAS.equals( intent.getAction() ) ) {
if ( intent == null ) {
return;
}
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 );
} else {
String msg = intent.getStringExtra( "adasMsg" );
if ( TextUtils.isEmpty( msg ) ) {
return;
}
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
if ( stateInfo != null ) {
changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
// changeMyLocation( stateInfo.getValues() );
}
}
}
private void changeCarHeadstockDirection( final Context context, final double degree ) {
if ( MarkerServiceHandler.getNavi().isNaviing() ) {
return;
}
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
return;
}
if ( !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) {
return;
}
if ( MarkerServiceHandler.getMogoStatusManager().isSeekHelping() ) {
return;
}
if ( MarkerServiceHandler.getMapUIController().getCurrentUiMode() != EnumMapUI.NorthUP_2D ) {
return;
}
UiThreadHandler.post( () -> {
MarkerServiceHandler.getMapUIController().showMyLocation( inflateCursorView( context, degree ) );
} );
}
private View inflateCursorView( Context context, double degree ) {
View view = View.inflate( context, R.layout.map_amap_cursor, null );
view.setRotation( ( float ) degree );
return view;
}
private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) {
if ( valuesBean == null ) {
return;
}
Location location = new Location( LocationManager.GPS_PROVIDER );
location.setAltitude( valuesBean.getAlt() );
location.setLatitude( valuesBean.getLat() );
location.setLongitude( valuesBean.getLon() );
}
}

View File

@@ -0,0 +1,25 @@
package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.service.MarkerServiceHandler;
public
/**
* @author congtaowang
* @since 2020/6/5
* <p>
* 描述
*/
class AIAssistIntentHandler implements IntentHandler {
private static final String TAG = "AIAssistIntentHandler";
@Override
public void handle( Context context, Intent intent ) {
AIAssist.getInstance( context ).flush();
MarkerServiceHandler.getMogoStatusManager().setAIAssistReady( TAG, true );
}
}

View File

@@ -0,0 +1,56 @@
package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.logger.Logger;
public
/**
* @author congtaowang
* @since 2020/6/5
*
* 描述
*/
class AccStatusIntentHandler implements IntentHandler {
private static final String TAG = "AccStatusIntentHandler";
private static volatile AccStatusIntentHandler sInstance;
private AccStatusIntentHandler(){}
public static AccStatusIntentHandler getInstance(){
if( sInstance == null ){
synchronized( AccStatusIntentHandler.class ) {
if( sInstance == null ){
sInstance = new AccStatusIntentHandler();
}
}
}
return sInstance;
}
public synchronized void release(){
sInstance = null;
}
@Override
public void handle( Context context, Intent intent ) {
String action = intent.getAction();
if ( Intent.ACTION_POWER_CONNECTED.equals( action ) ) {
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, true );
Logger.d( TAG, "acc status: %s", true );
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( action ) ) {
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, false );
Logger.d( TAG, "acc status: %s", false );
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( action ) ) {
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
Logger.d( TAG, "acc status: %s", state == 1 );
MarkerServiceHandler.getMogoStatusManager().setAccStatus( ServiceConst.TYPE, state == 1 );
}
}
}

View File

@@ -23,6 +23,18 @@ public class IntentHandlerFactory {
mHandlers.put( ServiceConst.COMMAND_SWITCH_CARD, new SwitchCardIntentHandler() );
mHandlers.put( ServiceConst.COMMAND_OPERATION, new AppOperationIntentHandler() );
mHandlers.put( ServiceConst.COMMAND_MY_LOCATION, new MyLocationHandler() );
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND, OnlineCarSearchIntentHandler.getInstance() );
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE, OnlineCarSearchIntentHandler.getInstance() );
mHandlers.put( ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION, OnlineCarSearchIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_VOICE_UI, new VoiceUiIntentHandler() );
mHandlers.put( Intent.ACTION_POWER_CONNECTED, AccStatusIntentHandler.getInstance() );
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_ADAS_STATUS, ADASStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTIION_ADAS, ADASStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
}
private static final class InstanceHolder {

View File

@@ -26,6 +26,7 @@ import com.mogo.module.service.MogoServiceProvider;
import com.mogo.module.service.R;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -268,9 +269,16 @@ public class MockIntentHandler implements IntentHandler {
MogoMarkerOptions options = new MogoMarkerOptions();
options.icon( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) )
.position( mogoLatLngs.get( 0 ) )
.owner( TAG )
.autoManager( false );
int duration = intent.getIntExtra( "duration", 30 );
MarkerServiceHandler.getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( duration );
IMogoMarker marker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, options );
marker.startSmooth( mogoLatLngs, intent.getIntExtra( "duration", 30 ) );
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( mogoLatLngs.get( 0 ) );
WorkThreadHandler.getInstance().post( ()->{
marker.startSmooth( mogoLatLngs, duration );
} );
}
break;
}

View File

@@ -0,0 +1,167 @@
package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.search.geo.IMogoGeoSearch;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeAddress;
import com.mogo.map.search.geo.MogoGeocodeResult;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.marker.MapMarkerManager;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;
public
/**
* @author congtaowang
* @since 2020/6/5
* <p>
* 描述
*/
class OnlineCarSearchIntentHandler implements IntentHandler {
private static final String TAG = "OnlineCarSearchIntentHandler";
private static volatile OnlineCarSearchIntentHandler sInstance;
private OnlineCarSearchIntentHandler() {
}
public static OnlineCarSearchIntentHandler getInstance() {
if ( sInstance == null ) {
synchronized ( OnlineCarSearchIntentHandler.class ) {
if ( sInstance == null ) {
sInstance = new OnlineCarSearchIntentHandler();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
@Override
public void handle( Context context, Intent intent ) {
String command = intent.getStringExtra( MogoReceiver.PARAM_COMMAND );
if ( TextUtils.isEmpty( command ) ) {
return;
}
MogoLocation location = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
MogoLatLng target = null;
if ( location != null ) {
target = new MogoLatLng( location.getLatitude(), location.getLongitude() );
}
boolean isFocus = false;
boolean isSameCity = false;
int limit = 50;
int radius = 5_000;
switch ( command ) {
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND:
case ServiceConst.COMMAND_ZHIDAO_NEARBY_USER_ONLINE:
isFocus = true;
isSameCity = true;
case ServiceConst.COMMAND_ZHIDAO_NEARBY_CAR_ONLINE:
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_ONLINE:
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( target );
MapMarkerManager.getInstance().getOnlineCarData(
target,
isFocus,
isSameCity,
limit,
radius );
break;
case ServiceConst.COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION:
handleAreaSearch( intent, context, target );
break;
}
}
private void handleAreaSearch( Intent intent, Context context, MogoLatLng target ) {
String data = intent.getStringExtra( "data" );
if ( TextUtils.isEmpty( data ) ) {
Logger.e( TAG, "语音没有携带数据!!!!!" );
return;
}
String keyword = null;
try {
JSONObject jsonObject = new JSONObject( data );
keyword = jsonObject.get( "location" ).toString();
Logger.d( TAG, "location 查询指定位置的好友 keyword = " + keyword );
} catch ( Exception e ) {
Logger.e( TAG, "语音携带数据异常!!!!!" );
return;
}
if ( TextUtils.isEmpty( keyword ) ) {
Logger.e( TAG, "语音携带数据为空!!!!!" );
return;
}
if ( TextUtils.equals( "附近", keyword ) ) {
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( target );
MapMarkerManager.getInstance().getOnlineCarData(
target,
false,
false,
50,
5_000 );
} else {
String cityCode = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation().getCityCode();
IMogoGeoSearch search = MarkerServiceHandler.getMapService().getGeoSearch( context );
search.setGeoSearchListener( new IMogoGeoSearchListener() {
@Override
public void onGeocodeSearched( MogoGeocodeResult geocodeResult ) {
MogoLatLng target = getGeoTargetAddress( geocodeResult );
if ( target == null ) {
Logger.e( TAG, "geo 检索位置错误" );
return;
}
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( geocodeResult.getAddresses().get( 0 ).getLatlng() );
MapMarkerManager.getInstance().getOnlineCarData(
target,
false,
false,
50,
5_000 );
}
} );
MogoGeocodeQuery mogoGeocodeQuery = new MogoGeocodeQuery();
mogoGeocodeQuery.setCity( cityCode );
mogoGeocodeQuery.setLocationName( keyword );
search.getFromLocationNameAsyn( mogoGeocodeQuery );
}
}
private MogoLatLng getGeoTargetAddress( MogoGeocodeResult geocodeResult ) {
if ( geocodeResult == null
|| geocodeResult.getAddresses() == null
|| geocodeResult.getAddresses().isEmpty() ) {
return null;
}
for ( MogoGeocodeAddress address : geocodeResult.getAddresses() ) {
if ( address == null ) {
continue;
}
if ( address.getLatlng() == null ) {
continue;
}
return address.getLatlng();
}
return null;
}
}

View File

@@ -0,0 +1,30 @@
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.receiver.MogoReceiver;
public
/**
* @author congtaowang
* @since 2020/6/5
*
* 描述
*/
class VoiceUiIntentHandler implements IntentHandler {
private static final String TAG = "VoiceUiIntentHandler";
@Override
public void handle( Context context, Intent intent ) {
String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS );
if ( TextUtils.equals( val, MogoReceiver.VALUE_DISMISS ) ) {
MarkerServiceHandler.getMogoStatusManager().setVoiceUIShow( TAG, false );
} else if ( TextUtils.equals( val, MogoReceiver.VALUE_SHOW ) ) {
MarkerServiceHandler.getMogoStatusManager().setVoiceUIShow( TAG, true );
}
}
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
@@ -621,28 +622,40 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
public void getOnlineCarData( MogoLatLng latlng ) {
mCarLatLng = latlng;
getOnlineCarList();
getOnlineCarData( latlng, false, false, 50, 2_000 );
}
public void getOnlineCarData( MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
int limit,
int radius ) {
UiThreadHandler.removeCallbacks( runnable );
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
getOnlineCarList( latLng, onlyFocus, onlySameCity, limit, radius );
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
getOnlineCarList();
getOnlineCarList( mCarLatLng, false, false, 2_000, 50 );
UiThreadHandler.postDelayed( this, SMOOTH_DURATION * 1000 );
}
};
private void getOnlineCarList() {
private void getOnlineCarList(
MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
int limit,
int radius ) {
if ( ignoreOnlineCarRequest() ) {
removeCarMarkers();
return;
}
mRefreshModel.queryOnLineCarWithRoute( mCarLatLng, false, false, new RefreshCallback() {
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, limit, radius, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
MarkerResponse data = ( MarkerResponse ) o;

View File

@@ -38,14 +38,14 @@ public class RefreshModel {
private final Context mContext;
private RefreshApiService mRefreshApiService;
public RefreshModel(Context context) {
public RefreshModel( Context context ) {
this.mContext = context;
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
this.mRefreshApiService = network.create(RefreshApiService.class, getNetHost());
IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context );
this.mRefreshApiService = network.create( RefreshApiService.class, getNetHost() );
}
public static String getNetHost() {
switch (DebugConfig.getNetMode()) {
switch ( DebugConfig.getNetMode() ) {
case DebugConfig.NET_MODE_DEV:
return HOST_DEV;
case DebugConfig.NET_MODE_QA:
@@ -57,47 +57,47 @@ public class RefreshModel {
}
}
public void refreshData(MogoLatLng latLng, int radius, int limit, final RefreshCallback callback) {
if (mRefreshApiService != null) {
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
public void refreshData( MogoLatLng latLng, int radius, int limit, final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.limit = limit;
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lng);
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.radius = radius;
refreshBody.dataType.add(ServiceConst.CARD_TYPE_CARS_CHATTING);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_SHARE_MUSIC);
refreshBody.dataType.add( ServiceConst.CARD_TYPE_CARS_CHATTING );
refreshBody.dataType.add( ServiceConst.CARD_TYPE_ROAD_CONDITION );
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));
mRefreshApiService.refreshData(query)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
refreshBody.dataType.add( ServiceConst.CARD_TYPE_NOVELTY );
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
mRefreshApiService.refreshData( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess(o);
public void onSuccess( BaseData o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError( Throwable e ) {
super.onError( e );
if (callback != null) {
if ( callback != null ) {
callback.onFail();
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
if (callback != null) {
public void onError( String message, int code ) {
super.onError( message, code );
if ( callback != null ) {
callback.onFail();
}
}
});
} );
}
}
@@ -110,42 +110,42 @@ public class RefreshModel {
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
*/
public void queryOnLineCar(MogoLatLng latLng,
int radius,
boolean onlyFocus,
boolean onlySameCity,
final RefreshCallback callback) {
if (mRefreshApiService != null) {
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
public void queryOnLineCar( MogoLatLng latLng,
int radius,
boolean onlyFocus,
boolean onlySameCity,
final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.limit = 100;
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lng);
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.radius = radius;
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
refreshBody.dataType.add(ServiceConst.CARD_TYPE_USER_DATA);
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
query.put("data", GsonUtil.jsonFromObject(refreshBody));
mRefreshApiService.refreshData(query)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
mRefreshApiService.refreshData( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess(o);
public void onSuccess( BaseData o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
if (callback != null) {
public void onError( String message, int code ) {
super.onError( message, code );
if ( callback != null ) {
callback.onFail();
}
}
});
} );
}
}
@@ -153,47 +153,52 @@ public class RefreshModel {
/**
* 查询车辆 及路线
*
* @param latLng 经纬度
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param latLng 经纬度
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
*/
public void queryOnLineCarWithRoute(MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
final RefreshCallback callback){
if (mRefreshApiService != null) {
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
public void queryOnLineCarWithRoute( MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
int radius,
int limit,
final RefreshCallback callback ) {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.sn = Utils.getSn();
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lng);
if ( limit > 0 ) {
refreshBody.limit = limit;
}
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
refreshBody.dataType.add( ServiceConst.CARD_TYPE_USER_DATA );
query.put("data", GsonUtil.jsonFromObject(refreshBody));
mRefreshApiService.queryOnLineCarWithRoute(query)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)){
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );
mRefreshApiService.queryOnLineCarWithRoute( query )
.subscribeOn( Schedulers.io() )
.observeOn( AndroidSchedulers.mainThread() )
.subscribe( new SubscribeImpl< MarkerResponse >( RequestOptions.create( mContext ) ) {
@Override
public void onSuccess(MarkerResponse o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess(o);
public void onSuccess( MarkerResponse o ) {
super.onSuccess( o );
if ( callback != null ) {
callback.onSuccess( o );
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
if (callback != null) {
public void onError( String message, int code ) {
super.onError( message, code );
if ( callback != null ) {
callback.onFail();
}
}
});
} );
}
}
}