opt
@@ -312,8 +312,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack {
|
||||
}
|
||||
mHasFlush = true;
|
||||
Logger.d( TAG, "flush cache voice command when voice service ready." );
|
||||
for ( String cmd : mCacheUnWakeupCommands.keySet() ) {
|
||||
registerUnWakeupCommand( cmd, mCacheUnWakeupCommands.get( cmd ) );
|
||||
final Map< String, String[] > tmp = new HashMap<>( mCacheUnWakeupCommands );
|
||||
for ( String cmd : tmp.keySet() ) {
|
||||
registerUnWakeupCommand( cmd, tmp.get( cmd ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.view.animation.Interpolator;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.LocationSource;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
@@ -78,6 +79,9 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
private EnumMapUI mCurrentUIMode;
|
||||
|
||||
// 自定义定位源的回调信息,前瞻线
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView, this );
|
||||
@@ -197,6 +201,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
initMapView();
|
||||
initListeners();
|
||||
initMyLocation();
|
||||
initLocationSource();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,6 +523,22 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
private void initLocationSource(){
|
||||
if ( checkAMapView() ) {
|
||||
mMapView.getMap().setLocationSource( new LocationSource() {
|
||||
@Override
|
||||
public void activate( OnLocationChangedListener onLocationChangedListener ) {
|
||||
AMapNaviViewWrapper.this.mOnLocationChangedListener = onLocationChangedListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if ( checkAMapView() ) {
|
||||
@@ -752,4 +773,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
if ( mOnLocationChangedListener != null ) {
|
||||
mOnLocationChangedListener.onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.LocationSource;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
|
||||
@@ -8,7 +8,12 @@ import android.text.TextUtils;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.MarkerOptionsCreator;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
@@ -66,6 +71,11 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
private CalculatePathItem mSelectedCalculatePathItem;
|
||||
private OnCalculatePathItemClickInteraction mLineClickInteraction;
|
||||
|
||||
/**
|
||||
* 起点终点marker
|
||||
*/
|
||||
private List< Marker > mMarkers = new ArrayList<>();
|
||||
|
||||
public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
|
||||
this.mAMapNavi = mAMapNavi;
|
||||
this.mAMap = mAMap;
|
||||
@@ -182,9 +192,9 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_endpoint );
|
||||
Bitmap startBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_start );
|
||||
Bitmap endBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_target );
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon( bitmap ).zIndex( 0 ).anchor( 0.5f, 0.5f );
|
||||
MogoMarkerOptions startOptions = new MogoMarkerOptions().icon( startBitmap ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
MogoMarkerOptions endOptions = new MogoMarkerOptions().icon( endBitmap ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
MarkerOptions options = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( bitmap ) ).zIndex( 0 ).anchor( 0.5f, 0.5f );
|
||||
MarkerOptions startOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( startBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
MarkerOptions endOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( endBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
for ( CalculatePathItem path : mCalculatePathItems ) {
|
||||
List< MogoLatLng > points = path.getCoordList();
|
||||
if ( points == null || points.isEmpty() ) {
|
||||
@@ -195,10 +205,10 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( startPoint == null || endPoint == null ) {
|
||||
continue;
|
||||
}
|
||||
MogoMap.getInstance().getMogoMap().addMarker( TAG, options.latitude( startPoint.lat ).longitude( startPoint.lng ) );
|
||||
MogoMap.getInstance().getMogoMap().addMarker( TAG, options.latitude( endPoint.lat ).longitude( endPoint.lng ) );
|
||||
MogoMap.getInstance().getMogoMap().addMarker( TAG, startOptions.latitude( startPoint.lat ).longitude( startPoint.lng ) );
|
||||
MogoMap.getInstance().getMogoMap().addMarker( TAG, endOptions.latitude( endPoint.lat ).longitude( endPoint.lng ) );
|
||||
mMarkers.add( mAMap.addMarker( options.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
|
||||
mMarkers.add( mAMap.addMarker( options.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
|
||||
mMarkers.add( mAMap.addMarker( startOptions.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
|
||||
mMarkers.add( mAMap.addMarker( endOptions.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -221,6 +231,19 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( mPaths != null ) {
|
||||
mPaths.clear();
|
||||
}
|
||||
if ( !mMarkers.isEmpty() ) {
|
||||
for ( Marker mMarker : mMarkers ) {
|
||||
if ( mMarker == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
mMarker.remove();
|
||||
mMarker.destroy();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
MogoMarkersHandler.getInstance().remove( TAG );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.impl.amap.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
@@ -233,4 +234,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeMyLocation( location );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
@@ -59,6 +60,13 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
void showMyLocation( float degree );
|
||||
|
||||
/**
|
||||
* 以外部定位的方式改变当前位置
|
||||
*
|
||||
* @param location
|
||||
*/
|
||||
void changeMyLocation( Location location );
|
||||
|
||||
/**
|
||||
* 锁车
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
@@ -226,4 +227,11 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.changeMyLocation( location );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class AppNavigatorFragment extends MvpFragment<AppNavigatorView, AppNavig
|
||||
// appIndicatorAdapter.setCurrentPos(i);
|
||||
//}
|
||||
//this.currentPosition=currentPosition;
|
||||
AppServiceHandler.getMogoCardManager().switch2(apps.get(i % CARD_SIZE).mModuleType);
|
||||
AppServiceHandler.getMogoCardManager().switch2(apps.get(i % CARD_SIZE).mModuleType, true);
|
||||
|
||||
//holder.showText();
|
||||
|
||||
|
||||
@@ -95,6 +95,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
|
||||
private ViewPager.OnPageChangeListener mOnPageChangeListener;
|
||||
|
||||
/**
|
||||
* 手势切换卡片必须为true
|
||||
* <p>
|
||||
* 业务切换则由业务控制
|
||||
*/
|
||||
private boolean mLockCarStatus = true;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_main_activity_main;
|
||||
@@ -122,9 +129,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoModuleHandler.setModuleEnable( provider.getModuleName() );
|
||||
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
|
||||
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMogoMapUIController.setLockZoom( 16 );
|
||||
mMogoMapUIController.recoverLockMode();
|
||||
if ( mLockCarStatus ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMogoMapUIController.setLockZoom( 16 );
|
||||
mMogoMapUIController.recoverLockMode();
|
||||
}
|
||||
mLockCarStatus = true;
|
||||
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -269,12 +280,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( size == 0 ) {
|
||||
showLayout();
|
||||
} else if ( size == 1 ) {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override public void run() {
|
||||
mMogoMapUIController.setPointToCenter(0.5,0.5);
|
||||
UiThreadHandler.postDelayed( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMogoMapUIController.setPointToCenter( 0.5, 0.5 );
|
||||
|
||||
}
|
||||
},1000);
|
||||
}, 1000 );
|
||||
hideLayout();
|
||||
}
|
||||
} );
|
||||
@@ -346,20 +358,14 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
if ( mCardModulesAdapter == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mLockCarStatus = lockCar;
|
||||
int position = mCardModulesAdapter.getProviderPosition( cardType );
|
||||
if ( position != -1 ) {
|
||||
int lastFactPosition = mCardModulesAdapter.getFactPosition( mCurrentPosition );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition + position - lastFactPosition,
|
||||
Math.abs( lastFactPosition - position ) == 1 );
|
||||
mCardsContainer.setCurrentItem( mCurrentPosition + position - lastFactPosition, Math.abs( lastFactPosition - position ) == 1 );
|
||||
} else {
|
||||
Logger.e( TAG, "Can't find type of %s's position", cardType );
|
||||
}
|
||||
|
||||
if ( lockCar ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMogoMapUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Looper;
|
||||
@@ -724,10 +726,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
|
||||
mStatusManager.setADASUIShow( ServiceConst.TYPE, status == 1 );
|
||||
if ( status != 1 ) {
|
||||
if ( status != 1 ) { // adas 关闭
|
||||
mUiController.setLockZoom( ServiceConst.DEFAULT_LOCK_CAR_ZOOM_LEVEL );
|
||||
// 延时两秒执行是为了让其它事物完成
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
mUiController.showMyLocation( true );
|
||||
}, 2_000L );
|
||||
}
|
||||
mUiController.showMyLocation( true );
|
||||
} else if ( Intent.ACTION_POWER_CONNECTED.equals( command ) ) {
|
||||
mStatusManager.setAccStatus( ServiceConst.TYPE, true );
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( command ) ) {
|
||||
@@ -775,6 +780,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
|
||||
if ( stateInfo != null ) {
|
||||
changeCarHeadstockDirection( stateInfo.getValues().getHeading() );
|
||||
// changeMyLocation( stateInfo.getValues() );
|
||||
}
|
||||
} else if ( ServiceConst.COMMAND_OPERATION.equals( command ) ) {
|
||||
try {
|
||||
@@ -833,7 +839,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
return false;
|
||||
}
|
||||
|
||||
private void changeCarHeadstockDirection( double degree ) {
|
||||
private void changeCarHeadstockDirection( final double degree ) {
|
||||
if ( mNavi.isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
@@ -846,7 +852,19 @@ public class MogoServices implements IMogoMapListener,
|
||||
if ( mUiController.getCurrentUiMode() != EnumMapUI.NorthUP_2D ) {
|
||||
return;
|
||||
}
|
||||
mUiController.showMyLocation( ( ( float ) degree ) );
|
||||
UiThreadHandler.post( () -> {
|
||||
mUiController.showMyLocation( ( ( float ) degree ) );
|
||||
} );
|
||||
}
|
||||
|
||||
private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) {
|
||||
if ( valuesBean == null ) {
|
||||
return;
|
||||
}
|
||||
Location location = new Location( LocationManager.GPS_PROVIDER );
|
||||
location.setAltitude( valuesBean.getAlt() );
|
||||
location.setLatitude( valuesBean.getLat() );
|
||||
location.setLongitude( valuesBean.getLon() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -151,6 +151,26 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_green_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_green);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_dark_frog2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_freeze2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_parking2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
ivIcon.setImageResource(R.drawable.module_service_ic_rc_accident2);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info);
|
||||
|
||||
@@ -130,6 +130,18 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shop);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_green_dark);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_dark_frog);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_freeze);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PARKING:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_parking);
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
ivBg.setImageResource(R.drawable.module_service_ic_rc_accident);
|
||||
break;
|
||||
default:
|
||||
ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news);
|
||||
ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark);
|
||||
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 360 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 551 B |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |