From 16fe7cffaadd42895ba9e02ab1ad01956ea36421 Mon Sep 17 00:00:00 2001 From: donghongyu Date: Wed, 15 Dec 2021 15:56:29 +0800 Subject: [PATCH] [Update] upload 0.0.45-fix 2.1.3-fix Signed-off-by: donghongyu --- .../java/com/mogo/commons/voice/AIAssist.java | 8 +- gradle.properties | 160 +++--- .../map/impl/custom/utils/ObjectUtils.java | 540 ++++++++---------- .../main/java/com/mogo/tts/pad/PadTTS.java | 94 +-- 4 files changed, 366 insertions(+), 436 deletions(-) diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java index b88f42196d..30295add91 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/voice/AIAssist.java @@ -3,6 +3,7 @@ package com.mogo.commons.voice; import android.content.Context; import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.eagle.core.utilcode.util.ToastUtils; import com.mogo.tts.base.IMogoTTS; import com.mogo.tts.base.MogoTTSConstants; import com.mogo.tts.base.PreemptType; @@ -46,7 +47,12 @@ public class AIAssist { private AIAssist( Context context ) { - mTTS = ( IMogoTTS ) ARouter.getInstance().build( MogoTTSConstants.API_PATH ).navigation( context.getApplicationContext() ); + try { + mTTS = ( IMogoTTS ) ARouter.getInstance().build( MogoTTSConstants.API_PATH ).navigation( context.getApplicationContext() ); + } catch (Exception e) { + e.printStackTrace(); + ToastUtils.showShort("TTS 初始化失败"); + } } /** diff --git a/gradle.properties b/gradle.properties index 94817fcdda..7405745991 100644 --- a/gradle.properties +++ b/gradle.properties @@ -37,7 +37,7 @@ kapt.include.compile.classpath=false android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true -android.jetifier.blacklist=module-service-2.1.3.aar +android.jetifier.blacklist=module-service-2.1.3-fix.aar ## maven 配置 RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ @@ -89,102 +89,102 @@ applicationName=IntelligentPilot versionCode=80007 versionName=8.0.14 ################# 新架构模块Maven版本管理 ################# -MOGO_CORE_FUNCTION_AUTOPILOT_VERSION=0.0.45 -MOGO_CORE_FUNCTION_CHECK_VERSION=0.0.45 -MOGO_CORE_FUNCTION_HMI_VERSION=0.0.45 -MOGO_CORE_FUNCTION_MAIN_VERSION=0.0.45 -MOGO_CORE_FUNCTION_MAP_VERSION=0.0.45 -MOGO_CORE_FUNCTION_MONITORING_VERSION=0.0.45 -MOGO_CORE_FUNCTION_NOTICE_VERSION=0.0.45 -MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.45 -MOGO_CORE_FUNCTION_SMP_VERSION=0.0.45 -MOGO_CORE_FUNCTION_V2X_VERSION=0.0.45 -MOGO_CORE_DATA_VERSION=0.0.45 -MOGO_CORE_FUNCTION_API_VERSION=0.0.45 -MOGO_CORE_FUNCTION_CALL_VERSION=0.0.45 -MOGO_CORE_RES_VERSION=0.0.45 -MOGO_CORE_UTILS_VERSION=0.0.45 -MOGO_CORE_NETWORK_VERSION=0.0.45 +MOGO_CORE_FUNCTION_AUTOPILOT_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_CHECK_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_HMI_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_MAIN_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_MAP_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_MONITORING_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_NOTICE_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_OBU_MOGO_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_SMP_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_V2X_VERSION=0.0.45-fix +MOGO_CORE_DATA_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_API_VERSION=0.0.45-fix +MOGO_CORE_FUNCTION_CALL_VERSION=0.0.45-fix +MOGO_CORE_RES_VERSION=0.0.45-fix +MOGO_CORE_UTILS_VERSION=0.0.45-fix +MOGO_CORE_NETWORK_VERSION=0.0.45-fix ################# 旧版本架构模块版本 ################# ## 工程内模块 -MOGO_COMMONS_VERSION=2.1.3 -MOGO_UTILS_VERSION=2.1.3 -MAP_AMAP_VERSION=2.1.3 -MAP_AUTONAVI_VERSION=2.1.3 -MOGO_MAP_VERSION=2.1.3 -MOGO_MAP_API_VERSION=2.1.3 -MOGO_SERVICE_VERSION=2.1.3 -MOGO_SERVICE_API_VERSION=2.1.3 -MOGO_CONNECTION_VERSION=2.1.3 -MOGO_MODULE_APPS_VERSION=2.1.3 -MOGO_MODULE_NAVI_VERSION=2.1.3 -MOGO_MODULE_SHARE_VERSION=2.1.3 -MOGO_MODULE_COMMON_VERSION=2.1.3 -MOGO_MODULE_MAIN_VERSION=2.1.3 -MOGO_MODULE_MAP_VERSION=2.1.3 -MOGO_MODULE_SERVICE_VERSION=2.1.3 -MOGO_MODULE_EXTENSIONS_VERSION=2.1.3 -MOGO_MODULE_SEARCH_VERSION=2.1.3 -MOGO_MODULE_BACK_VERSION=2.1.3 -MOGO_MODULE_V2X_VERSION=2.1.3 +MOGO_COMMONS_VERSION=2.1.3-fix +MOGO_UTILS_VERSION=2.1.3-fix +MAP_AMAP_VERSION=2.1.3-fix +MAP_AUTONAVI_VERSION=2.1.3-fix +MOGO_MAP_VERSION=2.1.3-fix +MOGO_MAP_API_VERSION=2.1.3-fix +MOGO_SERVICE_VERSION=2.1.3-fix +MOGO_SERVICE_API_VERSION=2.1.3-fix +MOGO_CONNECTION_VERSION=2.1.3-fix +MOGO_MODULE_APPS_VERSION=2.1.3-fix +MOGO_MODULE_NAVI_VERSION=2.1.3-fix +MOGO_MODULE_SHARE_VERSION=2.1.3-fix +MOGO_MODULE_COMMON_VERSION=2.1.3-fix +MOGO_MODULE_MAIN_VERSION=2.1.3-fix +MOGO_MODULE_MAP_VERSION=2.1.3-fix +MOGO_MODULE_SERVICE_VERSION=2.1.3-fix +MOGO_MODULE_EXTENSIONS_VERSION=2.1.3-fix +MOGO_MODULE_SEARCH_VERSION=2.1.3-fix +MOGO_MODULE_BACK_VERSION=2.1.3-fix +MOGO_MODULE_V2X_VERSION=2.1.3-fix # 探路 -MOGO_MODULE_TANLU_VERSION=2.1.3 +MOGO_MODULE_TANLU_VERSION=2.1.3-fix # 推送 -MOGO_MODULE_PUSH_VERSION=2.1.3 -MOGO_MODULE_PUSH_BASE_VERSION=2.1.3 -MOGO_MODULE_PUSH_NOOP_VERSION=2.1.3 +MOGO_MODULE_PUSH_VERSION=2.1.3-fix +MOGO_MODULE_PUSH_BASE_VERSION=2.1.3-fix +MOGO_MODULE_PUSH_NOOP_VERSION=2.1.3-fix # 探路上报和分享模块 -TANLULIB_VERSION=2.1.3 -MOGO_TANLU_API_VERSION=2.1.3 +TANLULIB_VERSION=2.1.3-fix +MOGO_TANLU_API_VERSION=2.1.3-fix #左侧面板模块 -MOGO_MODULE_LEFT_PANEL_VERSION=2.1.3 -MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.1.3 +MOGO_MODULE_LEFT_PANEL_VERSION=2.1.3-fix +MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.1.3-fix # 小控件 -MOGO_MODULE_WIDGETS_VERSION=2.1.3 +MOGO_MODULE_WIDGETS_VERSION=2.1.3-fix # obu -MOGO_MODULE_OBU_VERSION=2.1.3 -MOGO_MODULE_OBU_MOGO_VERSION=2.1.3 +MOGO_MODULE_OBU_VERSION=2.1.3-fix +MOGO_MODULE_OBU_MOGO_VERSION=2.1.3-fix # monitor -MOGO_MODULE_MONITOR_VERSION=2.1.3 +MOGO_MODULE_MONITOR_VERSION=2.1.3-fix # bugly -CRASHREPORT_VERSION=2.1.3 -CRASHREPORT_BUGLY_VERSION=2.1.3 -CRASHREPORT_NOOP_VERSION=2.1.3 -CRASHREPORT_UPGRADE_VERSION=2.1.3 +CRASHREPORT_VERSION=2.1.3-fix +CRASHREPORT_BUGLY_VERSION=2.1.3-fix +CRASHREPORT_NOOP_VERSION=2.1.3-fix +CRASHREPORT_UPGRADE_VERSION=2.1.3-fix ## tts -TTS_BASE_VERSION=2.1.3 -TTS_DI_VERSION=2.1.3 -TTS_ZHI_VERSION=2.1.3 -TTS_PAD_VERSION=2.1.3 -TTS_NOOP_VERSION=2.1.3 +TTS_BASE_VERSION=2.1.3-fix +TTS_DI_VERSION=2.1.3-fix +TTS_ZHI_VERSION=2.1.3-fix +TTS_PAD_VERSION=2.1.3-fix +TTS_NOOP_VERSION=2.1.3-fix # 自研地图 -MAP_CUSTOM_VERSION=2.1.3 -MOGO_MODULE_ADAS_VERSION=2.1.3 +MAP_CUSTOM_VERSION=2.1.3-fix +MOGO_MODULE_ADAS_VERSION=2.1.3-fix # 基础服务实现:passport、socket、location -MOGO_BASE_WEBSOCKET_SDK_VERSION=2.1.3 -MOGO_BASE_SERVICES_APK_VERSION=2.1.3 -MOGO_BASE_SERVICES_SDK_VERSION=2.1.3 -MOGO_MODULE_CHAT_VERSION=2.1.3 +MOGO_BASE_WEBSOCKET_SDK_VERSION=2.1.3-fix +MOGO_BASE_SERVICES_APK_VERSION=2.1.3-fix +MOGO_BASE_SERVICES_SDK_VERSION=2.1.3-fix +MOGO_MODULE_CHAT_VERSION=2.1.3-fix # 车聊聊 -MOGO_MODULE_CARCHATTING_VERSION=2.1.3 +MOGO_MODULE_CARCHATTING_VERSION=2.1.3-fix # 车聊聊接口 -MOGO_MODULE_CARCHATTINGPROVIDER_VERSION=2.1.3 +MOGO_MODULE_CARCHATTINGPROVIDER_VERSION=2.1.3-fix # 皮肤 -MOGO_SKIN_SUPPORT_VERSION=2.1.3 -MOGO_SKIN_LIGHT_VERSION=2.1.3 -MOGO_SKIN_SUPPORT_IMPL_VERSION=2.1.3 -MOGO_SKIN_SUPPORT_NOOP_VERSION=2.1.3 -SKIN_SUPPORT_VERSION=2.1.3 -SKIN_SUPPORT_APPCOMPAT_VERSION=2.1.3 -SKIN_SUPPORT_CARDVIEW_VERSION=2.1.3 -SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.1.3 -SKIN_SUPPORT_DESIGN_VERSION=2.1.3 +MOGO_SKIN_SUPPORT_VERSION=2.1.3-fix +MOGO_SKIN_LIGHT_VERSION=2.1.3-fix +MOGO_SKIN_SUPPORT_IMPL_VERSION=2.1.3-fix +MOGO_SKIN_SUPPORT_NOOP_VERSION=2.1.3-fix +SKIN_SUPPORT_VERSION=2.1.3-fix +SKIN_SUPPORT_APPCOMPAT_VERSION=2.1.3-fix +SKIN_SUPPORT_CARDVIEW_VERSION=2.1.3-fix +SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.1.3-fix +SKIN_SUPPORT_DESIGN_VERSION=2.1.3-fix # OCH -MOGO_OCH_VERSION=2.1.3-test -MOGO_OCH_BUS_VERSION=2.1.3-test -MOGO_OCH_NOOP_VERSION=2.1.3-test -MOGO_OCH_TAXI_VERSION=2.1.3-test +MOGO_OCH_VERSION=2.1.3-fix-test +MOGO_OCH_BUS_VERSION=2.1.3-fix-test +MOGO_OCH_NOOP_VERSION=2.1.3-fix-test +MOGO_OCH_TAXI_VERSION=2.1.3-fix-test # mogoAiCloud sdk services -MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.3 +MOGO_AICLOUD_SERVICES_SDK_VERSION=2.1.3-fix ################# 旧版本架构模块版本 ################# diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java index 1a868e2d8f..a3ee8fe5f6 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java @@ -53,19 +53,19 @@ import java.util.List; */ public class ObjectUtils { - public static MarkerOptions fromMogo( MogoMarkerOptions opt ) { + public static MarkerOptions fromMogo(MogoMarkerOptions opt) { - if ( opt == null ) { + if (opt == null) { return null; } - ArrayList< BitmapDescriptor > descriptors = new ArrayList<>(); - final ArrayList< Bitmap > icons = opt.getIcons(); - if ( icons != null && !icons.isEmpty() ) { - for ( Bitmap icon : icons ) { - if ( icon == null || icon.isRecycled() ) { + ArrayList descriptors = new ArrayList<>(); + final ArrayList icons = opt.getIcons(); + if (icons != null && !icons.isEmpty()) { + for (Bitmap icon : icons) { + if (icon == null || icon.isRecycled()) { continue; } - descriptors.add( new BitmapDescriptor( icon ) ); + descriptors.add(new BitmapDescriptor(icon)); } } @@ -86,83 +86,84 @@ public class ObjectUtils { // } MarkerOptions markerOptions = new MarkerOptions() - .setGps( opt.isGps() ) - .position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) ) - .anchor( opt.getU(), opt.getV() ) - .icons( descriptors ) - .period( opt.getPeriod() ) - .controlAngle( opt.isControlAngle() ) - .rotateAngle( opt.getRotate() ) - .setFlat( opt.isFlat() ) - .visible( opt.isVisible() ) - .infoWindowEnable( opt.isInifoWindowEnable() ) + .setGps(opt.isGps()) + .position(new LonLatPoint(opt.getLongitude(), opt.getLatitude())) + .anchor(opt.getU(), opt.getV()) + .icons(descriptors) + .period(opt.getPeriod()) + .controlAngle(opt.isControlAngle()) + .rotateAngle(opt.getRotate()) + .setFlat(opt.isFlat()) + .visible(opt.isVisible()) + .infoWindowEnable(opt.isInifoWindowEnable()) .scale(opt.getScale()) - .alpha( opt.getAlpha() ) + .alpha(opt.getAlpha()) // .draggable( opt.isDraggable() ) - .setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() ) - .zIndex( opt.getzIndex() ); + .setInfoWindowOffset(opt.getOffsetX(), opt.getOffsetY()) + .zIndex(opt.getzIndex()); try { - Color.parseColor( opt.getAnchorColor() ); - markerOptions.anchorColor( opt.getAnchorColor() ); - } catch ( Exception e ) { + Color.parseColor(opt.getAnchorColor()); + markerOptions.anchorColor(opt.getAnchorColor()); + } catch (Exception e) { } - markerOptions.vrEnable( opt.is3DMode() ); - if ( !TextUtils.isEmpty( opt.getResName() ) ) { - markerOptions.setMarkerIconName( opt.getResName() ); + markerOptions.vrEnable(opt.is3DMode()); + if (!TextUtils.isEmpty(opt.getResName())) { + markerOptions.setMarkerIconName(opt.getResName()); } else { - BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt ); - if ( descriptor != null ) { - markerOptions.markerIcon( descriptor ); + BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt); + if (descriptor != null) { + markerOptions.markerIcon(descriptor); } - if ( opt.getIcon3DRes() != 0 ) { - markerOptions.marker3DIcon( opt.getIcon3DRes() ); + if (opt.getIcon3DRes() != 0) { + markerOptions.marker3DIcon(opt.getIcon3DRes()); } } - if ( !TextUtils.isEmpty( opt.getTitle() ) ) { - markerOptions.title( opt.getTitle() ); + if (!TextUtils.isEmpty(opt.getTitle())) { + markerOptions.title(opt.getTitle()); } - if ( !TextUtils.isEmpty( opt.getSnippet() ) ) { - markerOptions.snippet( opt.getSnippet() ); + if (!TextUtils.isEmpty(opt.getSnippet())) { + markerOptions.snippet(opt.getSnippet()); } return markerOptions; } - private static BitmapDescriptor getBitmapDescriptorFromMogo( MogoMarkerOptions options ) { - if ( options == null ) { + private static BitmapDescriptor getBitmapDescriptorFromMogo(MogoMarkerOptions options) { + if (options == null) { return null; } Bitmap icon = options.getIcon(); - if ( icon != null ) { - return BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ); + if (icon != null) { + return BitmapDescriptorFactory.INSTANCE.fromBitmap(icon); } View view = options.getIconView(); - if ( view != null ) { - return BitmapDescriptorFactory.INSTANCE.fromView( view ); + if (view != null) { + return BitmapDescriptorFactory.INSTANCE.fromView(view); } return null; } - public static MogoLocation fromLocation( com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation ) { - if ( aLocation == null ) { + public static MogoLocation fromLocation(com.zhidaoauto.map.sdk.open.location.MogoLocation aLocation) { + if (aLocation == null) { return null; } MogoLocation location = new MogoLocation(); -// location.setLocType( aLocation.getLocationType() ); - location.setSpeed( aLocation.getSpeed() ); - location.setLatitude( aLocation.getLat() ); - location.setLongitude( aLocation.getLon() ); - location.setAltitude( aLocation.getAltitude() ); -// location.setTime( aLocation.getTime() ); - location.setBearing( aLocation.getHeading() ); -// location.setAccuracy( aLocation.getAccuracy() ); - location.setCityCode( aLocation.getCityCode() ); - location.setCityName( aLocation.getCity() ); - location.setProvider( aLocation.getProvider() ); - location.setAddress( aLocation.getAddress() ); - location.setDistrict( aLocation.getDistrict() ); - location.setProvince( aLocation.getProvince() ); - location.setAdCode( aLocation.getAdCode() ); + location.setLocType(1); // 定位类型 + location.setSatellite(4); + location.setSpeed(aLocation.getSpeed()); + location.setLatitude(aLocation.getLat()); + location.setLongitude(aLocation.getLon()); + location.setAltitude(aLocation.getAltitude()); + location.setBearing(aLocation.getHeading()); + location.setCityCode(aLocation.getCityCode()); + location.setCityName(aLocation.getCity()); + location.setProvider(aLocation.getProvider()); + location.setAddress(aLocation.getAddress()); + location.setDistrict(aLocation.getDistrict()); + location.setProvince(aLocation.getProvince()); + location.setAdCode(aLocation.getAdCode()); + // location.setAccuracy( aLocation.getAccuracy() ); + // location.setTime( aLocation.getTime() ); // location.setLocationDetail( aLocation.getLocationDetail() ); // location.setPoiName( aLocation.getPoiName() ); // location.setAoiName( aLocation.getAoiName() ); @@ -173,15 +174,14 @@ public class ObjectUtils { // location.setBuildingId( aLocation.getBuildingId() ); // location.setFloor( aLocation.getFloor() ); // location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() ); -// location.setSatellite( aLocation.getSatellites() ); return location; } - public static LonLatPoint fromMogo( MogoLatLng latLng ) { - if ( latLng == null ) { + public static LonLatPoint fromMogo(MogoLatLng latLng) { + if (latLng == null) { return null; } - return new LonLatPoint( latLng.lon, latLng.lat ); + return new LonLatPoint(latLng.lon, latLng.lat); } // public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) { @@ -198,11 +198,11 @@ public class ObjectUtils { // return new LatLng( latLng.lat, latLng.lng ); // } - public static MogoLatLng fromAMap( LonLatPoint point ) { - if ( point == null ) { + public static MogoLatLng fromAMap(LonLatPoint point) { + if (point == null) { return null; } - return new MogoLatLng( point.getLatitude(), point.getLongitude() ); + return new MogoLatLng(point.getLatitude(), point.getLongitude()); } // public static MogoLatLng CameraPositionfromAMap( LatLng point ) { @@ -212,19 +212,19 @@ public class ObjectUtils { // return new MogoLatLng( point.latitude, point.longitude ); // } - public static GeocodeQuery fromMogo( MogoGeocodeQuery query ) { - if ( query == null ) { + public static GeocodeQuery fromMogo(MogoGeocodeQuery query) { + if (query == null) { return null; } - GeocodeQuery q = new GeocodeQuery( query.getLocationName(), query.getCity() ); + GeocodeQuery q = new GeocodeQuery(query.getLocationName(), query.getCity()); return q; } - public static RegeocodeQuery fromMogo( MogoRegeocodeQuery query ) { - if ( query == null ) { + public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query) { + if (query == null) { return null; } - RegeocodeQuery q = new RegeocodeQuery( fromMogo( query.getPoint() ), 1000 ); + RegeocodeQuery q = new RegeocodeQuery(fromMogo(query.getPoint()), 1000); return q; } @@ -266,39 +266,39 @@ public class ObjectUtils { // return mogoCrossroad; // } - public static MogoGeocodeAddress fromAMap( GeocodeAddress address ) { - if ( address == null ) { + public static MogoGeocodeAddress fromAMap(GeocodeAddress address) { + if (address == null) { return null; } MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress(); - mogoGeocodeAddress.setAdcode( address.getAdcode() ); - mogoGeocodeAddress.setBuilding( address.getBuilding() ); - mogoGeocodeAddress.setCity( address.getCity() ); - mogoGeocodeAddress.setDistrict( address.getDistrict() ); - mogoGeocodeAddress.setFormatAddress( address.getFormatAddress() ); - mogoGeocodeAddress.setLatlng( fromAMap( address.getLonlat() ) ); - mogoGeocodeAddress.setLevel( address.getLevel() ); - mogoGeocodeAddress.setNeighborhood( address.getNeighborhood() ); - mogoGeocodeAddress.setProvince( address.getProvince() ); - mogoGeocodeAddress.setTownship( address.getTownship() ); + mogoGeocodeAddress.setAdcode(address.getAdcode()); + mogoGeocodeAddress.setBuilding(address.getBuilding()); + mogoGeocodeAddress.setCity(address.getCity()); + mogoGeocodeAddress.setDistrict(address.getDistrict()); + mogoGeocodeAddress.setFormatAddress(address.getFormatAddress()); + mogoGeocodeAddress.setLatlng(fromAMap(address.getLonlat())); + mogoGeocodeAddress.setLevel(address.getLevel()); + mogoGeocodeAddress.setNeighborhood(address.getNeighborhood()); + mogoGeocodeAddress.setProvince(address.getProvince()); + mogoGeocodeAddress.setTownship(address.getTownship()); return mogoGeocodeAddress; } - public static MogoGeocodeResult fromAMap( GeocodeResult result ) { - if ( result == null || result.getGeocodeAddressList() == null ) { + public static MogoGeocodeResult fromAMap(GeocodeResult result) { + if (result == null || result.getGeocodeAddressList() == null) { return null; } MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult(); - final List< MogoGeocodeAddress > addresses = new ArrayList<>(); - List< GeocodeAddress > list = result.getGeocodeAddressList(); - for ( GeocodeAddress geocodeAddress : list ) { - final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress ); - if ( mogoGeocodeAddress != null ) { - addresses.add( mogoGeocodeAddress ); + final List addresses = new ArrayList<>(); + List list = result.getGeocodeAddressList(); + for (GeocodeAddress geocodeAddress : list) { + final MogoGeocodeAddress mogoGeocodeAddress = fromAMap(geocodeAddress); + if (mogoGeocodeAddress != null) { + addresses.add(mogoGeocodeAddress); } } - mogoGeocodeResult.setAddresses( addresses ); + mogoGeocodeResult.setAddresses(addresses); return mogoGeocodeResult; } @@ -374,23 +374,23 @@ public class ObjectUtils { // return mogoSubPoiItem; // } - public static MogoPoiItem fromAMap( PoiItem poiItem ) { - if ( poiItem == null ) { + public static MogoPoiItem fromAMap(PoiItem poiItem) { + if (poiItem == null) { return null; } MogoPoiItem mogoPoiItem = new MogoPoiItem(); - mogoPoiItem.setAdCode( poiItem.getAdCode() ); - mogoPoiItem.setAdName( poiItem.getAdName() ); - mogoPoiItem.setBusinessArea( poiItem.getBusinessArea() ); - mogoPoiItem.setCityCode( poiItem.getCityCode() ); - mogoPoiItem.setCityName( poiItem.getCityName() ); - mogoPoiItem.setDirection( poiItem.getDirection() ); - mogoPoiItem.setDistance( poiItem.getDistance() ); - mogoPoiItem.setEmail( poiItem.getEmail() ); - mogoPoiItem.setEnter( fromAMap( poiItem.getEnter() ) ); - mogoPoiItem.setExit( fromAMap( poiItem.getExit() ) ); + mogoPoiItem.setAdCode(poiItem.getAdCode()); + mogoPoiItem.setAdName(poiItem.getAdName()); + mogoPoiItem.setBusinessArea(poiItem.getBusinessArea()); + mogoPoiItem.setCityCode(poiItem.getCityCode()); + mogoPoiItem.setCityName(poiItem.getCityName()); + mogoPoiItem.setDirection(poiItem.getDirection()); + mogoPoiItem.setDistance(poiItem.getDistance()); + mogoPoiItem.setEmail(poiItem.getEmail()); + mogoPoiItem.setEnter(fromAMap(poiItem.getEnter())); + mogoPoiItem.setExit(fromAMap(poiItem.getExit())); // mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) ); - mogoPoiItem.setParkingType( poiItem.getParkingType() ); + mogoPoiItem.setParkingType(poiItem.getParkingType()); // mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() ); // if ( poiItem.getPhotos() != null ) { // List< MogoPhoto > mogoPhotos = new ArrayList<>(); @@ -403,13 +403,13 @@ public class ObjectUtils { // mogoPoiItem.setPhotos( mogoPhotos ); // } // mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) ); - mogoPoiItem.setPoiId( poiItem.getPoiId() ); - mogoPoiItem.setPoint( fromAMap( poiItem.getLonLatPoint() ) ); - mogoPoiItem.setPostcode( poiItem.getPostcode() ); - mogoPoiItem.setProvinceCode( poiItem.getProvinceCode() ); - mogoPoiItem.setProvinceName( poiItem.getProvinceName() ); - mogoPoiItem.setShopID( poiItem.getShopID() ); - mogoPoiItem.setSnippet( poiItem.getSnippet() ); + mogoPoiItem.setPoiId(poiItem.getPoiId()); + mogoPoiItem.setPoint(fromAMap(poiItem.getLonLatPoint())); + mogoPoiItem.setPostcode(poiItem.getPostcode()); + mogoPoiItem.setProvinceCode(poiItem.getProvinceCode()); + mogoPoiItem.setProvinceName(poiItem.getProvinceName()); + mogoPoiItem.setShopID(poiItem.getShopID()); + mogoPoiItem.setSnippet(poiItem.getSnippet()); // if ( poiItem.getSubPois() != null ) { // List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>(); // for ( SubPoiItem subPois : poiItem.getSubPois() ) { @@ -420,20 +420,20 @@ public class ObjectUtils { // } // mogoPoiItem.setSubPois( mogoSubPoiItems ); // } - mogoPoiItem.setTel( poiItem.getTel() ); - mogoPoiItem.setTypeCode( poiItem.getTypeCode() ); - mogoPoiItem.setTitle( poiItem.getTitle() ); - mogoPoiItem.setTypeDes( poiItem.getTypeDes() ); - mogoPoiItem.setWebsite( poiItem.getWebsite() ); + mogoPoiItem.setTel(poiItem.getTel()); + mogoPoiItem.setTypeCode(poiItem.getTypeCode()); + mogoPoiItem.setTitle(poiItem.getTitle()); + mogoPoiItem.setTypeDes(poiItem.getTypeDes()); + mogoPoiItem.setWebsite(poiItem.getWebsite()); return mogoPoiItem; } - public static MogoRegeocodeAddress fromAMap( RegeocodeAddress regeocodeAddress ) { - if ( regeocodeAddress == null ) { + public static MogoRegeocodeAddress fromAMap(RegeocodeAddress regeocodeAddress) { + if (regeocodeAddress == null) { return null; } MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress(); - mogoRegeocodeAddress.setAdCode( regeocodeAddress.getAdCode() ); + mogoRegeocodeAddress.setAdCode(regeocodeAddress.getAdCode()); // if ( regeocodeAddress.getAois() != null ) { // List< MogoAoiItem > items = new ArrayList<>(); // for ( AoiItem aois : regeocodeAddress.getAois() ) { @@ -445,7 +445,7 @@ public class ObjectUtils { // mogoRegeocodeAddress.setAois( items ); // } - mogoRegeocodeAddress.setBuilding( regeocodeAddress.getBuilding() ); + mogoRegeocodeAddress.setBuilding(regeocodeAddress.getBuilding()); // if ( regeocodeAddress.getBusinessAreas() != null ) { // List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>(); // for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) { @@ -457,9 +457,9 @@ public class ObjectUtils { // mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas ); // } - mogoRegeocodeAddress.setCity( regeocodeAddress.getCity() ); - mogoRegeocodeAddress.setCityCode( regeocodeAddress.getCityCode() ); - mogoRegeocodeAddress.setCountry( regeocodeAddress.getCountry() ); + mogoRegeocodeAddress.setCity(regeocodeAddress.getCity()); + mogoRegeocodeAddress.setCityCode(regeocodeAddress.getCityCode()); + mogoRegeocodeAddress.setCountry(regeocodeAddress.getCountry()); // if ( regeocodeAddress.getCrossroads() != null ) { // List< MogoCrossroad > mogoCrossroads = new ArrayList<>(); // for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) { @@ -471,19 +471,19 @@ public class ObjectUtils { // } // mogoRegeocodeAddress.setCrossroads( mogoCrossroads ); // } - mogoRegeocodeAddress.setDistrict( regeocodeAddress.getDistrict() ); - mogoRegeocodeAddress.setFormatAddress( regeocodeAddress.getFormatAddress() ); - mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() ); - if ( regeocodeAddress.getPoiList() != null ) { - List< MogoPoiItem > mogoPoiItems = new ArrayList<>(); - List< PoiItem > list = regeocodeAddress.getPoiList(); - for ( PoiItem pois : list ) { - MogoPoiItem mogoPoiItem = fromAMap( pois ); - mogoPoiItems.add( mogoPoiItem ); + mogoRegeocodeAddress.setDistrict(regeocodeAddress.getDistrict()); + mogoRegeocodeAddress.setFormatAddress(regeocodeAddress.getFormatAddress()); + mogoRegeocodeAddress.setNeighborhood(regeocodeAddress.getNeighborhood()); + if (regeocodeAddress.getPoiList() != null) { + List mogoPoiItems = new ArrayList<>(); + List list = regeocodeAddress.getPoiList(); + for (PoiItem pois : list) { + MogoPoiItem mogoPoiItem = fromAMap(pois); + mogoPoiItems.add(mogoPoiItem); } - mogoRegeocodeAddress.setPois( mogoPoiItems ); + mogoRegeocodeAddress.setPois(mogoPoiItems); } - mogoRegeocodeAddress.setProvince( regeocodeAddress.getProvince() ); + mogoRegeocodeAddress.setProvince(regeocodeAddress.getProvince()); // if ( regeocodeAddress.getRoads() != null ) { // List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>(); // for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) { @@ -495,43 +495,43 @@ public class ObjectUtils { // mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads ); // } // mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) ); - mogoRegeocodeAddress.setTowncode( regeocodeAddress.getTowncode() ); - mogoRegeocodeAddress.setTownship( regeocodeAddress.getTownship() ); + mogoRegeocodeAddress.setTowncode(regeocodeAddress.getTowncode()); + mogoRegeocodeAddress.setTownship(regeocodeAddress.getTownship()); return mogoRegeocodeAddress; } - public static MogoRegeocodeResult fromAMap( RegeocodeResult regeocodeResult ) { - if ( regeocodeResult == null ) { + public static MogoRegeocodeResult fromAMap(RegeocodeResult regeocodeResult) { + if (regeocodeResult == null) { return null; } MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult(); - mogoRegeocodeResult.setRegeocodeAddress( fromAMap( regeocodeResult.getRegeocodeAddress() ) ); + mogoRegeocodeResult.setRegeocodeAddress(fromAMap(regeocodeResult.getRegeocodeAddress())); return mogoRegeocodeResult; } - public static InputtipsQuery fromMogo( MogoInputtipsQuery query ) { - if ( query == null ) { + public static InputtipsQuery fromMogo(MogoInputtipsQuery query) { + if (query == null) { return null; } - InputtipsQuery inputtipsQuery = new InputtipsQuery( query.getKeyword(), query.getCity() ); - inputtipsQuery.setCityLimit( query.isCityLimit() ); - inputtipsQuery.setLocation( fromMogo( query.getLocation() ) ); - inputtipsQuery.setType( query.getType() ); + InputtipsQuery inputtipsQuery = new InputtipsQuery(query.getKeyword(), query.getCity()); + inputtipsQuery.setCityLimit(query.isCityLimit()); + inputtipsQuery.setLocation(fromMogo(query.getLocation())); + inputtipsQuery.setType(query.getType()); return inputtipsQuery; } - public static MogoTip fromAMap( Tip tip ) { - if ( tip == null ) { + public static MogoTip fromAMap(Tip tip) { + if (tip == null) { return null; } MogoTip mogoTip = new MogoTip(); - mogoTip.setAdCode( tip.getAdcode() ); - mogoTip.setAddress( tip.getAddress() ); - mogoTip.setDistrict( tip.getDistrict() ); - mogoTip.setName( tip.getName() ); - mogoTip.setPoiID( tip.getPoiID() ); - mogoTip.setPoint( fromAMap( tip.getLatPoint() ) ); - mogoTip.setTypeCode( tip.getTypeCode() ); + mogoTip.setAdCode(tip.getAdcode()); + mogoTip.setAddress(tip.getAddress()); + mogoTip.setDistrict(tip.getDistrict()); + mogoTip.setName(tip.getName()); + mogoTip.setPoiID(tip.getPoiID()); + mogoTip.setPoint(fromAMap(tip.getLatPoint())); + mogoTip.setTypeCode(tip.getTypeCode()); return mogoTip; } @@ -546,197 +546,123 @@ public class ObjectUtils { // return mogoPoi; // } - public static MogoPoiSearchQuery fromAMap( Query query ) { - if ( query == null ) { + public static MogoPoiSearchQuery fromAMap(Query query) { + if (query == null) { return null; } - MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery( query.getKeyword(), query.getCategory(), query.getCity() ); + MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery(query.getKeyword(), query.getCategory(), query.getCity()); // mogoPoiSearchQuery.setBuilding( query.getBuilding() ); - mogoPoiSearchQuery.setCityLimit( query.getCityLimit() ); - mogoPoiSearchQuery.setDistanceSort( query.getDistanceSort() ); - mogoPoiSearchQuery.setLocation( fromAMap( query.getLocation() ) ); - mogoPoiSearchQuery.setPageNum( query.getPageNum() ); - mogoPoiSearchQuery.setPageSize( query.getPageSize() ); + mogoPoiSearchQuery.setCityLimit(query.getCityLimit()); + mogoPoiSearchQuery.setDistanceSort(query.getDistanceSort()); + mogoPoiSearchQuery.setLocation(fromAMap(query.getLocation())); + mogoPoiSearchQuery.setPageNum(query.getPageNum()); + mogoPoiSearchQuery.setPageSize(query.getPageSize()); return mogoPoiSearchQuery; } - public static Query fromMogo( MogoPoiSearchQuery query ) { - if ( query == null || query.getQuery() == null ) { + public static Query fromMogo(MogoPoiSearchQuery query) { + if (query == null || query.getQuery() == null) { return null; } - Query psq = new Query( query.getQuery(), "", "" ); - String category = getCategory( query.getQuery() ); - if ( !category.equals( "" ) ) - psq = new Query( "", "", getCategory( query.getQuery() ) ); + Query psq = new Query(query.getQuery(), "", ""); + String category = getCategory(query.getQuery()); + if (!category.equals("")) + psq = new Query("", "", getCategory(query.getQuery())); // psq.setBuilding( query.getBuilding() ); - psq.setCityLimit( query.isCityLimit() ); - psq.setDistanceSort( query.isDistanceSort() ); - psq.setLocation( fromMogo( query.getLocation() ) ); - psq.setPageNum( query.getPageNum() ); - psq.setPageSize( query.getPageSize() ); + psq.setCityLimit(query.isCityLimit()); + psq.setDistanceSort(query.isDistanceSort()); + psq.setLocation(fromMogo(query.getLocation())); + psq.setPageNum(query.getPageNum()); + psq.setPageSize(query.getPageSize()); return psq; } - public static MogoSearchBound fromAMap( SearchBound bound ) { - if ( bound == null ) { + public static MogoSearchBound fromAMap(SearchBound bound) { + if (bound == null) { return null; } - if ( bound.getShape() == SearchBound.BOUND_SHAPE ) { - return new MogoSearchBound( fromAMap( bound.getCenter() ), bound.getRange(), bound.isDistanceSort() ); - } else if ( bound.getShape() == SearchBound.POLYGON_SHAPE ) { - return new MogoSearchBound( fromAMap( bound.getPolyGonList() ) ); - } else if ( bound.getShape() == SearchBound.RECTANGLE_SHAPE ) { - return new MogoSearchBound( fromAMap( bound.getLowerLeft() ), fromAMap( bound.getUpperRight() ) ); + if (bound.getShape() == SearchBound.BOUND_SHAPE) { + return new MogoSearchBound(fromAMap(bound.getCenter()), bound.getRange(), bound.isDistanceSort()); + } else if (bound.getShape() == SearchBound.POLYGON_SHAPE) { + return new MogoSearchBound(fromAMap(bound.getPolyGonList())); + } else if (bound.getShape() == SearchBound.RECTANGLE_SHAPE) { + return new MogoSearchBound(fromAMap(bound.getLowerLeft()), fromAMap(bound.getUpperRight())); } return null; } - public static List< MogoLatLng > fromAMap( List< LonLatPoint > latLngs ) { - if ( latLngs == null ) { + public static List fromAMap(List latLngs) { + if (latLngs == null) { return null; } - List< MogoLatLng > result = new ArrayList<>( latLngs.size() ); - for ( LonLatPoint latLng : latLngs ) { - result.add( fromAMap( latLng ) ); + List result = new ArrayList<>(latLngs.size()); + for (LonLatPoint latLng : latLngs) { + result.add(fromAMap(latLng)); } return result; } - public static List< LonLatPoint > fromMogo( List< MogoLatLng > latLngs ) { - if ( latLngs == null ) { + public static List fromMogo(List latLngs) { + if (latLngs == null) { return null; } - List< LonLatPoint > result = new ArrayList<>( latLngs.size() ); - for ( MogoLatLng latLng : latLngs ) { - result.add( fromMogo( latLng ) ); + List result = new ArrayList<>(latLngs.size()); + for (MogoLatLng latLng : latLngs) { + result.add(fromMogo(latLng)); } return result; } - public static SearchBound fromMogo( MogoSearchBound bound ) { - if ( bound == null ) { + public static SearchBound fromMogo(MogoSearchBound bound) { + if (bound == null) { return null; } - if ( bound.getShape() == MogoSearchBound.SHAPE_BOUND ) { - return new SearchBound( fromMogo( bound.getCenterPoint() ), bound.getRadiusInMeters(), bound.isDistanceSort() ); - } else if ( bound.getShape() == MogoSearchBound.SHAPE_POLYGON ) { - return new SearchBound( fromMogo( bound.getPolyGonList() ) ); - } else if ( bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE ) { - return new SearchBound( fromMogo( bound.getLowerLeft() ), fromMogo( bound.getUpperRight() ) ); + if (bound.getShape() == MogoSearchBound.SHAPE_BOUND) { + return new SearchBound(fromMogo(bound.getCenterPoint()), bound.getRadiusInMeters(), bound.isDistanceSort()); + } else if (bound.getShape() == MogoSearchBound.SHAPE_POLYGON) { + return new SearchBound(fromMogo(bound.getPolyGonList())); + } else if (bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE) { + return new SearchBound(fromMogo(bound.getLowerLeft()), fromMogo(bound.getUpperRight())); } return null; } - public static MogoPoiResult fromAMap( PoiSearchResult result ) { - if ( result == null ) { + public static MogoPoiResult fromAMap(PoiSearchResult result) { + if (result == null) { return null; } MogoPoiResult mogoPoiResult = new MogoPoiResult(); - if ( result.getItems() != null ) { - final List< PoiSearchItem > poiItems = result.getItems(); - final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() ); - for ( PoiSearchItem poiItem : poiItems ) { - mogoPoiItems.add( fromAMap( poiItem.getPoi() ) ); + if (result.getItems() != null) { + final List poiItems = result.getItems(); + final ArrayList mogoPoiItems = new ArrayList<>(poiItems.size()); + for (PoiSearchItem poiItem : poiItems) { + mogoPoiItems.add(fromAMap(poiItem.getPoi())); } - mogoPoiResult.setPois( mogoPoiItems ); + mogoPoiResult.setPois(mogoPoiItems); } return mogoPoiResult; } -// public static MogoNaviInfo fromAMap(Context context, NaviInfo naviInfo ) { -// if ( naviInfo == null ) { -// return null; -// } -// MogoNaviInfo mogoNaviInfo = new MogoNaviInfo(); -// mogoNaviInfo.setCurrentRoadName( naviInfo.getCurrentRoadName() ); -// mogoNaviInfo.setCurrentSpeed( naviInfo.getCurrentSpeed() ); -// mogoNaviInfo.setCurStepRetainDistance( naviInfo.getCurStepRetainDistance() ); -// mogoNaviInfo.setCurStepRetainTime( naviInfo.getCurStepRetainTime() ); -// mogoNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, naviInfo.getIconType() ) ); -// mogoNaviInfo.setNextRoadName( naviInfo.getNextRoadName() ); -// mogoNaviInfo.setPathRetainDistance( naviInfo.getPathRetainDistance() ); -// mogoNaviInfo.setPathRetainTime( naviInfo.getPathRetainTime() ); -// mogoNaviInfo.setCurrentSpeed( naviInfo.getLimitSpeed() ); -// return mogoNaviInfo; -// } -// -// public static MogoCongestionInfo fromAMap( AimLessModeCongestionInfo aimLessModeCongestionInfo ) { -// if ( aimLessModeCongestionInfo == null ) { -// return null; -// } -// MogoCongestionInfo congestionInfo = new MogoCongestionInfo(); -// congestionInfo.setCongestionStatus( aimLessModeCongestionInfo.getCongestionStatus() ); -// congestionInfo.setEventLat( aimLessModeCongestionInfo.getEventLat() ); -// congestionInfo.setEventLon( aimLessModeCongestionInfo.getEventLon() ); -// congestionInfo.setEventType( aimLessModeCongestionInfo.getEventType() ); -// congestionInfo.setCongestionLinks( new ArrayList() ); -// congestionInfo.setLength( aimLessModeCongestionInfo.getLength() ); -// congestionInfo.setRoadName( aimLessModeCongestionInfo.getRoadName() ); -// congestionInfo.setTime( aimLessModeCongestionInfo.getTime() ); -// if ( aimLessModeCongestionInfo.getAmapCongestionLinks() != null -// && aimLessModeCongestionInfo.getAmapCongestionLinks().length != 0 ) { -// for ( AMapCongestionLink amapCongestionLink : aimLessModeCongestionInfo.getAmapCongestionLinks() ) { -// if ( amapCongestionLink == null ) { -// continue; -// } -// MogoCongestionLink link = new MogoCongestionLink(); -// link.setCongestionStatus( amapCongestionLink.getCongestionStatus() ); -// if ( amapCongestionLink.getCoords() != null ) { -// link.setCoords( new ArrayList< MogoLatLng >() ); -// Iterator iterator = amapCongestionLink.getCoords().iterator(); -// while ( iterator.hasNext() ) { -// NaviLatLng naviLatLng = iterator.next(); -// if ( naviLatLng == null ) { -// continue; -// } -// link.getCoords().add( new MogoLatLng( naviLatLng.getLatitude(), naviLatLng.getLongitude() ) ); -// } -// } -// congestionInfo.getCongestionLinks().add( link ); -// } -// } -// return congestionInfo; -// } -// -// public static MogoTraffic fromAMap(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) { -// if ( aMapNaviTrafficFacilityInfos == null || aMapNaviTrafficFacilityInfos.length == 0 ) { -// return null; -// } -// for ( AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo : aMapNaviTrafficFacilityInfos ) { -// if ( aMapNaviTrafficFacilityInfo == null ) { -// continue; -// } -// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_AIM ); -// traffic.setDistance( aMapNaviTrafficFacilityInfo.getDistance() ); -// traffic.setSpeedLimit( aMapNaviTrafficFacilityInfo.getLimitSpeed() ); -// traffic.setTrafficType( aMapNaviTrafficFacilityInfo.getBroadcastType() ); -// traffic.setLat( aMapNaviTrafficFacilityInfo.latitude ); -// traffic.setLon( aMapNaviTrafficFacilityInfo.longitude ); -// return traffic; -// } -// return null; -// } - - public static PolylineOptions fromMogo( MogoPolylineOptions options ) { - if ( options == null ) { + public static PolylineOptions fromMogo(MogoPolylineOptions options) { + if (options == null) { return null; } PolylineOptions target = new PolylineOptions(); target.setGps(options.gps()); - if ( options.getPoints() != null ) { - List< LonLatPoint > points = new ArrayList<>(); - for ( MogoLatLng point : options.getPoints() ) { - points.add( fromMogo( point ) ); + if (options.getPoints() != null) { + List points = new ArrayList<>(); + for (MogoLatLng point : options.getPoints()) { + points.add(fromMogo(point)); } - target.lonLatPoints( points ); + target.lonLatPoints(points); } - target.setLineWidth( options.getWidth() ); + target.setLineWidth(options.getWidth()); target.zIndex(options.getZIndex()); - target.setColor( options.getColor() ); - target.useGradient( options.isGradient() ); - if ( options.getColorValues() != null ) { - target.colorValues( options.getColorValues() ); + target.setColor(options.getColor()); + target.useGradient(options.isGradient()); + if (options.getColorValues() != null) { + target.colorValues(options.getColorValues()); } // target.transparency( options.getTransparency() ); // target.aboveMaskLayer( options.isAboveMaskLayer() ); @@ -746,31 +672,25 @@ public class ObjectUtils { return target; } -// public static MogoLatLng fromAMap( LatLng latLng ) { -// if ( latLng == null ) { -// return null; -// } -// return new MogoLatLng( latLng.latitude, latLng.longitude ); -// } - public static MapCameraPosition fromAMap( CameraPosition position ) { - if ( position == null ) { + public static MapCameraPosition fromAMap(CameraPosition position) { + if (position == null) { return null; } - return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() ); + return new MapCameraPosition(fromAMap(position.getTarget()), position.getBearing(), position.getTilt(), position.getZoom()); } - private static String getCategory( String key ) { + private static String getCategory(String key) { String category = ""; - if ( key.equals( "加油站" ) ) { + if (key.equals("加油站")) { category = "6"; - } else if ( key.equals( "停车场" ) ) { + } else if (key.equals("停车场")) { category = "12"; - } else if ( key.equals( "餐馆" ) ) { + } else if (key.equals("餐馆")) { category = "22"; - } else if ( key.equals( "洗车" ) ) { + } else if (key.equals("洗车")) { category = "8"; - } else if ( key.equals( "厕所" ) ) { + } else if (key.equals("厕所")) { } return category; diff --git a/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java b/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java index 49518e86f0..d28933362b 100644 --- a/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java +++ b/tts/tts-pad/src/main/java/com/mogo/tts/pad/PadTTS.java @@ -112,54 +112,58 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList } private void initTtsConfig() { - Logger.d(TAG, "initTtsConfig"); - //在线授权配置 - AuthConfig.Builder onlineBuilder = new AuthConfig.Builder() - .setType(AuthType.ONLINE) - .setCustomDeviceName(MoGoAiCloudClientConfig.getInstance().getSn()); + try { + Logger.d(TAG, "initTtsConfig"); + //在线授权配置 + AuthConfig.Builder onlineBuilder = new AuthConfig.Builder() + .setType(AuthType.ONLINE) + .setCustomDeviceName(MoGoAiCloudClientConfig.getInstance().getSn()); - //echo 配置 - EchoConfig echoConfig = new EchoConfig.Builder() - .setAecResource(ECHO_RES)// 2mic AEC资源 - .setChannels(2)//设置音频通道数 - .setMicNumber(1)//设置mic数 - .setSavedDirPath("/sdcard/aispeech/aecPcmFile/")//设置echo前后音频保存路径 - .create(); + //echo 配置 + EchoConfig echoConfig = new EchoConfig.Builder() + .setAecResource(ECHO_RES)// 2mic AEC资源 + .setChannels(2)//设置音频通道数 + .setMicNumber(1)//设置mic数 + .setSavedDirPath("/sdcard/aispeech/aecPcmFile/")//设置echo前后音频保存路径 + .create(); - if (BuildConfig.DEBUG){ - DUILiteSDK.openLog();//开启日志,需要在sdk init 之前调用 + if (BuildConfig.DEBUG){ + DUILiteSDK.openLog();//开启日志,需要在sdk init 之前调用 + } + + DUILiteSDK.init(mContext, new DUILiteConfig.Builder() + .setApiKey("113cc31f6385113cc31f6385618c86f5") + .setProductId("278586132") + .setProductKey("1fe5930844b488a8d32d9ef7717be7dc") + .setProductSecret("f601ecc407986b548ac8ab2a9144162e") + .setAuthConfig(onlineBuilder.create())//授权配置 + // .setRecorderConfig(recorderConfig)//设置录音配置 + // .setUploadConfig(uploadConfig)//设置日志上传配置 + // .setTtsCacheDir("/sdcard/speech/cache") //设置tts cache文件存放目录 + .setEchoConfig(echoConfig) + .create(), new DUILiteSDK.InitListener() { + @Override + public void success() { + Logger.d(TAG, "授权成功"); + mHasAuth = true; + initTtsEngine(); + } + + @Override + public void error(String errorCode, final String errorInfo) { + Logger.e(TAG, "error code : " + errorCode + " , error info :" + errorInfo); + // throw new IllegalStateException("授权失败,请检查授权配置"); + } + }); + + boolean isAuthorized = DUILiteSDK.isAuthorized(mContext);//查询授权状态,DUILiteSDK.init之后随时可以调 + Logger.d(TAG, "DUILite SDK is isAuthorized ? " + isAuthorized); + + String core_version = DUILiteSDK.getCoreVersion();//获取内核版本号 + Logger.d(TAG, "core version is: " + core_version); + } catch (Exception e) { + e.printStackTrace(); } - - DUILiteSDK.init(mContext, new DUILiteConfig.Builder() - .setApiKey("113cc31f6385113cc31f6385618c86f5") - .setProductId("278586132") - .setProductKey("1fe5930844b488a8d32d9ef7717be7dc") - .setProductSecret("f601ecc407986b548ac8ab2a9144162e") - .setAuthConfig(onlineBuilder.create())//授权配置 -// .setRecorderConfig(recorderConfig)//设置录音配置 -// .setUploadConfig(uploadConfig)//设置日志上传配置 -// .setTtsCacheDir("/sdcard/speech/cache") //设置tts cache文件存放目录 - .setEchoConfig(echoConfig) - .create(), new DUILiteSDK.InitListener() { - @Override - public void success() { - Logger.d(TAG, "授权成功"); - mHasAuth = true; - initTtsEngine(); - } - - @Override - public void error(String errorCode, final String errorInfo) { - Logger.e(TAG, "error code : " + errorCode + " , error info :" + errorInfo); -// throw new IllegalStateException("授权失败,请检查授权配置"); - } - }); - - boolean isAuthorized = DUILiteSDK.isAuthorized(mContext);//查询授权状态,DUILiteSDK.init之后随时可以调 - Logger.d(TAG, "DUILite SDK is isAuthorized ? " + isAuthorized); - - String core_version = DUILiteSDK.getCoreVersion();//获取内核版本号 - Logger.d(TAG, "core version is: " + core_version); } private void initTtsEngine() {