android-trip-search
出行类app结合了叫车主页和检索的demo
前述
配置搭建AndroidSDK工程
使用场景
AMapTripModule 提供了叫车主页的组件
组件截图
gradle中引入AmapPoiSearchModule和AMapTripModule
settings.gradle 配置
include ':app'
include ':AMapTripModule'
project(":AMapTripModule").projectDir=new File("AMapTripModule路径")
//you can include the AmapPoiSearchModule if you'd like to DIY
// AmapPoiSearchModule的下载地址:https://github.com/amap-demo/android-poisearch-demo
//include ':AmapPoiSearchModule'
//project(":AmapPoiSearchModule").projectDir = new File("AmapPoiSearchModule路径")
build.gradle 配置
dependencies {
.......
compile 'com.amap.api:tripmodule:1.0.0'
compile 'com.amap.api:poisearchmodule:1.1.0'
compile 'com.amap.api:3dmap:latest.integration'
compile 'com.amap.api:search:latest.integration'
compile 'com.amap.api:location:latest.integration'
compile 'com.google.code.gson:gson:2.8.0'
.......
}
使用方法
此处以MainActivity为例进行介绍:
step1. 在onCreate中初始化Widget和ModuleDelegte
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout contentView = (RelativeLayout)findViewById(R.id.content_view);
mTripHostDelegate = new TripHostModuleDelegate();
mTripHostDelegate.bindParentDelegate(mParentTripDelegate);
contentView.addView(mTripHostDelegate.getWidget(this));
mTripHostDelegate.onCreate(savedInstanceState);
}
step2. 在TripHostModuleDelegate.IParentDelegate进行回调逻辑
private IParentDelegate mParentTripDelegate = new IParentDelegate() {
@Override
public void onStartCall() {
showMsg("on start call");
}
};
......