diff --git a/app/build.gradle b/app/build.gradle
index d6878216d1..1b929b16dc 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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')
diff --git a/app/libs/t.txt b/app/libs/t.txt
new file mode 100644
index 0000000000..39e7f60219
--- /dev/null
+++ b/app/libs/t.txt
@@ -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));
\ No newline at end of file
diff --git a/app/src/launcher/AndroidManifest.xml b/app/src/launcher/AndroidManifest.xml
index 51bd368bf2..034c96f343 100644
--- a/app/src/launcher/AndroidManifest.xml
+++ b/app/src/launcher/AndroidManifest.xml
@@ -14,15 +14,15 @@
android:supportsRtl="true"
android:theme="@style/AppTheme.App"
tools:replace="android:label">
-
-
-
-
-
+
+ * "data"="{"op":"查询","status":"在线","obj":"车主"}" + */ + public static final String COMMAND_ZHIDAO_NEARBY_USER_ONLINE = "com.zhidao.nearby.user.online"; + + /** + * 查询指定位置的好友 + *
+ * "data"="{"op":"看看","obj":"好友","location":"中关村"}" + */ + public static final String COMMAND_ZHIDAO_NEARBY_FRIEND_BYLOCATION = "com.zhidao.nearby.friend.bylocation"; + + } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java new file mode 100644 index 0000000000..aa5c6c8161 --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java @@ -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 + *
+ * 描述 + */ +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() ); + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AIAssistIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AIAssistIntentHandler.java new file mode 100644 index 0000000000..b7e22acdaa --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AIAssistIntentHandler.java @@ -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 + *
+ * 描述 + */ +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 ); + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java new file mode 100644 index 0000000000..b9f14e92da --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/AccStatusIntentHandler.java @@ -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 ); + } + } +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java index fbba17c7b6..7e79d98584 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/IntentHandlerFactory.java @@ -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 { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index 7bee8a08a0..e836349303 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -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; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarSearchIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarSearchIntentHandler.java new file mode 100644 index 0000000000..e20915bd3b --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/OnlineCarSearchIntentHandler.java @@ -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 + *
+ * 描述
+ */
+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;
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/VoiceUiIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/VoiceUiIntentHandler.java
new file mode 100644
index 0000000000..f8aea1e8b7
--- /dev/null
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/VoiceUiIntentHandler.java
@@ -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 );
+ }
+ }
+}
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
index a8cd717cde..e695e6470d 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java
@@ -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;
diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
index 2800efd440..3c1bfcd220 100644
--- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
+++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java
@@ -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