修改故障求助marker显示实现方式
修改自车图标设置实现
This commit is contained in:
@@ -54,17 +54,19 @@ class ADASStatusIntentHandler implements IntentHandler {
|
||||
}
|
||||
int status = intent.getIntExtra( MogoReceiver.PARAM_ADAS_STATUS, 0 );
|
||||
MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 );
|
||||
} else {
|
||||
String msg = intent.getStringExtra( "adasMsg" );
|
||||
if ( TextUtils.isEmpty( msg ) ) {
|
||||
return;
|
||||
}
|
||||
CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
|
||||
if ( stateInfo != null ) {
|
||||
changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
|
||||
// changeMyLocation( stateInfo.getValues() );
|
||||
}
|
||||
}
|
||||
// 由于adas可能调高此处的调用频率,存在anr风险,且此处没有作用,所以暂时注释掉
|
||||
// else {
|
||||
// String msg = intent.getStringExtra( "adasMsg" );
|
||||
// if ( TextUtils.isEmpty( msg ) ) {
|
||||
// return;
|
||||
// }
|
||||
// CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class );
|
||||
// if ( stateInfo != null ) {
|
||||
// changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() );
|
||||
// // changeMyLocation( stateInfo.getValues() );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void changeCarHeadstockDirection( final Context context, final double degree ) {
|
||||
|
||||
@@ -104,16 +104,17 @@ public class CarIconDisplayStrategy {
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
|
||||
private IMogoMarker mSeekHelpingMarker;
|
||||
private ArrayList< Bitmap > mBitmapFrames = new ArrayList<>();
|
||||
private ArrayList<Bitmap> mBitmapFrames = new ArrayList<>();
|
||||
|
||||
private CarIconDisplayStrategy() {
|
||||
mOption = new CarCursorOption.Builder().carCursorRes( R.drawable.module_service_ic_seek_helping ).build();
|
||||
mOption =
|
||||
new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping).build();
|
||||
}
|
||||
|
||||
public static CarIconDisplayStrategy getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( CarIconDisplayStrategy.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (CarIconDisplayStrategy.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new CarIconDisplayStrategy();
|
||||
}
|
||||
}
|
||||
@@ -127,19 +128,41 @@ public class CarIconDisplayStrategy {
|
||||
|
||||
private Handler mSeekHelpingHandler;
|
||||
private CarCursorOption mOption;
|
||||
private MogoMarkerOptions seekHelpMarkerOptions;
|
||||
// private IMogoMarker seekHelpMarker;
|
||||
|
||||
public void changeCarIconStatus( boolean seekHelpingStatus ) {
|
||||
if ( CarSeries.isF8xxSeries() ) {
|
||||
if ( seekHelpingStatus ) {
|
||||
|
||||
public void changeCarIconStatus(boolean seekHelpingStatus) {
|
||||
if (CarSeries.isF8xxSeries()) {
|
||||
if (seekHelpingStatus) {
|
||||
playSeekHelpingAnim();
|
||||
} else {
|
||||
stopSeekHelpingAnim();
|
||||
}
|
||||
} else {
|
||||
if ( seekHelpingStatus ) {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
if (seekHelpingStatus) {
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption( mOption );
|
||||
} else {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( null );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
try {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,29 +171,29 @@ public class CarIconDisplayStrategy {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed( msg, 0 );
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void initHandler() {
|
||||
if ( mSeekHelpingHandler != null ) {
|
||||
if (mSeekHelpingHandler != null) {
|
||||
return;
|
||||
}
|
||||
mSeekHelpingHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) {
|
||||
mSeekHelpingHandler = new Handler(WorkThreadHandler.getInstance().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
switch ( msg.what ) {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
playAnim();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case MSG_STOP_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
@@ -183,48 +206,59 @@ public class CarIconDisplayStrategy {
|
||||
initHandler();
|
||||
Message msg = Message.obtain();
|
||||
msg.what = MSG_STOP_SEEK_HELPING_ANIM;
|
||||
mSeekHelpingHandler.sendMessageDelayed( msg, 0 );
|
||||
mSeekHelpingHandler.sendMessageDelayed(msg, 0);
|
||||
}
|
||||
|
||||
private void playAnim() {
|
||||
try {
|
||||
for ( int i : sFrame ) {
|
||||
mBitmapFrames.add( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), i ) );
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker( TAG, new MogoMarkerOptions()
|
||||
.icons( mBitmapFrames )
|
||||
.period( 1 )
|
||||
.zIndex( 1000 )
|
||||
.autoManager( false )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.position( MarkerServiceHandler.getMapService().getNavi( AbsMogoApplication.getApp() ).getCarLocation2() ) );
|
||||
} catch ( Exception e ) {
|
||||
MarkerServiceHandler.getMapUIController().setCarCursorOption( new CarCursorOption.Builder().carCursorRes( R.drawable.module_service_ic_seek_helping_00036 ).build() );
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icons(mBitmapFrames)
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(
|
||||
TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icon(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.module_service_ic_seek_helping))
|
||||
.period(1)
|
||||
.zIndex(1000)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2()));
|
||||
// MarkerServiceHandler.getMapUIController().setCarCursorOption(new CarCursorOption.Builder().carCursorRes(R.drawable.module_service_ic_seek_helping_00036).build());
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( false );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(false);
|
||||
}
|
||||
|
||||
private void stopAnim() {
|
||||
try {
|
||||
if ( mSeekHelpingMarker != null ) {
|
||||
if (mSeekHelpingMarker != null) {
|
||||
mSeekHelpingMarker.destroy();
|
||||
mSeekHelpingMarker = null;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
if ( !mBitmapFrames.isEmpty() ) {
|
||||
for ( Bitmap bitmapFrame : mBitmapFrames ) {
|
||||
if ( bitmapFrame != null && !bitmapFrame.isRecycled() ) {
|
||||
if (!mBitmapFrames.isEmpty()) {
|
||||
for (Bitmap bitmapFrame : mBitmapFrames) {
|
||||
if (bitmapFrame != null && !bitmapFrame.isRecycled()) {
|
||||
bitmapFrame.recycle();
|
||||
}
|
||||
}
|
||||
mBitmapFrames.clear();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation( true );
|
||||
MarkerServiceHandler.getMapUIController().showMyLocation(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user