@Override
public void initView() {
//设置标题
setActionBarWithTitle(toolbar, getResources().getString(R.string.app_name));
//设置地图
mainPresenter.configBaiduMap();
//绑定轨迹绘制工具
drawTool = new DrawTool(mBaiduMap, this);
//设置初始位置
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(new LatLng(32.129927, 118.913191)));
//绑定位置模拟显示当前位置,控制模拟线程
mockLocationHelper = new MockLocationHelper(this, mBaiduMap);
RxBus.getDefault().toObserverable(EmulatorPanelView.EmulatorPanelEvent.class)
.subscribe(
new Action1<EmulatorPanelView.EmulatorPanelEvent>() {
@Override
public void call(EmulatorPanelView.EmulatorPanelEvent emulatorPanelEvent) {
if (emulatorPanelEvent.getState() == EmulatorPanelView.EmulatorPanelState.OPEN_FILE) {
new FileChooserDialog.Builder(MainActivity.this)
.chooseButton(R.string.choose_file) // changes label of the choose button
.cancelButton(R.string.cancel)
.initialPath(GpsJsonFileHelper.sAppFolder) // changes initial path, defaults to external storage directory
.mimeType("text/plain") // Optional MIME type filter
.tag("choose-location-file-id")
.show();
//startActivityForResult(new Intent(MainActivity.this, LocationFilesActivity.class), MLConstant.ACTIVITY_REQUEST_CODE.JSON_FILES);
} else {
// ignore , mocklocation helper will take these
}
}
},
new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
Logger.e(throwable, "on EmulatorPanelEvent Error in MainAc");
}
}
);
}
MainActivity.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:MockLocations
作者:
评论列表
文章目录