| | |
| | | package com.future.driver.base.gaode.gpsnav; |
| | | |
| | | import android.os.Bundle; |
| | | import android.view.WindowManager; |
| | | |
| | | import com.amap.api.navi.AMapNaviViewOptions; |
| | | import com.amap.api.navi.enums.NaviType; |
| | | import com.future.driver.R; |
| | | import com.future.driver.base.BaseEvent; |
| | | |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | |
| | | public class GPSNaviActivity extends BaseGpsMapActivity { |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
| | | super.onCreate(savedInstanceState); |
| | | |
| | | setContentView(R.layout.activity_basic_navi); |
| | |
| | | AMapNaviViewOptions options = new AMapNaviViewOptions(); |
| | | options.setScreenAlwaysBright(false); |
| | | mAMapNaviView.setViewOptions(options); |
| | | |
| | | EventBus.getDefault().register(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void onCalculateRouteSuccess(int[] ids) { |
| | | super.onCalculateRouteSuccess(ids); |
| | | mAMapNavi.startNavi(NaviType.GPS); |
| | | // mAMapNavi.startNavi(NaviType.EMULATOR); |
| | | |
| | | } |
| | | |
| | | @Subscribe |
| | | public void exitNavi(BaseEvent e){ |
| | | if (e.getCode() == BaseEvent.EXIT_NAVI) |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onArriveDestination() { |
| | | super.onArriveDestination(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | public void onEndEmulatorNavi() { |
| | | super.onEndEmulatorNavi(); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | EventBus.getDefault().unregister(this); |
| | | } |
| | | } |