opt
This commit is contained in:
@@ -15,8 +15,10 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener2;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -80,81 +82,68 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
Logger.d( TAG, "action = %s", action );
|
||||
if ( TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
|
||||
Logger.d( "NaviManager", "key_type" + key_type );
|
||||
if ( key_type == 10027 ) {
|
||||
|
||||
if ( type == 0 ) {
|
||||
mView.getUIController().setTrafficEnabled( opera_type == 0 );
|
||||
} else if ( type == 1 ) {
|
||||
zoomMap( opera_type == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
if ( opera_type == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( opera_type == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( opera_type == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
|
||||
}
|
||||
} else if ( key_type == 10048 ) {
|
||||
//* @param type 0:自动; 1:白天; 2:黑夜
|
||||
int day_night_mode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
if ( day_night_mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( day_night_mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if ( day_night_mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
|
||||
//intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
|
||||
//intent.putExtra("KEY_TYPE", 10049);
|
||||
//intent.putExtra("EXTRA_ENDURANCE_DATA", continueNavi);
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extra_endurance_data ) {
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10006 ) {
|
||||
// int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
|
||||
// if ( extra_is_show == 0 ) {
|
||||
// onDisplayOverview();
|
||||
// } else {
|
||||
// onContinueNavigation();
|
||||
// }
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
|
||||
|
||||
} else if ( key_type == 20009 ) {
|
||||
onOpenNavi();
|
||||
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV ) ) {
|
||||
return;
|
||||
}
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
Logger.d( TAG, "key_type" + key_type );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( type == 0 ) {
|
||||
onChangeTrafficMode( opera_type );
|
||||
} else if ( type == 1 ) {
|
||||
zoomMap( opera_type == 0 );
|
||||
} else if ( type == 2 ) {
|
||||
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
|
||||
onChangeCameraMode( opera_type );
|
||||
}
|
||||
|
||||
///**
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
|
||||
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
|
||||
// *
|
||||
// * @param context
|
||||
// * @param type
|
||||
// */
|
||||
//public static void setUserPreference(Context context, int type) {
|
||||
// Intent intent = new Intent();
|
||||
// intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
|
||||
// intent.putExtra("KEY_TYPE", 10005);
|
||||
// intent.putExtra("NAVI_ROUTE_PREFER", type);
|
||||
// context.sendBroadcast(intent);
|
||||
} else if ( key_type == 10048 ) {
|
||||
//0:自动; 1:白天; 2:黑夜;
|
||||
int day_night_mode = intent.getIntExtra( "EXTRA_DAY_NIGHT_MODE", -1 );
|
||||
onChangeDayNightMode( day_night_mode );
|
||||
//继续导航
|
||||
} else if ( key_type == 10049 ) {
|
||||
boolean extra_endurance_data = intent.getBooleanExtra( "EXTRA_ENDURANCE_DATA", false );
|
||||
if ( extra_endurance_data ) {
|
||||
onContinueNavigation();
|
||||
}
|
||||
} else if ( key_type == 10006 ) {
|
||||
// 避免冲突,会同时发送两个广播,这里不操作。
|
||||
//int extra_is_show = intent.getIntExtra( "EXTRA_IS_SHOW", 0 );
|
||||
//if ( extra_is_show == 0 ) {
|
||||
// onDisplayOverview();
|
||||
//} else {
|
||||
// onContinueNavigation();
|
||||
//}
|
||||
//
|
||||
} else if ( key_type == 10005 ) {
|
||||
int navi_route_prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", type );
|
||||
} else if ( key_type == 20009 ) {
|
||||
onOpenNavi();
|
||||
} else if ( key_type == 10038 || key_type == 10007 ) {
|
||||
mLauncher.backToLauncher( getContext() );
|
||||
onChoosePath( intent, key_type );
|
||||
} else if ( key_type == 10021 ) {
|
||||
onStopNaviInternal();
|
||||
} else if ( key_type == 10005 ) {
|
||||
// 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// 避免收费 | 1
|
||||
// 多策略算路 | 2
|
||||
// 不走高速 | 3
|
||||
// 躲避拥堵 | 4
|
||||
// 不走高速且避免收费 | 5
|
||||
// 不走高速且躲避拥堵 | 6
|
||||
// 躲避收费和拥堵 | 7
|
||||
// 不走高速躲避收费和拥堵 | 8
|
||||
// 高速优先 | 20
|
||||
// 躲避拥堵且高速优先 | 24
|
||||
int prefer = intent.getIntExtra( "NAVI_ROUTE_PREFER", 0 );
|
||||
MogoNaviConfig config = new MogoNaviConfig().congestion( prefer == 4 )
|
||||
.cost( prefer == 1 || prefer == 7 )
|
||||
.highSpeed( prefer == 20 )
|
||||
.avoidSpeed( prefer == 3 );
|
||||
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -165,6 +154,66 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
getContext().registerReceiver( broadcastReceiver, inputFilter );
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换交通态势模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeTrafficMode( int mode ) {
|
||||
mView.getUIController().setTrafficEnabled( mode == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换地图视图朝向模式
|
||||
*/
|
||||
private void onChangeCameraMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.CarUp_3D );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换白天黑夜模式
|
||||
*
|
||||
* @param mode
|
||||
*/
|
||||
private void onChangeDayNightMode( int mode ) {
|
||||
if ( mode == 0 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
} else if ( mode == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if ( mode == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
}
|
||||
}
|
||||
|
||||
private void onStopNaviInternal() {
|
||||
mMogoMapService.getNavi( getContext() ).stopNavi();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 唤醒指令导航去哪里
|
||||
*/
|
||||
private void onChoosePath( Intent intent, int type ) {
|
||||
double lat;
|
||||
double lon;
|
||||
|
||||
if ( type == 10007 ) {
|
||||
lat = intent.getDoubleExtra( "ENTRY_LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "ENTRY_LON", 0.0 );
|
||||
} else {
|
||||
lat = intent.getDoubleExtra( "LAT", 0.0 );
|
||||
lon = intent.getDoubleExtra( "LON", 0.0 );
|
||||
|
||||
}
|
||||
mMogoAddressManager.calculatePath( new MogoLatLng( lat, lon ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续导航
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user