opt
This commit is contained in:
@@ -492,7 +492,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng ) {
|
||||
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
Logger.d( TAG, "move to center %s", latLng );
|
||||
if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
|
||||
Logger.e( TAG, "latlng = null or is illegal" );
|
||||
@@ -502,7 +502,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
loseLockMode();
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
if ( animate ) {
|
||||
mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
} else {
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -85,9 +85,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng);
|
||||
mClient.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,14 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng );
|
||||
default void moveToCenter( MogoLatLng latLng ){
|
||||
moveToCenter(latLng, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng, boolean animate );
|
||||
|
||||
/**
|
||||
* 显示我的位置
|
||||
|
||||
@@ -79,9 +79,9 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.moveToCenter(latLng);
|
||||
mDelegate.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,8 @@ public class CardAppLauncher extends BaseAppLauncher {
|
||||
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
if ( sCardApps.containsKey( appInfo.getPackageName() ) ) {
|
||||
mCardManager.switch2( sCardApps.get( appInfo.getPackageName() ) );
|
||||
mAppsPresenter.exit();
|
||||
} else {
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.module.apps.AppServiceHandler;
|
||||
import com.mogo.module.apps.R;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
public class GuideShowLauncher extends BaseAppLauncher {
|
||||
|
||||
@@ -25,19 +18,7 @@ public class GuideShowLauncher extends BaseAppLauncher {
|
||||
|
||||
@Override
|
||||
public void launch(Context context, AppInfo appInfo) {
|
||||
if (appInfo != null && APP_INFO_NAME_GUIDE_SHOW.equals(appInfo.getName())) {
|
||||
if ( mNavi != null && !mNavi.isNaviing()) {
|
||||
AppServiceHandler.getMogoGuideShow().playGuideVideo((Activity) context, (s) -> {
|
||||
Logger.d(TAG, s);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
} else {
|
||||
AIAssist.getInstance(context).speakTTSVoice(context.getString(R.string.module_apps_str_guide_warning));
|
||||
processChain(context,appInfo);
|
||||
}
|
||||
} else {
|
||||
processChain(context, appInfo);
|
||||
}
|
||||
processChain(context, appInfo);
|
||||
}
|
||||
|
||||
private void processChain(Context context, AppInfo appInfo) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BackToMainHomeManager {
|
||||
|
||||
public static void backToLauncher() {
|
||||
|
||||
if ( mFragmentManager != null ) {
|
||||
if ( !mStatusManager.isSearchUIShow() ) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
@@ -59,6 +60,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
private IMogoRegisterCenter mRegisterCenter;
|
||||
private IMogoLauncher mLauncher;
|
||||
private IMogoSearchManager mMogoSearchManager;
|
||||
private IMogoSettingManager mSettingManager;
|
||||
private Rect mDisplayOverviewBounds;
|
||||
|
||||
public MapPresenter( MapView view ) {
|
||||
@@ -305,6 +307,7 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mRegisterCenter.registerMogoNaviListener( TAG, this );
|
||||
mLauncher = apis.getLauncherApi();
|
||||
mMogoSearchManager = apis.getSearchManagerApi();
|
||||
mSettingManager = apis.getSettingManagerApi();
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
@@ -442,12 +445,12 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE_UN_WAKEUP:
|
||||
mSearchManager.speakDraft();
|
||||
mSettingManager.speakDraft();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE:
|
||||
case VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE_UN_WAKEUP:
|
||||
mSearchManager.speakDetail();
|
||||
mSettingManager.speakDetail();
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "已切换", null );
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
|
||||
<application>
|
||||
<activity android:name=".ui.NaviActivity"></activity>
|
||||
<provider
|
||||
android:name=".cp.AddressContentProvider"
|
||||
android:authorities="com.zhidao.auto.personal.provider"
|
||||
|
||||
@@ -47,9 +47,9 @@ public class DataConstants {
|
||||
|
||||
// 泛化语义
|
||||
public static final String STRATEGY_THE_TIME_SHORTEST_PATH = "STRATEGY_THE_TIME_SHORTEST_PATH";
|
||||
public static final String[] WORDS_STRATEGY_THE_TIME_SHORTEST_PATH = {"最快的"};
|
||||
public static final String[] WORDS_STRATEGY_THE_TIME_SHORTEST_PATH = {"最快路线"};
|
||||
public static final String STRATEGY_THE_DISTANCE_SHORTEST_PATH = "STRATEGY_THE_DISTANCE_SHORTEST_PATH";
|
||||
public static final String[] WORDS_STRATEGY_THE_DISTANCE_SHORTED_PATH = {"路程最短的"};
|
||||
public static final String[] WORDS_STRATEGY_THE_DISTANCE_SHORTED_PATH = {"最短路线"};
|
||||
|
||||
// 第x个选个
|
||||
public static final String STRATEGY_THE_FIRST_PATH = "STRATEGY_THE_FIRST_PATH";
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.mogo.module.navi.constants;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager;
|
||||
import com.mogo.module.guideshow.provider.IGuideShowProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-05-18
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class SearchApisHolder {
|
||||
|
||||
private static IMogoServiceApis sApis;
|
||||
private static IMogoMapService sMapServiceApis;
|
||||
private static IMogoMapUIController sUiControllerApis;
|
||||
private static IMogoNavi sNaviApis;
|
||||
private static IMogoMarkerManager sMarkerManagerApis;
|
||||
private static IMogoFragmentManager sFragmentManagerApis;
|
||||
private static IMogoAnalytics sAnalyticsApis;
|
||||
private static IMogoLocationClient sLocationClientApis;
|
||||
private static IMogoStatusManager sStatusManager;
|
||||
private static IMogoRegisterCenter sRegisterCenterApis;
|
||||
private static IMogoIntentManager sIntentManager;
|
||||
private static IGuideShowProvider sGuideShowApis;
|
||||
private static IMogoSettingManager sSettingManager;
|
||||
private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
private static IMogoSearchManager sSearchManager;
|
||||
|
||||
static {
|
||||
sApis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
sMapServiceApis = sApis.getMapServiceApi();
|
||||
sUiControllerApis = sMapServiceApis.getMapUIController();
|
||||
sNaviApis = sMapServiceApis.getNavi( AbsMogoApplication.getApp() );
|
||||
sMarkerManagerApis = sMapServiceApis.getMarkerManager( AbsMogoApplication.getApp() );
|
||||
sFragmentManagerApis = sApis.getFragmentManagerApi();
|
||||
sAnalyticsApis = sApis.getAnalyticsApi();
|
||||
sLocationClientApis = sMapServiceApis.getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
sStatusManager = sApis.getStatusManagerApi();
|
||||
sRegisterCenterApis = sApis.getRegisterCenterApi();
|
||||
sIntentManager = sApis.getIntentManagerApi();
|
||||
sSettingManager = sApis.getSettingManagerApi();
|
||||
sSearchManager = sApis.getSearchManagerApi();
|
||||
sGpsSimulatorManager = ARouter.getInstance().navigation( IMogoGpsSimulatorManager.class);
|
||||
sGuideShowApis = ARouter.getInstance().navigation( IGuideShowProvider.class );
|
||||
}
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
return sApis;
|
||||
}
|
||||
|
||||
public static IMogoMapService getMapServiceApis() {
|
||||
return sMapServiceApis;
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getUiControllerApis() {
|
||||
return sUiControllerApis;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviApis() {
|
||||
return sNaviApis;
|
||||
}
|
||||
|
||||
public static IMogoMarkerManager getMarkerManager() {
|
||||
return sMarkerManagerApis;
|
||||
}
|
||||
|
||||
public static IMogoFragmentManager getFragmentManager() {
|
||||
return sFragmentManagerApis;
|
||||
}
|
||||
|
||||
public static IMogoAnalytics getAnalyticsApis() {
|
||||
return sAnalyticsApis;
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClientApis() {
|
||||
return sLocationClientApis;
|
||||
}
|
||||
|
||||
public static IMogoStatusManager getStatusManager() {
|
||||
return sStatusManager;
|
||||
}
|
||||
|
||||
public static IMogoRegisterCenter getRegisterCenterApis() {
|
||||
return sRegisterCenterApis;
|
||||
}
|
||||
|
||||
public static IMogoIntentManager getIntentManager() {
|
||||
return sIntentManager;
|
||||
}
|
||||
|
||||
public static IGuideShowProvider getGuideShowApis() {
|
||||
return sGuideShowApis;
|
||||
}
|
||||
|
||||
public static IMogoSettingManager getSettingManager() {
|
||||
return sSettingManager;
|
||||
}
|
||||
|
||||
public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
return sGpsSimulatorManager;
|
||||
}
|
||||
|
||||
public static IMogoSearchManager getSearchManager() {
|
||||
return sSearchManager;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.mogo.module.navi.constants
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.map.location.IMogoLocationClient
|
||||
import com.mogo.map.marker.IMogoMarkerManager
|
||||
import com.mogo.map.navi.IMogoNavi
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.gps.simulator.GpsSimulatorConstants
|
||||
import com.mogo.module.gps.simulator.IMogoGpsSimulatorManager
|
||||
import com.mogo.module.guideshow.provider.GuideShowProviderConstant
|
||||
import com.mogo.module.guideshow.provider.IGuideShowProvider
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager
|
||||
import com.mogo.service.intent.IMogoIntentManager
|
||||
import com.mogo.service.launcher.IMogoLauncher
|
||||
import com.mogo.service.map.IMogoMapService
|
||||
import com.mogo.service.module.IMogoRegisterCenter
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager
|
||||
|
||||
/**
|
||||
*@author zyz
|
||||
* 2020-01-08.
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object SearchServiceHolder {
|
||||
// 单例对象,要使用Application Context
|
||||
private lateinit var context: Context
|
||||
|
||||
val fragmentManager: IMogoFragmentManager = ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation() as IMogoFragmentManager
|
||||
val mapService: IMogoMapService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation() as IMogoMapService
|
||||
val listenerCenter: IMogoRegisterCenter = ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation() as IMogoRegisterCenter
|
||||
val statusManager: IMogoStatusManager = ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation() as IMogoStatusManager
|
||||
val analyticsManager: IMogoAnalytics = ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation() as IMogoAnalytics
|
||||
val guideShowProvider: IGuideShowProvider = ARouter.getInstance().build(GuideShowProviderConstant.GUIDE_SHOW_PROVIDER).navigation() as IGuideShowProvider
|
||||
val mogoLauncher: IMogoLauncher = ARouter.getInstance().build(MogoServicePaths.PATH_LAUNCHER_API).navigation() as IMogoLauncher
|
||||
val gpsSimulator = ARouter.getInstance().build(GpsSimulatorConstants.API_PATH).navigation() as IMogoGpsSimulatorManager
|
||||
val intentManager = ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation() as IMogoIntentManager
|
||||
val apis = ARouter.getInstance().navigation(IMogoServiceApis::class.java)
|
||||
var geoSearch: IMogoGeoSearch? = null
|
||||
fun init(context: Context) {
|
||||
this.context = context
|
||||
|
||||
}
|
||||
|
||||
fun push(fragment: Fragment, tag: String) {
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(fragment)
|
||||
val build = builder.tag(tag).build()
|
||||
fragmentManager.push(build)
|
||||
}
|
||||
|
||||
fun getNavi(): IMogoNavi {
|
||||
return mapService.getNavi(context)
|
||||
}
|
||||
|
||||
fun getLocationClient(): IMogoLocationClient {
|
||||
return mapService.getLocationClient(context)
|
||||
}
|
||||
|
||||
fun getMapUIController(): IMogoMapUIController {
|
||||
return mapService.mapUIController
|
||||
}
|
||||
|
||||
fun getMarkerManger(): IMogoMarkerManager {
|
||||
return mapService.getMarkerManager(context)
|
||||
}
|
||||
|
||||
fun getGeoSearcher(): IMogoGeoSearch {
|
||||
if (geoSearch == null) {
|
||||
geoSearch = mapService.getGeoSearch(context)
|
||||
}
|
||||
return geoSearch!!
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,15 +2,15 @@ package com.mogo.module.navi.manager
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.dao.SearchPoiDao
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
@@ -47,14 +47,6 @@ object AddressManager {
|
||||
return companyAddress != null
|
||||
}
|
||||
|
||||
private fun choosePoint(type: Int){
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CHOOSE_POINT)
|
||||
val builder = FragmentDescriptor.Builder()
|
||||
builder.fragment(SettingAddressFragment.newInstance(type))
|
||||
val build = builder.tag(AMapConstants.PATH_FRAGMENT_SETTING_HOME).build()
|
||||
SearchServiceHolder.fragmentManager.push(build)
|
||||
}
|
||||
|
||||
private lateinit var context: Context
|
||||
@SuppressLint("CheckResult")
|
||||
fun init(context: Context) {
|
||||
@@ -64,7 +56,7 @@ object AddressManager {
|
||||
poiDao.companyAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
.subscribe { t1, _ ->
|
||||
if (t1.size > 0) {
|
||||
companyAddress = t1[0]
|
||||
}
|
||||
@@ -73,7 +65,7 @@ object AddressManager {
|
||||
poiDao.homeAddress
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { t1, t2 ->
|
||||
.subscribe { t1, _ ->
|
||||
if (t1.size > 0) {
|
||||
homeAddress = t1[0]
|
||||
}
|
||||
@@ -90,7 +82,7 @@ object AddressManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteHome(context: Context) {
|
||||
fun deleteHome() {
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(homeAddress)
|
||||
@@ -105,7 +97,7 @@ object AddressManager {
|
||||
|
||||
}
|
||||
|
||||
fun deleteCompany(context: Context) {
|
||||
fun deleteCompany() {
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(companyAddress)
|
||||
@@ -122,8 +114,6 @@ object AddressManager {
|
||||
* 回家
|
||||
*/
|
||||
fun goHome() {
|
||||
closeADAS()
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
if (homeAddress == null) {
|
||||
choosePoint(DataConstants.TYPE_HOME_ADDRESS)
|
||||
} else {
|
||||
@@ -131,14 +121,18 @@ object AddressManager {
|
||||
}
|
||||
}
|
||||
|
||||
private fun choosePoint(type: Int) {
|
||||
beforePushFragment()
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchApisHolder.getUiControllerApis(), Scene.CHOOSE_POINT)
|
||||
pushFragment(SettingAddressFragment.newInstance(type), AMapConstants.PATH_FRAGMENT_SETTING_HOME, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 去公司
|
||||
*/
|
||||
fun goCompany() {
|
||||
closeADAS()
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
if (companyAddress == null) {
|
||||
choosePoint( DataConstants.TYPE_COMPANY_ADDRESS)
|
||||
choosePoint(DataConstants.TYPE_COMPANY_ADDRESS)
|
||||
} else {
|
||||
calculatePath(EntityConvertUtils.poi2MogoTip(companyAddress).point)
|
||||
}
|
||||
@@ -148,14 +142,8 @@ object AddressManager {
|
||||
* 搜索
|
||||
*/
|
||||
fun goSearch() {
|
||||
closeADAS()
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(TAG, true)
|
||||
SearchServiceHolder.fragmentManager.push(
|
||||
FragmentDescriptor.Builder().fragment(SearchFragment())
|
||||
.tag(AMapConstants.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build()
|
||||
)
|
||||
beforePushFragment()
|
||||
pushFragment(SearchFragment(), AMapConstants.PATH_FRAGMENT_SEARCH, true)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,34 +151,43 @@ object AddressManager {
|
||||
*/
|
||||
fun calculatePath(destination: MogoLatLng?) {
|
||||
destination?.let {
|
||||
closeADAS()
|
||||
var newInstance = ChoosePathFragment.newInstance(destination)
|
||||
SearchServiceHolder.push(newInstance, AMapConstants.PATH_FRAGMENT_CHOOSE_PATH)
|
||||
beforePushFragment()
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchApisHolder.getUiControllerApis(), Scene.CALCULATE_PATH)
|
||||
pushFragment(ChoosePathFragment.newInstance(destination), AMapConstants.PATH_FRAGMENT_CHOOSE_PATH, true)
|
||||
}
|
||||
}
|
||||
|
||||
fun categorySearch(category: String){
|
||||
closeADAS()
|
||||
val searchFragment = CategorySearchFragment.newInstance(category)
|
||||
SearchServiceHolder.fragmentManager.push(FragmentDescriptor.Builder().fragment(searchFragment)
|
||||
.tag(AMapConstants.PATH_FRAGMENT_SEARCH_CATEGORY)
|
||||
.notifyMainModule(true)
|
||||
.build())
|
||||
fun categorySearch(category: String) {
|
||||
beforePushFragment()
|
||||
pushFragment(CategorySearchFragment.newInstance(category), AMapConstants.PATH_FRAGMENT_SEARCH_CATEGORY, true)
|
||||
}
|
||||
|
||||
fun goSettings(){
|
||||
fun goSettings() {
|
||||
beforePushFragment()
|
||||
pushFragment(NaviSettingFragment(), AMapConstants.PATH_FRAGMENT_NAVI_SETTING, true)
|
||||
}
|
||||
|
||||
private fun beforePushFragment() {
|
||||
closeADAS()
|
||||
val naviSettingFragment = NaviSettingFragment()
|
||||
SearchServiceHolder.fragmentManager.push(FragmentDescriptor.Builder().fragment(naviSettingFragment)
|
||||
.tag(AMapConstants.PATH_FRAGMENT_NAVI_SETTING)
|
||||
.notifyMainModule(true)
|
||||
.build())
|
||||
if (!SearchApisHolder.getStatusManager().isSearchUIShow) {
|
||||
SearchApisHolder.getStatusManager().setSearchUIShow(TAG, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun pushFragment(fragment: Fragment, tag: String, notifyMain: Boolean) {
|
||||
SearchApisHolder.getFragmentManager().push(
|
||||
FragmentDescriptor.Builder()
|
||||
.fragment(fragment)
|
||||
.tag(tag)
|
||||
.notifyMainModule(notifyMain)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
private fun closeADAS() {
|
||||
try {
|
||||
SearchServiceHolder.apis.adasControllerApi.closeADAS()
|
||||
SearchApisHolder.getApis().adasControllerApi.closeADAS()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
@@ -2,18 +2,10 @@ package com.mogo.module.navi.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.constants.BroadcastMode;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.constants.AMapConstants;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.ui.search.CategorySearchFragment;
|
||||
import com.mogo.module.navi.ui.search.SearchFragment;
|
||||
import com.mogo.module.navi.constants.SearchApisHolder;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
|
||||
/**
|
||||
@@ -34,24 +26,12 @@ public class MogoSearchManager implements IMogoSearchManager {
|
||||
|
||||
@Override
|
||||
public void showSearch() {
|
||||
if ( SearchApisHolder.getNaviApis().isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
AddressManager.INSTANCE.goSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMain() {
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().clearAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakDraft() {
|
||||
SearchServiceHolder.INSTANCE.getNavi().setBroadcastMode( BroadcastMode.CONCISE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakDetail() {
|
||||
SearchServiceHolder.INSTANCE.getNavi().setBroadcastMode( BroadcastMode.DETAIL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void categorySearch( String keyword ) {
|
||||
AddressManager.INSTANCE.categorySearch( keyword );
|
||||
@@ -70,7 +50,6 @@ public class MogoSearchManager implements IMogoSearchManager {
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
AddressManager.INSTANCE.init( context );
|
||||
SearchServiceHolder.INSTANCE.init( context );
|
||||
SettingManager.INSTANCE.init( context );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.navi.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
@@ -14,23 +14,49 @@ import com.mogo.service.module.IMogoSettingManager;
|
||||
@Route( path = MogoServicePaths.PATH_SETTING_MANAGER )
|
||||
public class MogoSettingManager implements IMogoSettingManager {
|
||||
|
||||
@Override public int getPathPrefer() {
|
||||
@Override
|
||||
public int getPathPrefer() {
|
||||
return SettingManager.INSTANCE.getPathPrefer();
|
||||
}
|
||||
|
||||
@Override public int getVolume() {
|
||||
@Override
|
||||
public int getVolume() {
|
||||
return SettingManager.INSTANCE.getVolume();
|
||||
}
|
||||
|
||||
@Override public int getVoiceStyle() {
|
||||
@Override
|
||||
public int getVoiceStyle() {
|
||||
return SettingManager.INSTANCE.getVoiceStyle();
|
||||
}
|
||||
|
||||
@Override public int getMapType() {
|
||||
@Override
|
||||
public int getMapType() {
|
||||
return SettingManager.INSTANCE.getMapType();
|
||||
}
|
||||
|
||||
@Override public void init(Context context) {
|
||||
SettingManager.INSTANCE.init(context);
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
SettingManager.INSTANCE.init( context );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void speakDraft() {
|
||||
SettingManager.INSTANCE.speakDraft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void speakDetail() {
|
||||
SettingManager.INSTANCE.speakDetail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openAimlessMode() {
|
||||
SettingManager.INSTANCE.openAimlessMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeAimlessMode() {
|
||||
SettingManager.INSTANCE.closeAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.mogo.module.navi.manager
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.map.constants.BroadcastMode
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.service.module.IMogoSettingManager
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ object SettingManager : IMogoSettingManager {
|
||||
}
|
||||
|
||||
private fun updateConfig() {
|
||||
SearchServiceHolder.getNavi()
|
||||
SearchApisHolder.getNaviApis()
|
||||
.naviConfig
|
||||
.cost(cost)
|
||||
.avoidSpeed(avoidSpeed)
|
||||
@@ -195,12 +195,31 @@ object SettingManager : IMogoSettingManager {
|
||||
.congestion(congestion)
|
||||
}
|
||||
|
||||
fun setAimlessMode(type: Int){
|
||||
fun setAimlessMode(type: Int) {
|
||||
settings.edit().putInt(KEY_AIMLESS_MODE_TYPE, type).apply()
|
||||
}
|
||||
|
||||
fun getAimlessMode():Int {
|
||||
fun getAimlessMode(): Int {
|
||||
return settings.getInt(KEY_AIMLESS_MODE_TYPE, R.id.aimlessModeClose)
|
||||
}
|
||||
|
||||
override fun speakDraft() {
|
||||
voiceStyle = R.id.rb_navi_draft
|
||||
SearchApisHolder.getNaviApis().setBroadcastMode(BroadcastMode.CONCISE)
|
||||
}
|
||||
|
||||
override fun speakDetail() {
|
||||
voiceStyle = R.id.rb_navi_detail
|
||||
SearchApisHolder.getNaviApis().setBroadcastMode(BroadcastMode.DETAIL)
|
||||
}
|
||||
|
||||
override fun openAimlessMode() {
|
||||
setAimlessMode(R.id.aimlessModeOpen)
|
||||
SearchApisHolder.getNaviApis().setAimlessModeStatus(true)
|
||||
}
|
||||
|
||||
override fun closeAimlessMode() {
|
||||
setAimlessMode(R.id.aimlessModeClose)
|
||||
SearchApisHolder.getNaviApis().setAimlessModeStatus(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.module.navi.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.ui.base.BaseActivity
|
||||
|
||||
class NaviActivity : BaseActivity() {
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_navi)
|
||||
var fragment = ARouter.getInstance()
|
||||
.build("/navi/search")
|
||||
.navigation() as Fragment
|
||||
supportFragmentManager.beginTransaction().replace(R.id.fl_container,fragment).commitNow()
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,10 +101,6 @@ public abstract class BaseSearchFragment extends BaseFragment implements SearchV
|
||||
return mSearchType;
|
||||
}
|
||||
|
||||
@Override public void startJumpAnimation() {
|
||||
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void renderChoicePointResult( RegeocodeAddress address ) {
|
||||
// if ( address == null ) {
|
||||
|
||||
@@ -1,41 +1,17 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.EditText;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.TextWatcherAdapter;
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import com.mogo.module.navi.constants.DataConstants;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.database.AppDataBase;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import com.mogo.module.navi.constants.SearchApisHolder;
|
||||
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -43,55 +19,50 @@ import java.util.List;
|
||||
* <p>
|
||||
* 搜搜页逻辑处理
|
||||
*/
|
||||
public class CategoryPresenter extends Presenter<CategoryView> {
|
||||
public class CategoryPresenter extends Presenter< CategoryView > {
|
||||
|
||||
private CompositeDisposable mCompositeDisposable;
|
||||
private IMogoMapService mMapService;
|
||||
|
||||
public CategoryPresenter(CategoryView view) {
|
||||
super(view);
|
||||
public CategoryPresenter( CategoryView view ) {
|
||||
super( view );
|
||||
mCompositeDisposable = new CompositeDisposable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
mMapService = (IMogoMapService) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SERVICES_MAP)
|
||||
.navigation(getContext());
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
}
|
||||
|
||||
public void startSearchLocalPoiByInput(String keyword) {
|
||||
MogoPoiSearchQuery mogoInputtipsQuery = new MogoPoiSearchQuery(keyword, keyword);
|
||||
mogoInputtipsQuery.setPageSize(10);
|
||||
mogoInputtipsQuery.setLocation(
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().getWindowCenterLocation());
|
||||
IMogoPoiSearch inputtipsSearch =
|
||||
mMapService.getPoiSearch(getContext(), mogoInputtipsQuery);
|
||||
public void startSearchLocalPoiByInput( String keyword ) {
|
||||
|
||||
inputtipsSearch.setPoiSearchListener(new IMogoPoiSearchListener() {
|
||||
@Override public void onPoiSearched(MogoPoiResult result, int errorCode) {
|
||||
MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery( keyword, keyword );
|
||||
poiSearchQuery.setPageSize( 10 );
|
||||
poiSearchQuery.setLocation( SearchApisHolder.getUiControllerApis().getWindowCenterLocation() );
|
||||
IMogoPoiSearch poiSearch = SearchApisHolder.getMapServiceApis().getPoiSearch( getContext(), poiSearchQuery );
|
||||
|
||||
poiSearch.setPoiSearchListener( new IMogoPoiSearchListener() {
|
||||
@Override
|
||||
public void onPoiSearched( MogoPoiResult result, int errorCode ) {
|
||||
if ( result != null ) {
|
||||
mView.renderSearchPoiResult(result.getPois());
|
||||
mView.renderSearchPoiResult( result.getPois() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
|
||||
@Override
|
||||
public void onPoiItemSearched( MogoPoiItem item, int errorCode ) {
|
||||
|
||||
}
|
||||
});
|
||||
inputtipsSearch.searchPOIAsyn();
|
||||
} );
|
||||
poiSearch.searchPOIAsyn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
if (mCompositeDisposable != null && !mCompositeDisposable.isDisposed()) {
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( mCompositeDisposable != null && !mCompositeDisposable.isDisposed() ) {
|
||||
mCompositeDisposable.dispose();
|
||||
mCompositeDisposable = null;
|
||||
}
|
||||
//CameraChangedLiveData.getInstance().removeAllObserver();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -15,26 +14,16 @@ import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.search.geo.MogoPoiItem
|
||||
import com.mogo.map.search.inputtips.MogoTip
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.ui.adapter.SearchCategoryAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.module.navi.uitls.BitmapUtils
|
||||
import com.mogo.module.navi.uitls.StringUtils
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.cv_search_result
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.et_navi_search
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.iv_navi_back
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.pb_path
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.rv_search_result
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.*
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
@@ -112,7 +101,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
private fun addMarkers() {
|
||||
addMarkers.clear()
|
||||
var marginBounder = resources.getDimensionPixelSize(R.dimen.dp_60) * 2
|
||||
SearchServiceHolder.getMapUIController().showBounds(TAG,
|
||||
SearchApisHolder.getUiControllerApis().showBounds(TAG,
|
||||
null,
|
||||
locationList,
|
||||
Rect(cv_search_result.width + marginBounder, marginBounder, marginBounder, marginBounder),
|
||||
@@ -120,7 +109,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
)
|
||||
|
||||
for (options in arrayList) {
|
||||
var addMarker = SearchServiceHolder.getMarkerManger().addMarker(TAG, options)
|
||||
var addMarker = SearchApisHolder.getMarkerManager().addMarker(TAG, options)
|
||||
addMarker.onMarkerClickListener = this
|
||||
addMarkers.add(addMarker)
|
||||
}
|
||||
@@ -180,7 +169,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
SearchApisHolder.getFragmentManager().pop()
|
||||
}
|
||||
|
||||
tv_navi_navi.setOnClickListener {
|
||||
@@ -210,8 +199,8 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
arrayList.get(mAdapter.lastPosition).icon(getMarkerIcon(mAdapter.lastPosition))
|
||||
arrayList.get(mAdapter.current).icon(getMarkerIcon(mAdapter.current))
|
||||
if (moveToCenter) {
|
||||
SearchServiceHolder.statusManager.setUserInteractionStatus(TAG, true, false)
|
||||
SearchServiceHolder.getMapUIController().moveToCenter(current.position)
|
||||
SearchApisHolder.getStatusManager().setUserInteractionStatus(TAG, true, false)
|
||||
SearchApisHolder.getUiControllerApis().moveToCenter(current.position, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +225,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
super.onDestroyView()
|
||||
mSearchPresenter.onDestroy(viewLifecycleOwner)
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers(TAG)
|
||||
SearchApisHolder.getMarkerManager().removeMarkers(TAG)
|
||||
|
||||
unRegisterVoice()
|
||||
}
|
||||
@@ -253,7 +242,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
|
||||
companion object {
|
||||
fun newInstance(category: String): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CATEGORY_SEARCH)
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchApisHolder.getUiControllerApis(), Scene.CATEGORY_SEARCH)
|
||||
var bundle = Bundle()
|
||||
bundle.putString("category", category)
|
||||
var categorySerachFragment = CategorySearchFragment()
|
||||
|
||||
@@ -11,13 +11,10 @@ import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.map.navi.MogoCalculatePath
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.ui.adapter.CalculatePathAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
@@ -72,7 +69,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
retry()
|
||||
}
|
||||
"cancel" -> {
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
SearchApisHolder.getFragmentManager().clearAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +81,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
override fun onCalculateSuccess() {
|
||||
var calculatedStrategies = SearchServiceHolder.getNavi().calculatedStrategies
|
||||
var calculatedStrategies = SearchApisHolder.getNaviApis().calculatedStrategies
|
||||
if (calculatedStrategies != null && calculatedStrategies.size > 0) {
|
||||
mAdapter.setDatas(calculatedStrategies)
|
||||
mAdapter.selectTag = calculatedStrategies[0].tagId
|
||||
@@ -95,7 +92,9 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
if (calculatedStrategies.isNullOrEmpty()) {
|
||||
return@postDelayed
|
||||
}
|
||||
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(calculatedStrategies[0].tagId)
|
||||
if (SearchApisHolder.getNaviApis().itemClickInteraction != null) {
|
||||
SearchApisHolder.getNaviApis().itemClickInteraction.onItemClicked(calculatedStrategies[0].tagId)
|
||||
}
|
||||
|
||||
if (calculatedStrategies.size == 1) {
|
||||
// 一条路线,自动开启导航
|
||||
@@ -157,16 +156,16 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
SearchApisHolder.getFragmentManager().pop()
|
||||
}
|
||||
|
||||
tv_navi_navi.text = getString(R.string.start_navi)
|
||||
|
||||
et_navi_search.setText(getString(R.string.choose_path))
|
||||
et_navi_search.isEnabled = false
|
||||
SearchServiceHolder.getNavi().naviTo(mogoTip)
|
||||
SearchApisHolder.getNaviApis().naviTo(mogoTip)
|
||||
|
||||
SearchServiceHolder.listenerCenter.registerMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH, this)
|
||||
SearchApisHolder.getRegisterCenterApis().registerMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH, this)
|
||||
|
||||
var arrayList = ArrayList<MogoCalculatePath>()
|
||||
mAdapter = CalculatePathAdapter(activity, arrayList)
|
||||
@@ -181,7 +180,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
}
|
||||
|
||||
SearchServiceHolder.getNavi().setLineClickInteraction {
|
||||
SearchApisHolder.getNaviApis().setLineClickInteraction {
|
||||
mAdapter.selectTag = it
|
||||
}
|
||||
|
||||
@@ -190,7 +189,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
selectPath(item)
|
||||
}
|
||||
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
SearchApisHolder.getMarkerManager().removeMarkers()
|
||||
|
||||
DataConstants.sCmds.entries.filter {
|
||||
it != null && !TextUtils.isEmpty(it.key) && (it.value?.isNotEmpty() ?: false)
|
||||
@@ -198,8 +197,8 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
AIAssist.getInstance(mContext).registerUnWakeupCommand(it.key, it.value, this@ChoosePathFragment)
|
||||
}
|
||||
|
||||
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
SearchServiceHolder.intentManager.registerIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||
SearchApisHolder.getIntentManager().registerIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
SearchApisHolder.getIntentManager().registerIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||
}
|
||||
|
||||
private fun registerRetryVoice() {
|
||||
@@ -211,7 +210,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
}
|
||||
|
||||
private fun retry() {
|
||||
SearchServiceHolder.getNavi().naviTo(mogoTip)
|
||||
SearchApisHolder.getNaviApis().naviTo(mogoTip)
|
||||
pb_path.visibility = View.VISIBLE
|
||||
group_path.visibility = View.GONE
|
||||
}
|
||||
@@ -221,28 +220,30 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
return
|
||||
}
|
||||
|
||||
SearchServiceHolder.getNavi().startNavi(!SettingManager.isMonitor())
|
||||
SearchServiceHolder.getMapUIController().recoverLockMode()
|
||||
SearchApisHolder.getNaviApis().startNavi(!SettingManager.isMonitor())
|
||||
SearchApisHolder.getUiControllerApis().recoverLockMode()
|
||||
|
||||
if (SearchServiceHolder.guideShowProvider.isPlayingVideo()) {
|
||||
SearchServiceHolder.guideShowProvider.closeGuideShowView()
|
||||
if (SearchApisHolder.getGuideShowApis().isPlayingVideo()) {
|
||||
SearchApisHolder.getGuideShowApis().closeGuideShowView()
|
||||
}
|
||||
isStartedNavi = true
|
||||
SearchServiceHolder.fragmentManager.clearAll()
|
||||
SearchApisHolder.getFragmentManager().clearAll()
|
||||
}
|
||||
|
||||
private fun selectPath(item: MogoCalculatePath?) {
|
||||
item?.let {
|
||||
mAdapter.setSelectTag(item.tagId)
|
||||
SearchServiceHolder.getNavi().itemClickInteraction.onItemClicked(item.tagId)
|
||||
if (SearchApisHolder.getNaviApis().itemClickInteraction != null) {
|
||||
SearchApisHolder.getNaviApis().itemClickInteraction.onItemClicked(item.tagId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH)
|
||||
SearchApisHolder.getRegisterCenterApis().unregisterMogoNaviListener(AMapConstants.PATH_FRAGMENT_CHOOSE_PATH)
|
||||
if (!isStartedNavi) {
|
||||
SearchServiceHolder.getNavi().clearCalculatePaths()
|
||||
SearchApisHolder.getNaviApis().clearCalculatePaths()
|
||||
}
|
||||
|
||||
DataConstants.sCmds.entries.filter {
|
||||
@@ -251,8 +252,8 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(it.key)
|
||||
}
|
||||
|
||||
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
SearchServiceHolder.intentManager.unregisterIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||
SearchApisHolder.getIntentManager().unregisterIntentListener(AMapConstants.COMMAND_START_NAVI, this)
|
||||
SearchApisHolder.getIntentManager().unregisterIntentListener(AMapConstants.COMMAND_CHOOSE_PATH, this)
|
||||
}
|
||||
|
||||
override fun onIntentReceived(intentStr: String?, intent: Intent?) {
|
||||
@@ -294,7 +295,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
val TAG: String = "ChoosePathFragment"
|
||||
|
||||
fun newInstance(searchPoi: MogoLatLng): Fragment {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(SearchServiceHolder.getMapUIController(), Scene.CALCULATE_PATH)
|
||||
var bundle = Bundle()
|
||||
bundle.putParcelable(AMapConstants.KEY_PARCELABLE, searchPoi)
|
||||
var choosePathFragment = ChoosePathFragment()
|
||||
|
||||
@@ -2,34 +2,29 @@ package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.health.ServiceHealthStats;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.R;
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import com.mogo.module.navi.constants.AMapConstants;
|
||||
import com.mogo.module.navi.constants.SearchApisHolder;
|
||||
import com.mogo.module.navi.manager.AddressManager;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.ui.adapter.HistoryPoiAdapter;
|
||||
import com.mogo.module.navi.ui.adapter.SearchPoiAdapter;
|
||||
import com.mogo.module.navi.ui.base.UiController;
|
||||
import com.mogo.module.navi.ui.setting.NaviSettingFragment;
|
||||
import com.mogo.module.navi.uitls.StringUtils;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -45,8 +40,8 @@ import java.util.List;
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_HOME}
|
||||
*/
|
||||
public class SearchFragment extends BaseSearchFragment
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener {
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
public static final String TAG = "search";
|
||||
|
||||
@@ -72,14 +67,15 @@ public class SearchFragment extends BaseSearchFragment
|
||||
private TextView tvEmpty;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (context instanceof UiController) {
|
||||
public void onAttach( Context context ) {
|
||||
super.onAttach( context );
|
||||
if ( context instanceof UiController ) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@Override
|
||||
public void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,114 +84,117 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
SearchServiceHolder.INSTANCE.getMarkerManger().removeMarkers();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(false);
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
SearchApisHolder.getMarkerManager().removeMarkers();
|
||||
SearchApisHolder.getUiControllerApis().showMyLocation( false );
|
||||
}
|
||||
|
||||
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mSearchResult = view.findViewById(R.id.rv_navi_search);
|
||||
rvHistory = view.findViewById(R.id.rv_navi_history);
|
||||
rlHistory = view.findViewById(R.id.rl_navi_history);
|
||||
@Override
|
||||
public void onViewCreated( @NonNull View view, @Nullable Bundle savedInstanceState ) {
|
||||
super.onViewCreated( view, savedInstanceState );
|
||||
mSearchResult = view.findViewById( R.id.rv_navi_search );
|
||||
rvHistory = view.findViewById( R.id.rv_navi_history );
|
||||
rlHistory = view.findViewById( R.id.rl_navi_history );
|
||||
LinearLayoutManager linearManager =
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
new LinearLayoutManager( getActivity(), LinearLayoutManager.VERTICAL, false );
|
||||
|
||||
rvHistory.setLayoutManager(linearManager);
|
||||
rvHistory.setLayoutManager( linearManager );
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
mSearchResult.setLayoutManager(linearLayoutManager);
|
||||
new LinearLayoutManager( getActivity(), LinearLayoutManager.VERTICAL, false );
|
||||
mSearchResult.setLayoutManager( linearLayoutManager );
|
||||
|
||||
mPoiAdapter = new SearchPoiAdapter(getActivity(), new ArrayList<>());
|
||||
mSearchResult.setAdapter(mPoiAdapter);
|
||||
mPoiAdapter = new SearchPoiAdapter( getActivity(), new ArrayList<>() );
|
||||
mSearchResult.setAdapter( mPoiAdapter );
|
||||
|
||||
mHistoryAdapter = new HistoryPoiAdapter(getActivity(), new ArrayList<>());
|
||||
rvHistory.setAdapter(mHistoryAdapter);
|
||||
mHistoryAdapter = new HistoryPoiAdapter( getActivity(), new ArrayList<>() );
|
||||
rvHistory.setAdapter( mHistoryAdapter );
|
||||
|
||||
tvEmpty = findViewById(R.id.tv_navi_list_empty);
|
||||
tvEmpty = findViewById( R.id.tv_navi_list_empty );
|
||||
|
||||
findViewById(R.id.iv_navi_back).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().pop();
|
||||
findViewById( R.id.iv_navi_back ).setOnClickListener( v -> {
|
||||
SearchApisHolder.getFragmentManager().pop();
|
||||
} );
|
||||
|
||||
mHistoryAdapter.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
SearchApisHolder.getAnalyticsApis().track( "Navigation_History_destination", new HashMap< String, Object >() );
|
||||
SearchPoi item = ( SearchPoi ) v.getTag( R.id.tag_item );
|
||||
goHistory( item );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mHistoryAdapter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_History_destination", new HashMap<String, Object>());
|
||||
SearchPoi item = (SearchPoi) v.getTag(R.id.tag_item);
|
||||
goHistory(item);
|
||||
mPoiAdapter.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
MogoTip tag = ( MogoTip ) v.getTag( R.id.tag_position );
|
||||
goResult( tag );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mPoiAdapter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
MogoTip tag = (MogoTip) v.getTag(R.id.tag_position);
|
||||
goResult(tag);
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.tv_navi_history_clear).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
findViewById( R.id.tv_navi_history_clear ).setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
mSearchPresenter.deleteAllCachedPoi();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
findViewById(R.id.tv_navi_setting).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
findViewById( R.id.tv_navi_setting ).setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
goSetting();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
findViewById(R.id.tv_navi_company).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
findViewById( R.id.tv_navi_company ).setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
AddressManager.INSTANCE.goCompany();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
findViewById(R.id.tv_navi_home).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
findViewById( R.id.tv_navi_home ).setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
AddressManager.INSTANCE.goHome();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
findViewById(R.id.tv_navi_wash).setOnClickListener(this);
|
||||
findViewById(R.id.tv_navi_toilet).setOnClickListener(this);
|
||||
findViewById(R.id.tv_navi_gas).setOnClickListener(this);
|
||||
findViewById(R.id.tv_navi_restaurant).setOnClickListener(this);
|
||||
findViewById(R.id.tv_navi_park).setOnClickListener(this);
|
||||
findViewById( R.id.tv_navi_wash ).setOnClickListener( this );
|
||||
findViewById( R.id.tv_navi_toilet ).setOnClickListener( this );
|
||||
findViewById( R.id.tv_navi_gas ).setOnClickListener( this );
|
||||
findViewById( R.id.tv_navi_restaurant ).setOnClickListener( this );
|
||||
findViewById( R.id.tv_navi_park ).setOnClickListener( this );
|
||||
|
||||
findViewById(R.id.tv_navi_search).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_search", new HashMap<String, Object>());
|
||||
|
||||
mSearchPresenter.startSearchPoiByInput(mSearchBox.getText().toString());
|
||||
findViewById( R.id.tv_navi_search ).setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
SearchApisHolder.getAnalyticsApis().track( "Navigation_button_search", new HashMap< String, Object >() );
|
||||
mSearchPresenter.startSearchPoiByInput( mSearchBox.getText().toString() );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
registerVoidCmd();
|
||||
registerVoidCmd();
|
||||
}
|
||||
|
||||
private void goResult(MogoTip tag) {
|
||||
SearchPoi searchPoi = EntityConvertUtils.tipToPoi(tag);
|
||||
if (tag.getPoint() == null) {
|
||||
goCategory(tag.getName());
|
||||
private void goResult( MogoTip tag ) {
|
||||
SearchPoi searchPoi = EntityConvertUtils.tipToPoi( tag );
|
||||
if ( tag.getPoint() == null ) {
|
||||
goCategory( tag.getName() );
|
||||
} else {
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
mSearchPresenter.insert( searchPoi );
|
||||
AddressManager.INSTANCE.calculatePath( tag.getPoint() );
|
||||
}
|
||||
}
|
||||
|
||||
private void goSetting() {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager().track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
SearchApisHolder.getAnalyticsApis().track( "Navigation_button_setting", new HashMap< String, Object >() );
|
||||
AddressManager.INSTANCE.goSettings();
|
||||
}
|
||||
|
||||
private void goHistory(SearchPoi item) {
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
private void goHistory( SearchPoi item ) {
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip( item );
|
||||
AddressManager.INSTANCE.calculatePath( mogoTip.getPoint() );
|
||||
}
|
||||
|
||||
@@ -211,99 +210,95 @@ public class SearchFragment extends BaseSearchFragment
|
||||
|
||||
private void registerVoidCmd() {
|
||||
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GO_HOME_CMD, new String[] { "回家" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GO_COMPANY_CMD, new String[] { "去公司" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GAS_CMD, new String[] { "加油站" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(RESTAURANT_CMD, new String[] { "餐馆" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(TOILET_CMD, new String[] { "卫生间", "厕所" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(PARK_CMD, new String[] { "停车场" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(NAVI_SETTING_CMD, new String[] { "导航设置" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(CLEAN_CMD, new String[] { "清空历史目的地" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(WASH_CMD, new String[] { "洗车" }, this);
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( GO_HOME_CMD, new String[]{"回家"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( GO_COMPANY_CMD, new String[]{"去公司"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( GAS_CMD, new String[]{"加油站"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( RESTAURANT_CMD, new String[]{"餐馆"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( TOILET_CMD, new String[]{"卫生间", "厕所"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( PARK_CMD, new String[]{"停车场"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( NAVI_SETTING_CMD, new String[]{"导航设置"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( CLEAN_CMD, new String[]{"清空历史目的地"}, this );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( WASH_CMD, new String[]{"洗车"}, this );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderSearchPoiResult(List<MogoTip> datums, boolean showDelete) {
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
showEmpty(getString(R.string.search_empty));
|
||||
public void renderSearchPoiResult( List< MogoTip > datums, boolean showDelete ) {
|
||||
if ( datums == null || datums.isEmpty() ) {
|
||||
showEmpty( getString( R.string.search_empty ) );
|
||||
return;
|
||||
}
|
||||
showResult();
|
||||
mPoiAdapter.setDatas(datums);
|
||||
mPoiAdapter.setDatas( datums );
|
||||
registerResult();
|
||||
}
|
||||
|
||||
@Override public void showHistory(List<SearchPoi> datums) {
|
||||
@Override
|
||||
public void showHistory( List< SearchPoi > datums ) {
|
||||
|
||||
if (datums == null || datums.isEmpty()) {
|
||||
showEmpty(getString(R.string.history_empty));
|
||||
if ( datums == null || datums.isEmpty() ) {
|
||||
showEmpty( getString( R.string.history_empty ) );
|
||||
return;
|
||||
}
|
||||
showHistory();
|
||||
mHistoryAdapter.setDatas(datums);
|
||||
mHistoryAdapter.setDatas( datums );
|
||||
registerHistory();
|
||||
}
|
||||
|
||||
private void registerHistory() {
|
||||
List<SearchPoi> datums = mHistoryAdapter.getList();
|
||||
for (int i = 0; i < datums.size(); i++) {
|
||||
String s = StringUtils.int2String(i + 1);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand("history" + i,
|
||||
new String[] { "第" + s + "个", "第" + s + "条" }, this);
|
||||
if (cmds.contains("history" + i)) {
|
||||
List< SearchPoi > datums = mHistoryAdapter.getList();
|
||||
for ( int i = 0; i < datums.size(); i++ ) {
|
||||
String s = StringUtils.int2String( i + 1 );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( "history" + i,
|
||||
new String[]{"第" + s + "个", "第" + s + "条"}, this );
|
||||
if ( cmds.contains( "history" + i ) ) {
|
||||
continue;
|
||||
}
|
||||
cmds.add("history" + i);
|
||||
cmds.add( "history" + i );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void registerResult() {
|
||||
List<MogoTip> datums = mPoiAdapter.getList();
|
||||
for (int i = 0; i < datums.size(); i++) {
|
||||
String s = StringUtils.int2String(i + 1);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand("history" + i,
|
||||
new String[] { "第" + s + "个", "第" + s + "条" }, this);
|
||||
if (cmds.contains("history" + i)) {
|
||||
List< MogoTip > datums = mPoiAdapter.getList();
|
||||
for ( int i = 0; i < datums.size(); i++ ) {
|
||||
String s = StringUtils.int2String( i + 1 );
|
||||
AIAssist.getInstance( getContext() )
|
||||
.registerUnWakeupCommand( "history" + i,
|
||||
new String[]{"第" + s + "个", "第" + s + "条"}, this );
|
||||
if ( cmds.contains( "history" + i ) ) {
|
||||
continue;
|
||||
}
|
||||
cmds.add("history" + i);
|
||||
cmds.add( "history" + i );
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> cmds = new ArrayList<String>();
|
||||
private List< String > cmds = new ArrayList< String >();
|
||||
|
||||
@Override
|
||||
public int getSearchType() {
|
||||
return mSearchType;
|
||||
}
|
||||
|
||||
@Override public void startJumpAnimation() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 退出搜索,进行清理
|
||||
*/
|
||||
private void exitSearch() {
|
||||
|
||||
switch (mSearchType) {
|
||||
switch ( mSearchType ) {
|
||||
case SearchConstants.SEARCH_TYPE_COMMON:
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@@ -313,97 +308,79 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
|
||||
private void showResult() {
|
||||
rlHistory.setVisibility(View.GONE);
|
||||
mSearchResult.setVisibility(View.VISIBLE);
|
||||
tvEmpty.setVisibility(View.GONE);
|
||||
rlHistory.setVisibility( View.GONE );
|
||||
mSearchResult.setVisibility( View.VISIBLE );
|
||||
tvEmpty.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
private void showHistory() {
|
||||
rlHistory.setVisibility(View.VISIBLE);
|
||||
mSearchResult.setVisibility(View.GONE);
|
||||
tvEmpty.setVisibility(View.GONE);
|
||||
rlHistory.setVisibility( View.VISIBLE );
|
||||
mSearchResult.setVisibility( View.GONE );
|
||||
tvEmpty.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
private void showEmpty(String str) {
|
||||
rlHistory.setVisibility(View.GONE);
|
||||
tvEmpty.setText(str);
|
||||
mSearchResult.setVisibility(View.GONE);
|
||||
tvEmpty.setVisibility(View.VISIBLE);
|
||||
private void showEmpty( String str ) {
|
||||
rlHistory.setVisibility( View.GONE );
|
||||
tvEmpty.setText( str );
|
||||
mSearchResult.setVisibility( View.GONE );
|
||||
tvEmpty.setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
private boolean isHistory(){
|
||||
return rlHistory.getVisibility()==View.VISIBLE;
|
||||
private boolean isHistory() {
|
||||
return rlHistory.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 类别
|
||||
*/
|
||||
@Override public void onClick(View v) {
|
||||
TextView category = (TextView) v;
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
TextView category = ( TextView ) v;
|
||||
String text = category.getText().toString();
|
||||
goCategory(text);
|
||||
goCategory( text );
|
||||
}
|
||||
|
||||
private void goCategory(String text) {
|
||||
private void goCategory( String text ) {
|
||||
AddressManager.INSTANCE.categorySearch( text );
|
||||
}
|
||||
|
||||
@Override public void onResume() {
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override public void onPause() {
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
// moveMapToRight();
|
||||
SearchApisHolder.getUiControllerApis().showMyLocation( true );
|
||||
unRegisterVoice();
|
||||
}
|
||||
|
||||
private void unRegisterVoice() {
|
||||
|
||||
//private static final String GO_HOME_CMD="goHome";
|
||||
//private static final String GO_COMPANY_CMD="goCompany";
|
||||
//private static final String GAS_CMD="gas";
|
||||
//private static final String RESTAURANT_CMD="restaurant";
|
||||
//private static final String TOILET_CMD="toilet";
|
||||
//private static final String PARK_CMD="park";
|
||||
//private static final String WASH_CMD="wash";
|
||||
//private static final String NAVI_SETTING_CMD="setting";
|
||||
//private static final String CLEAN_CMD="clean";
|
||||
//private static final String BACK_CMD="back";
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GO_HOME_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GO_COMPANY_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GAS_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(RESTAURANT_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(TOILET_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(PARK_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(WASH_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(NAVI_SETTING_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(CLEAN_CMD);
|
||||
for (String cmd : cmds) {
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(cmd);
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( GO_HOME_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( GO_COMPANY_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( GAS_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( RESTAURANT_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( TOILET_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( PARK_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( WASH_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( NAVI_SETTING_CMD );
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( CLEAN_CMD );
|
||||
for ( String cmd : cmds ) {
|
||||
AIAssist.getInstance( getContext() ).unregisterUnWakeupCommand( cmd );
|
||||
}
|
||||
}
|
||||
|
||||
//@Override public void onPause() {
|
||||
// super.onPause();
|
||||
// unRegisterVoice();
|
||||
//}
|
||||
//
|
||||
//@Override public void onResume() {
|
||||
// super.onResume();
|
||||
// registerVoidCmd();
|
||||
// registerHistory();
|
||||
//}
|
||||
|
||||
@Override public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
if (hidden) {
|
||||
@Override
|
||||
public void onHiddenChanged( boolean hidden ) {
|
||||
super.onHiddenChanged( hidden );
|
||||
if ( hidden ) {
|
||||
unRegisterVoice();
|
||||
} else {
|
||||
registerVoidCmd();
|
||||
@@ -411,36 +388,37 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCmdSelected(String cmd) {
|
||||
if (!TextUtils.isEmpty(cmd) && cmd.startsWith("history")) {
|
||||
String index = cmd.substring(7);
|
||||
Integer integer = Integer.valueOf(index);
|
||||
if (isHistory()){
|
||||
if (integer < mHistoryAdapter.getItemCount()) {
|
||||
SearchPoi item = mHistoryAdapter.getItem(integer);
|
||||
goHistory(item);
|
||||
}
|
||||
}else {
|
||||
if (integer < mPoiAdapter.getItemCount()) {
|
||||
MogoTip item = mPoiAdapter.getItem(integer);
|
||||
goResult(item);
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( !TextUtils.isEmpty( cmd ) && cmd.startsWith( "history" ) ) {
|
||||
String index = cmd.substring( 7 );
|
||||
Integer integer = Integer.valueOf( index );
|
||||
if ( isHistory() ) {
|
||||
if ( integer < mHistoryAdapter.getItemCount() ) {
|
||||
SearchPoi item = mHistoryAdapter.getItem( integer );
|
||||
goHistory( item );
|
||||
}
|
||||
} else {
|
||||
if ( integer < mPoiAdapter.getItemCount() ) {
|
||||
MogoTip item = mPoiAdapter.getItem( integer );
|
||||
goResult( item );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
switch (cmd) {
|
||||
switch ( cmd ) {
|
||||
case CLEAN_CMD:
|
||||
mSearchPresenter.deleteAllCachedPoi();
|
||||
AIAssist.getInstance(getContext())
|
||||
.speakQAndACmd(getString(R.string.notice_clean_history),
|
||||
new String[] { "确定","立即清空" }, new String[] { "取消" }, this);
|
||||
AIAssist.getInstance( getContext() )
|
||||
.speakQAndACmd( getString( R.string.notice_clean_history ),
|
||||
new String[]{"确定", "立即清空"}, new String[]{"取消"}, this );
|
||||
break;
|
||||
|
||||
|
||||
case GAS_CMD:
|
||||
|
||||
goCategory(getString(R.string.navi_gas));
|
||||
goCategory( getString( R.string.navi_gas ) );
|
||||
|
||||
break;
|
||||
case GO_COMPANY_CMD:
|
||||
@@ -455,20 +433,20 @@ public class SearchFragment extends BaseSearchFragment
|
||||
break;
|
||||
|
||||
case PARK_CMD:
|
||||
goCategory(getString(R.string.navi_park));
|
||||
goCategory( getString( R.string.navi_park ) );
|
||||
|
||||
break;
|
||||
case RESTAURANT_CMD:
|
||||
goCategory(getString(R.string.navi_restrant));
|
||||
goCategory( getString( R.string.navi_restrant ) );
|
||||
|
||||
break;
|
||||
|
||||
case TOILET_CMD:
|
||||
goCategory(getString(R.string.navi_toilet));
|
||||
goCategory( getString( R.string.navi_toilet ) );
|
||||
break;
|
||||
|
||||
case WASH_CMD:
|
||||
goCategory(getString(R.string.navi_wash));
|
||||
goCategory( getString( R.string.navi_wash ) );
|
||||
|
||||
break;
|
||||
|
||||
@@ -477,26 +455,31 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCmdAction(String speakText) {
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
mSearchPresenter.hideDialog();
|
||||
mSearchPresenter.deleteAllCachedPoiImpl();
|
||||
}
|
||||
|
||||
@Override public void onCmdCancel(String speakText) {
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
mSearchPresenter.hideDialog();
|
||||
}
|
||||
|
||||
@Override public void onSpeakEnd(String speakText) {
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onSpeakSelectTimeOut(String speakText) {
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onTransaction(int size) {
|
||||
@Override
|
||||
public void onTransaction( int size ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,36 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.TextWatcherAdapter;
|
||||
import com.mogo.module.navi.R;
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import com.mogo.module.navi.constants.DataConstants;
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder;
|
||||
import com.mogo.module.navi.constants.SearchApisHolder;
|
||||
import com.mogo.module.navi.database.AppDataBase;
|
||||
import com.mogo.module.navi.dialog.NoticeDialog;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@@ -41,7 +38,6 @@ import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -105,8 +101,7 @@ public class SearchPresenter extends Presenter<SearchView> {
|
||||
MogoInputtipsQuery mogoInputtipsQuery = new MogoInputtipsQuery();
|
||||
mogoInputtipsQuery.setKeyword(keyword);
|
||||
|
||||
MogoLocation lastKnowLocation =
|
||||
SearchServiceHolder.INSTANCE.getLocationClient().getLastKnowLocation();
|
||||
MogoLocation lastKnowLocation = SearchApisHolder.getLocationClientApis().getLastKnowLocation();
|
||||
mogoInputtipsQuery.setCity(lastKnowLocation.getCityName());
|
||||
mogoInputtipsQuery.setCityLimit(true);
|
||||
IMogoInputtipsSearch inputtipsSearch =
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-08
|
||||
* <p>
|
||||
* 搜索工具类
|
||||
*/
|
||||
public class SearchUtils {
|
||||
|
||||
/**
|
||||
* @param searchType
|
||||
* @return
|
||||
*/
|
||||
public static int checkAndResetSearchType( int searchType ) {
|
||||
switch ( searchType ) {
|
||||
case SearchConstants.SEARCH_TYPE_COMMON:
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_HOME:
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_COMPANY:
|
||||
break;
|
||||
default:
|
||||
searchType = SearchConstants.SEARCH_TYPE_COMMON;
|
||||
break;
|
||||
}
|
||||
return searchType;
|
||||
}
|
||||
|
||||
public static String getSearchTypeActionName( int searchType ) {
|
||||
switch ( searchType ) {
|
||||
case SearchConstants.SEARCH_TYPE_COMMON:
|
||||
return null;
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_HOME:
|
||||
return "设为家";
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_COMPANY:
|
||||
return "设为公司";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,25 +22,11 @@ public interface SearchView extends IView {
|
||||
* @param datums
|
||||
* @param showDelete 是否显示清空历史记录项
|
||||
*/
|
||||
void renderSearchPoiResult(List<MogoTip> datums, boolean showDelete);
|
||||
void renderSearchPoiResult( List< MogoTip > datums, boolean showDelete );
|
||||
|
||||
|
||||
void showHistory(List<SearchPoi> datums);
|
||||
void showHistory( List< SearchPoi > datums );
|
||||
|
||||
int getSearchType();
|
||||
|
||||
|
||||
|
||||
///**
|
||||
// * 显示逆地理位置编码结果
|
||||
// *
|
||||
// * @param address
|
||||
// */
|
||||
//void renderChoicePointResult(RegeocodeAddress address);
|
||||
|
||||
/**
|
||||
* 选点完毕后marker动画
|
||||
*/
|
||||
void startJumpAnimation();
|
||||
|
||||
}
|
||||
|
||||
@@ -4,25 +4,19 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener
|
||||
import android.widget.CompoundButton.VISIBLE
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.map.constants.BroadcastMode
|
||||
import com.mogo.map.uicontroller.EnumMapUI
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.manager.SettingManager
|
||||
import com.mogo.module.navi.manager.VolumeManager
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.fragment_navi_setting.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -66,7 +60,7 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
}
|
||||
if (isChecked) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_preference", mapOf("type" to type))
|
||||
SearchApisHolder.getAnalyticsApis().track("Navigation_preference", mapOf("type" to type))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -109,7 +103,7 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
private fun initEvent() {
|
||||
rl_navi_setting_title.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
SearchApisHolder.getFragmentManager().pop()
|
||||
}
|
||||
iv_sound_plus.setOnClickListener {
|
||||
VolumeManager.getInstance(context).incVolume()
|
||||
@@ -134,8 +128,7 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
sb_navi_volume_progress.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
if (fromUser) {
|
||||
VolumeManager.getInstance(context)
|
||||
.setSysVolume(progress)
|
||||
VolumeManager.getInstance(context).setSysVolume(progress)
|
||||
SettingManager.volume = sb_navi_volume_progress.progress
|
||||
|
||||
}
|
||||
@@ -156,39 +149,37 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
SettingManager.mapType = checkedId
|
||||
when (checkedId) {
|
||||
R.id.rb_navi_day -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_Light)
|
||||
SearchApisHolder.getUiControllerApis().changeMapMode(EnumMapUI.Type_Light)
|
||||
}
|
||||
R.id.rb_navi_night -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_Night)
|
||||
SearchApisHolder.getUiControllerApis().changeMapMode(EnumMapUI.Type_Night)
|
||||
}
|
||||
R.id.rb_navi_auto -> {
|
||||
SearchServiceHolder.getMapUIController().changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night)
|
||||
SearchApisHolder.getUiControllerApis().changeMapMode(EnumMapUI.Type_AUTO_LIGHT_Night)
|
||||
}
|
||||
}
|
||||
}
|
||||
rg_navi_sound_type.setOnCheckedChangeListener { group, checkedId ->
|
||||
SettingManager.voiceStyle = checkedId
|
||||
SearchServiceHolder.getNavi().setBroadcastMode(
|
||||
if (checkedId == R.id.rb_navi_detail) BroadcastMode.DETAIL else BroadcastMode.CONCISE
|
||||
)
|
||||
|
||||
if (checkedId == R.id.rb_navi_detail) {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 1))
|
||||
} else {
|
||||
SearchServiceHolder.analyticsManager.track("Navigation_guide_type", mapOf("type" to 2))
|
||||
when (checkedId) {
|
||||
R.id.rb_navi_detail -> {
|
||||
SearchApisHolder.getSettingManager().speakDetail()
|
||||
SearchApisHolder.getAnalyticsApis().track("Navigation_guide_type", mapOf("type" to 1))
|
||||
}
|
||||
R.id.rb_navi_draft -> {
|
||||
SearchApisHolder.getSettingManager().speakDraft()
|
||||
SearchApisHolder.getAnalyticsApis().track("Navigation_guide_type", mapOf("type" to 2))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aimlessModeGroup.setOnCheckedChangeListener { group, checkedId ->
|
||||
|
||||
SettingManager.setAimlessMode(checkedId)
|
||||
when (checkedId){
|
||||
when (checkedId) {
|
||||
R.id.aimlessModeClose -> {
|
||||
SearchServiceHolder.getNavi().setAimlessModeStatus(false)
|
||||
SearchApisHolder.getSettingManager().closeAimlessMode()
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已为您关闭巡航模式")
|
||||
}
|
||||
R.id.aimlessModeOpen -> {
|
||||
SearchServiceHolder.getNavi().setAimlessModeStatus(true)
|
||||
SearchApisHolder.getSettingManager().openAimlessMode()
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("已为您开启巡航模式")
|
||||
}
|
||||
}
|
||||
@@ -196,24 +187,24 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
|
||||
tv_navi_clear_home_address.setOnClickListener {
|
||||
AddressManager.deleteHome(context!!)
|
||||
AddressManager.deleteHome()
|
||||
clearHome()
|
||||
}
|
||||
|
||||
tv_navi_clear_company_address.setOnClickListener {
|
||||
AddressManager.deleteCompany(context!!)
|
||||
AddressManager.deleteCompany()
|
||||
clearCompany()
|
||||
}
|
||||
|
||||
tv_navi_company_address.setOnClickListener {
|
||||
if (!AddressManager.hasCompany()) {
|
||||
AddressManager.goCompany()
|
||||
SearchApisHolder.getSearchManager().goCompany()
|
||||
}
|
||||
}
|
||||
|
||||
tv_navi_home_address.setOnClickListener {
|
||||
if (!AddressManager.hasHome()) {
|
||||
AddressManager.goHome()
|
||||
SearchApisHolder.getSearchManager().goHome()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,9 +222,9 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
SettingManager.setGpsSimulator(isChecked)
|
||||
|
||||
if (isChecked) {
|
||||
SearchServiceHolder.gpsSimulator.open()
|
||||
SearchApisHolder.getGpsSimulatorManager().open()
|
||||
} else {
|
||||
SearchServiceHolder.gpsSimulator.close()
|
||||
SearchApisHolder.getGpsSimulatorManager().close()
|
||||
}
|
||||
}
|
||||
tb_navi.isChecked = SettingManager.isMonitor()
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult
|
||||
@@ -20,7 +21,7 @@ import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.constants.SearchApisHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
@@ -37,6 +38,8 @@ import kotlinx.android.synthetic.main.fragment_setting_address.*
|
||||
* 2020-01-07.
|
||||
*/
|
||||
class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
|
||||
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
et_navi_search.setText(regeocodeResult?.regeocodeAddress?.formatAddress)
|
||||
var formatAddress = regeocodeResult?.regeocodeAddress?.formatAddress
|
||||
@@ -58,6 +61,8 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
private var style: Int = DataConstants.TYPE_HOME_ADDRESS
|
||||
var addMarker: IMogoMarker? = null
|
||||
|
||||
private lateinit var mGeoSearch: IMogoGeoSearch
|
||||
|
||||
private var selectPoi: SearchPoi? = null
|
||||
private var mapListener: IMogoMapListener = object : MogoMapListenerAdapter() {
|
||||
override fun onMapChanged(
|
||||
@@ -69,7 +74,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
selectPoi = EntityConvertUtils.geoToPoi(latLng?.lat ?: 0.0, latLng?.lng ?: 0.0, style)
|
||||
var mogoRegeocodeQuery = MogoRegeocodeQuery()
|
||||
mogoRegeocodeQuery.point = latLng
|
||||
SearchServiceHolder.getGeoSearcher().getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
mGeoSearch.getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
addMarker?.startJumpAnimation(
|
||||
150f,
|
||||
600,
|
||||
@@ -86,12 +91,13 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY)
|
||||
?: DataConstants.TYPE_HOME_ADDRESS
|
||||
SearchServiceHolder.listenerCenter.registerMogoMapListener(AMapConstants.PATH_FRAGMENT_SETTING_HOME, mapListener)
|
||||
SearchServiceHolder.getMapUIController().showMyLocation(false)
|
||||
SearchServiceHolder.getGeoSearcher().setGeoSearchListener(this)
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
style = arguments?.getInt(AMapConstants.KEY_SET_HOME_COMPONY) ?: DataConstants.TYPE_HOME_ADDRESS
|
||||
SearchApisHolder.getRegisterCenterApis().registerMogoMapListener(AMapConstants.PATH_FRAGMENT_SETTING_HOME, mapListener)
|
||||
SearchApisHolder.getUiControllerApis().showMyLocation(false)
|
||||
SearchApisHolder.getMarkerManager().removeMarkers()
|
||||
|
||||
mGeoSearch = SearchApisHolder.getMapServiceApis().getGeoSearch(context)
|
||||
mGeoSearch.setGeoSearchListener(this)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -119,7 +125,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
}
|
||||
|
||||
iv_navi_back.setOnClickListener {
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
SearchApisHolder.getFragmentManager().pop()
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
@@ -127,12 +133,12 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
SearchServiceHolder.fragmentManager.pop()
|
||||
SearchApisHolder.getFragmentManager().pop()
|
||||
}
|
||||
|
||||
et_navi_search.isEnabled = false
|
||||
et_navi_search.setText(getString(string.drag_map_to_choose))
|
||||
var location = SearchServiceHolder.getMapUIController().windowCenterLocation
|
||||
var location = SearchApisHolder.getUiControllerApis().windowCenterLocation
|
||||
|
||||
UiThreadHandler.postDelayed({
|
||||
if (!isAdded) {
|
||||
@@ -145,10 +151,9 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
.owner(TAG)
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(AMapConstants.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
addMarker = SearchApisHolder.getMarkerManager().addMarker(AMapConstants.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController().getLocationPointInScreen(location)
|
||||
var locationPointInScreen = SearchApisHolder.getUiControllerApis().getLocationPointInScreen(location)
|
||||
addMarker?.setPositionByPixels(locationPointInScreen)
|
||||
}, 500L)
|
||||
}
|
||||
@@ -169,9 +174,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
SearchServiceHolder.listenerCenter.unregisterMogoMapListener(
|
||||
AMapConstants.PATH_FRAGMENT_SETTING_HOME
|
||||
)
|
||||
SearchApisHolder.getRegisterCenterApis().unregisterMogoMapListener(AMapConstants.PATH_FRAGMENT_SETTING_HOME)
|
||||
addMarker?.destroy()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.NaviActivity"
|
||||
>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -26,6 +26,7 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
|
||||
/**
|
||||
@@ -195,11 +196,9 @@ public class MarkerServiceHandler {
|
||||
/**
|
||||
* 对指定类型高亮处理
|
||||
* 建议使用
|
||||
*
|
||||
* @see MapMarkerManager#highlightedMarker(String, boolean)
|
||||
*/
|
||||
@Deprecated
|
||||
public static void highlightedMarker( String typeTag ) {
|
||||
getMapMarkerManager().highlightedMarker( typeTag, false );
|
||||
Logger.w( TAG, "do not invoke this method any more." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,6 +493,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mStatusManager.isUserInteracted() ) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
Logger.d( TAG, "user interacted" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -500,6 +501,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mStatusManager.isV2XShow() ) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
Logger.d( TAG, "user v2x show" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -507,6 +509,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mLastCustomRefreshCenterLocation = latLng;
|
||||
mLastZoomLevel = zoom;
|
||||
Logger.d( TAG, "user search Ui show" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -555,7 +558,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
Logger.d( TAG, "move distance = %s, factor = %s", distance, factor );
|
||||
return distance > factor;
|
||||
return distance > factor / 2;
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
return false;
|
||||
@@ -684,8 +687,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
private void onAdasOn() {
|
||||
// ADAS 时,不在自动刷新打点策略
|
||||
stopAutoRefreshStrategy();
|
||||
// 清除所有的打点信息记录
|
||||
MarkerServiceHandler.getMapMarkerManager().alreadySmallMarker.clear();
|
||||
}
|
||||
|
||||
private void onAdasClosed() {
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.animation.BounceInterpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
|
||||
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;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.entity.MarkerCarPois;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
@@ -30,7 +24,6 @@ import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.utils.ViewUtils;
|
||||
import com.mogo.service.cardmanager.IMogoCardChangedListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
@@ -54,28 +47,18 @@ import java.util.Map;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >, IMogoCardChangedListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoBizActionDoneListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
// 是否选中在线卡片及气泡,语音搜索触发
|
||||
private boolean mIsAISearchOnlineData = false;
|
||||
|
||||
private Context mContext;
|
||||
// 最后一次选中的气泡
|
||||
private IMogoMarker mLastCheckMarker;
|
||||
private static MapMarkerManager mMarkerManager;
|
||||
|
||||
private String mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION;
|
||||
// 记录其它已经缩小的Marker
|
||||
public ArrayList< String > alreadySmallMarker = new ArrayList<>();
|
||||
// 存储所有汽车marker
|
||||
// public ArrayList<IMogoMarker> carMarkers = new ArrayList<>();
|
||||
// 距离用户最近的Marker
|
||||
private IMogoMarker mNearlyMarker = null;
|
||||
// 记录上次请求数据,切换卡片时做数据处理
|
||||
private MarkerCardResult mLastDataResult;
|
||||
|
||||
private boolean mIsMarkerClicked = false;
|
||||
private RefreshModel mRefreshModel;
|
||||
private MogoLatLng mCarLatLng;
|
||||
// 平滑移动事件间隔(单位:秒)
|
||||
@@ -105,7 +88,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
|
||||
// 长连接
|
||||
MarkerServiceHandler.getMogoSocketManager().registerOnMessageListener( 401001, this );
|
||||
MarkerServiceHandler.getMogoCardManager().registerCardChangedListener( TAG, this );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
}
|
||||
|
||||
@@ -115,30 +97,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
Logger.e( TAG, "do not invoke anymore." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwitched( int position, String moduleName ) {
|
||||
Logger.d( TAG, "当前C位卡片:" + moduleName );
|
||||
if ( ( TextUtils.isEmpty( mCurrentModuleName ) || TextUtils.equals( mCurrentModuleName,
|
||||
ServiceConst.CARD_TYPE_BUSINESS_OPERATION ) ) && mIsMarkerClicked ) {
|
||||
mIsMarkerClicked = false;
|
||||
// 在广告位(默认位置)点击marker造成卡片切换的,还是现实全部marker 【需求:os2.0.2-2.5-4】
|
||||
highlightedMarker( moduleName, false );
|
||||
mCurrentModuleName = moduleName;
|
||||
} else {
|
||||
mCurrentModuleName = moduleName;
|
||||
runOnTargetThread( () -> {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkersExcept( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
mIsMarkerClicked = true;
|
||||
Logger.d( TAG, "onMarkerClicked 点击了大而全中的Marker:" + marker );
|
||||
try {
|
||||
boolean result = switchMarkerOpenStatus( marker );
|
||||
@@ -173,90 +136,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 对指定类型高亮处理
|
||||
public synchronized void highlightedMarker( final String typeTag ) {
|
||||
highlightedMarker( typeTag, false );
|
||||
}
|
||||
|
||||
public synchronized void highlightedMarker( final String typeTag, final boolean netDataRefresh ) {
|
||||
try {
|
||||
Logger.e( TAG, "上一次选中的卡片类型:mCurrentModuleName==" + mCurrentModuleName );
|
||||
if ( !TextUtils.isEmpty( mCurrentModuleName ) && TextUtils.equals( mCurrentModuleName,
|
||||
typeTag ) && !netDataRefresh ) {
|
||||
return;
|
||||
}
|
||||
// 从已经缩小的记录删除
|
||||
alreadySmallMarker.remove( typeTag );
|
||||
List< IMogoMarker > currentHighLightList =
|
||||
MarkerServiceHandler.getMarkerManager().getMarkers( typeTag );
|
||||
|
||||
if ( currentHighLightList == null || currentHighLightList.size() == 0 ) {
|
||||
alreadySmallMarker.clear();
|
||||
// 放大所有的气泡
|
||||
Map< String, List< IMogoMarker > > lastHighLightList =
|
||||
MarkerServiceHandler.getMarkerManager().getAllMarkers();
|
||||
for ( String markerName : lastHighLightList.keySet() ) {
|
||||
setMarkersBig( lastHighLightList.get( markerName ) );
|
||||
}
|
||||
} else {
|
||||
// 缩小其他的气泡
|
||||
Map< String, List< IMogoMarker > > lastHighLightList =
|
||||
MarkerServiceHandler.getMarkerManager().getAllMarkers();
|
||||
for ( String markerName : lastHighLightList.keySet() ) {
|
||||
if ( !markerName.equals( typeTag ) ) {
|
||||
if ( !alreadySmallMarker.contains( markerName ) ) {
|
||||
alreadySmallMarker.add( markerName );
|
||||
setMarkersSmall( lastHighLightList.get( markerName ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将当前卡片选中的气泡放大
|
||||
setMarkersBig( currentHighLightList );
|
||||
}
|
||||
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setMarkersBig( List< IMogoMarker > markers ) {
|
||||
if ( markers == null || markers.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
for ( IMogoMarker mogoMarker : markers ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
mogoMarker.startScaleAnimation( 0.6f, 1f, 0.6f, 1f, 1000, new BounceInterpolator() );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setMarkersSmall( List< IMogoMarker > markers ) {
|
||||
if ( markers == null || markers.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
for ( IMogoMarker mogoMarker : markers ) {
|
||||
smallMarker( mogoMarker );
|
||||
}
|
||||
}
|
||||
|
||||
private static void smallMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mogoMarker.startScaleAnimation( 1f, 0.6f, 1f, 0.6f, 300, new OvershootInterpolator() );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
// 展开气泡
|
||||
private void openMarker( IMogoMarker mogoMarker ) {
|
||||
if ( mogoMarker == null ) {
|
||||
@@ -339,21 +218,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
dispatchDataToBiz();
|
||||
} );
|
||||
|
||||
// 语音触发的在线车辆搜索,采用增量的形式绘制
|
||||
if ( mIsAISearchOnlineData = isOnlineCarDataOnly( mLastDataResult ) ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
MarkerServiceHandler.getMogoCardManager().switch2( ServiceConst.CARD_TYPE_USER_DATA );
|
||||
} else {
|
||||
mLastCheckMarker = null;
|
||||
// 清空所有地图上绘制的Marker
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkersExcept( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
}
|
||||
|
||||
drawMarkerByCurrentType( mLastDataResult );
|
||||
// 同步新绘制的气泡状态
|
||||
alreadySmallMarker.clear();
|
||||
// highlightedMarker( mCurrentModuleName, true );
|
||||
|
||||
trackData( mLastDataResult );
|
||||
}
|
||||
|
||||
@@ -385,11 +250,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( TextUtils.isEmpty( mCurrentModuleName ) ) {
|
||||
// 默认大而全
|
||||
mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION;
|
||||
}
|
||||
|
||||
drawAllMarker( markerCardResult );
|
||||
}
|
||||
|
||||
@@ -399,14 +259,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param markerCardResult
|
||||
*/
|
||||
private void drawAllMarker( MarkerCardResult markerCardResult ) {
|
||||
// List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
|
||||
List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay();
|
||||
List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
||||
// List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic();
|
||||
List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo();
|
||||
|
||||
// drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_ALL);
|
||||
drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
drawShareMusicMarker( shareMusicList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
// drawShareMusicMarker( shareMusicList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
drawNoveltyMarker( noveltyInfoList, ServiceConst.MAX_AMOUNT_ALL );
|
||||
}
|
||||
|
||||
@@ -421,10 +279,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
return;
|
||||
}
|
||||
|
||||
double nearlyDistance = Float.MAX_VALUE;
|
||||
int size = getAppropriateSize( maxAmount, onlineCarList );
|
||||
|
||||
Map< String, IMogoMarker > existCarMap = purgeCarsData( onlineCarList );
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( onlineCarList, ModuleNames.CARD_TYPE_USER_DATA );
|
||||
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerOnlineCar markerOnlineCar = onlineCarList.get( i );
|
||||
@@ -439,119 +296,13 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
markerShowEntity.setIconUrl( markerOnlineCar.getUserInfo().getUserHead() );
|
||||
}
|
||||
|
||||
if ( markerOnlineCar.getUserInfo() == null || TextUtils.isEmpty( markerOnlineCar.getUserInfo().getSn() ) ) {
|
||||
continue;
|
||||
}
|
||||
IMogoMarker mogoMarker = existCarMap.get( markerOnlineCar.getUserInfo().getSn() );
|
||||
String sn = getCarSnFromEntity( markerOnlineCar );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
Logger.d( TAG, "car [%s] need be create.", markerOnlineCar.getUserInfo().getSn() );
|
||||
mogoMarker = drawMapMarker( markerShowEntity );
|
||||
}
|
||||
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
|
||||
|
||||
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
|
||||
try {
|
||||
// 当前车辆的位置
|
||||
MogoLocation currentLocation = MarkerServiceHandler.getMogoLocationClient().getLastKnowLocation();
|
||||
|
||||
// 计算车辆距离指定气泡的距离
|
||||
float calculateDistance =
|
||||
Utils.calculateLineDistance( new MogoLatLng( markerLocation.getLat(),
|
||||
markerLocation.getLon() ),
|
||||
new MogoLatLng( currentLocation.getLatitude(),
|
||||
currentLocation.getLongitude() ) );
|
||||
|
||||
// 进行比较,保留最近的一个数据
|
||||
if ( calculateDistance < nearlyDistance ) {
|
||||
nearlyDistance = calculateDistance;
|
||||
mNearlyMarker = mogoMarker;
|
||||
}
|
||||
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "距离当前车辆位置最近的距离为:" + nearlyDistance );
|
||||
|
||||
try {
|
||||
// 在ACC on 之后第一次获取到了在线车辆数据,选中最近的一个Marker
|
||||
if ( !mIsAISearchOnlineData ) {
|
||||
return;
|
||||
}
|
||||
if ( mNearlyMarker == null ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "语音搜索触发,默认选中最近的在线车辆:" + mNearlyMarker );
|
||||
// 移动地图到指定位置
|
||||
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( ServiceConst.TYPE, true, false );
|
||||
MarkerServiceHandler.getMapUIController().moveToCenter( mNearlyMarker.getPosition() );
|
||||
onMarkerClicked( mNearlyMarker );
|
||||
MogoMarkersHandler.getInstance().onMarkerClicked( mNearlyMarker );
|
||||
mIsAISearchOnlineData = false;
|
||||
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据新的在线车辆列表,选出已存在的在线车辆,并从视图和内存中移除不存在的在线车辆
|
||||
*
|
||||
* @param newCarsList
|
||||
* @return
|
||||
*/
|
||||
private Map< String, IMogoMarker > purgeCarsData( List< MarkerOnlineCar > newCarsList ) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Map< String, IMogoMarker > existCarsMap = new HashMap<>();
|
||||
List< IMogoMarker > allCarsList = MarkerServiceHandler.getMarkerManager().getMarkers( ModuleNames.CARD_TYPE_USER_DATA );
|
||||
if ( allCarsList == null || allCarsList.isEmpty() ) {
|
||||
return existCarsMap;
|
||||
}
|
||||
if ( newCarsList == null || newCarsList.isEmpty() ) {
|
||||
return existCarsMap;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > allCarsMap = new HashMap<>();
|
||||
for ( IMogoMarker marker : allCarsList ) {
|
||||
String sn = getCarSnFromMarker( marker );
|
||||
Logger.d( TAG, "sn = [%s]", sn );
|
||||
allCarsMap.put( sn, marker );
|
||||
}
|
||||
for ( MarkerOnlineCar markerOnlineCar : newCarsList ) {
|
||||
String sn = markerOnlineCar.getUserInfo().getSn();
|
||||
if ( allCarsMap.containsKey( sn ) ) {
|
||||
Logger.d( TAG, " car [%s] is cached.", sn );
|
||||
existCarsMap.put( sn, allCarsMap.get( sn ) );
|
||||
}
|
||||
}
|
||||
for ( String sn : allCarsMap.keySet() ) {
|
||||
if ( !existCarsMap.containsKey( sn ) ) {
|
||||
IMogoMarker dirtyMarker = allCarsMap.get( sn );
|
||||
allCarsList.remove( dirtyMarker );
|
||||
dirtyMarker.destroy();
|
||||
Logger.d( TAG, " car [%s] is destroy.", sn );
|
||||
}
|
||||
}
|
||||
allCarsMap.clear();
|
||||
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
return existCarsMap;
|
||||
}
|
||||
|
||||
private String getCarSnFromMarker( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
|
||||
return null;
|
||||
}
|
||||
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( !( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() instanceof MarkerOnlineCar ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getUserInfo() == null ) {
|
||||
return null;
|
||||
}
|
||||
return ( ( MarkerOnlineCar ) ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() ).getUserInfo().getSn();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -562,9 +313,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
private void drawRoadConditionMarker( List< MarkerExploreWay > exploreWayList, int maxAmount ) {
|
||||
// 将数据同步给探路,避免探路每次 perform 的时候去拉取,造成消耗
|
||||
if ( exploreWayList == null || exploreWayList.isEmpty() ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
return;
|
||||
}
|
||||
int size = getAppropriateSize( maxAmount, exploreWayList );
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION );
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerExploreWay markerExploreWay = exploreWayList.get( i );
|
||||
if ( !markerExploreWay.getCanLive() ) {
|
||||
@@ -576,21 +329,28 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
markerShowEntity.setMarkerType( markerExploreWay.getType() );
|
||||
markerShowEntity.setTextContent( markerExploreWay.getAddr() );
|
||||
|
||||
drawMapMarker( markerShowEntity );
|
||||
String sn = getCarSnFromEntity( markerExploreWay );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
drawMapMarker( markerShowEntity );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 共享音乐
|
||||
*
|
||||
* @param shareMusicList
|
||||
*/
|
||||
private void drawShareMusicMarker( List< MarkerShareMusic > shareMusicList, int maxAmount ) {
|
||||
if ( shareMusicList == null ) {
|
||||
if ( shareMusicList == null || shareMusicList.isEmpty() ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_SHARE_MUSIC );
|
||||
return;
|
||||
}
|
||||
int size = getAppropriateSize( maxAmount, shareMusicList );
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( shareMusicList, ModuleNames.CARD_TYPE_SHARE_MUSIC );
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerShareMusic markerShareMusic = shareMusicList.get( i );
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
@@ -601,7 +361,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
markerShowEntity.setTextContent( markerShareMusic.getMediaName() );
|
||||
markerShowEntity.setIconUrl( markerShareMusic.getMediaImg() );
|
||||
|
||||
drawMapMarker( markerShowEntity );
|
||||
String sn = getCarSnFromEntity( markerShareMusic );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
drawMapMarker( markerShowEntity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,10 +375,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param noveltyInfoList
|
||||
*/
|
||||
private void drawNoveltyMarker( List< MarkerNoveltyInfo > noveltyInfoList, int maxAmount ) {
|
||||
if ( noveltyInfoList == null ) {
|
||||
if ( noveltyInfoList == null || noveltyInfoList.isEmpty() ) {
|
||||
MarkerServiceHandler.getMarkerManager().removeMarkers( ModuleNames.CARD_TYPE_NOVELTY );
|
||||
return;
|
||||
}
|
||||
int size = getAppropriateSize( maxAmount, noveltyInfoList );
|
||||
Map< String, IMogoMarker > existCarMap = purgeMarkerData( noveltyInfoList, ModuleNames.CARD_TYPE_NOVELTY );
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
MarkerNoveltyInfo noveltyInfo = noveltyInfoList.get( i );
|
||||
MarkerLocation markerLocation = noveltyInfo.getLocation();
|
||||
@@ -628,10 +394,83 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
} else {
|
||||
markerShowEntity.setTextContent( noveltyInfo.getContentData().getTitle() );
|
||||
}
|
||||
drawMapMarker( markerShowEntity );
|
||||
String sn = getCarSnFromEntity( noveltyInfo );
|
||||
IMogoMarker mogoMarker = existCarMap.get( sn );
|
||||
if ( mogoMarker == null ) {
|
||||
drawMapMarker( markerShowEntity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* S = (A ∩ B) ∪ B
|
||||
* (A ∩ B)作为旧列表需要保留的部分
|
||||
*
|
||||
* @param newList
|
||||
* @return
|
||||
*/
|
||||
private Map< String, IMogoMarker > purgeMarkerData( List newList, String markerType ) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Map< String, IMogoMarker > existMap = new HashMap<>();
|
||||
List< IMogoMarker > allCarsList = MarkerServiceHandler.getMarkerManager().getMarkers( markerType );
|
||||
if ( allCarsList == null || allCarsList.isEmpty() ) {
|
||||
return existMap;
|
||||
}
|
||||
if ( newList == null || newList.isEmpty() ) {
|
||||
return existMap;
|
||||
}
|
||||
|
||||
Map< String, IMogoMarker > allMap = new HashMap<>();
|
||||
for ( IMogoMarker marker : allCarsList ) {
|
||||
String sn = getCarSnFromMarker( marker );
|
||||
allMap.put( sn, marker );
|
||||
}
|
||||
for ( Object entity : newList ) {
|
||||
String sn = getCarSnFromEntity( entity );
|
||||
if ( allMap.containsKey( sn ) ) {
|
||||
existMap.put( sn, allMap.get( sn ) );
|
||||
}
|
||||
}
|
||||
for ( String sn : allMap.keySet() ) {
|
||||
if ( !existMap.containsKey( sn ) ) {
|
||||
IMogoMarker dirtyMarker = allMap.get( sn );
|
||||
allCarsList.remove( dirtyMarker );
|
||||
dirtyMarker.destroy();
|
||||
}
|
||||
}
|
||||
allMap.clear();
|
||||
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
return existMap;
|
||||
}
|
||||
|
||||
private String getCarSnFromEntity( Object entity ) {
|
||||
try {
|
||||
if ( entity instanceof MarkerOnlineCar ) {
|
||||
return ( ( MarkerOnlineCar ) entity ).getUserInfo().getSn();
|
||||
} else if ( entity instanceof MarkerShareMusic ) {
|
||||
return ( ( MarkerShareMusic ) entity ).getUserInfo().getSn();
|
||||
} else if ( entity instanceof MarkerNoveltyInfo ) {
|
||||
return ( ( MarkerNoveltyInfo ) entity ).getSn();
|
||||
} else if ( entity instanceof MarkerExploreWay ) {
|
||||
return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getCarSnFromMarker( IMogoMarker marker ) {
|
||||
if ( marker == null || marker.getObject() == null || marker.isDestroyed() ) {
|
||||
return null;
|
||||
}
|
||||
if ( !( marker.getObject() instanceof MarkerShowEntity ) ) {
|
||||
return null;
|
||||
}
|
||||
return getCarSnFromEntity( ( ( MarkerShowEntity ) marker.getObject() ).getBindObj() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maxAmount 展示的最大数量
|
||||
* @param list
|
||||
@@ -811,18 +650,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
*/
|
||||
public synchronized IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity ) {
|
||||
try {
|
||||
return drawMapMarker( markerShowEntity, isSmallType() );
|
||||
return drawMapMarkerImpl( markerShowEntity );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSmallType() {
|
||||
return !TextUtils.isEmpty( mCurrentModuleName ) && mLastCheckMarker != null && !mLastCheckMarker.isDestroyed() && TextUtils.equals( mCurrentModuleName, mLastCheckMarker.getOwner() );
|
||||
}
|
||||
|
||||
private IMogoMarker drawMapMarker( MarkerShowEntity markerShowEntity, boolean isSmall ) {
|
||||
private IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity ) {
|
||||
if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -843,12 +678,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
marker.setOwner( markerShowEntity.getMarkerType() );
|
||||
markerView.setMarker( marker );
|
||||
marker.setOnMarkerClickListener( this );
|
||||
|
||||
if ( isSmall ) {
|
||||
List< IMogoMarker > markers = new ArrayList<>();
|
||||
markers.add( marker );
|
||||
setMarkersSmall( markers );
|
||||
}
|
||||
markerShowEntity.setMarker( marker );
|
||||
return marker;
|
||||
}
|
||||
@@ -906,9 +735,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
List< MarkerOnlineCar > onlineCarList = result.getOnlineCar();
|
||||
if ( !MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
dispatchDataToBis( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList );
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return;
|
||||
}
|
||||
@@ -933,15 +759,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
|
||||
return true;
|
||||
}
|
||||
if ( MarkerServiceHandler.getMogoStatusManager().isADASShow() ) {
|
||||
return false;
|
||||
}
|
||||
if ( TextUtils.equals( ServiceConst.CARD_TYPE_USER_DATA, mCurrentModuleName )
|
||||
|| TextUtils.equals( ServiceConst.CARD_TYPE_BUSINESS_OPERATION, mCurrentModuleName )
|
||||
|| TextUtils.equals( ServiceConst.CARD_TYPE_CARS_CHATTING, mCurrentModuleName ) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeCarMarkers() {
|
||||
@@ -1016,7 +834,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
}
|
||||
|
||||
public String getCurrentModuleName() {
|
||||
return mCurrentModuleName;
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,12 +24,6 @@ public interface IMogoSearchManager extends IProvider {
|
||||
*/
|
||||
void showSearch();
|
||||
|
||||
void showMain();
|
||||
|
||||
void speakDraft();
|
||||
|
||||
void speakDetail();
|
||||
|
||||
/**
|
||||
* 规划路线
|
||||
*
|
||||
|
||||
@@ -8,8 +8,51 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoSettingManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 路线偏好
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getPathPrefer();
|
||||
|
||||
/**
|
||||
* 音量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getVolume();
|
||||
|
||||
/**
|
||||
* 获取播报模式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getVoiceStyle();
|
||||
|
||||
/**
|
||||
* 日夜墨水
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getMapType();
|
||||
|
||||
/**
|
||||
* 简洁播报
|
||||
*/
|
||||
void speakDraft();
|
||||
|
||||
/**
|
||||
* 详细播报
|
||||
*/
|
||||
void speakDetail();
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
*/
|
||||
void openAimlessMode();
|
||||
|
||||
/**
|
||||
* 关闭巡航模式
|
||||
*/
|
||||
void closeAimlessMode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user