调整
This commit is contained in:
@@ -76,6 +76,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.AppCompatButton;
|
||||||
import io.flutter.plugin.platform.PlatformView;
|
import io.flutter.plugin.platform.PlatformView;
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
@@ -204,6 +205,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
|
|
||||||
endInput = new TextView(context);
|
endInput = new TextView(context);
|
||||||
endInput.setHint("请输入目的地,不输入则自动匹配推荐加氢站");
|
endInput.setHint("请输入目的地,不输入则自动匹配推荐加氢站");
|
||||||
|
endInput.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_search, 0, 0, 0);
|
||||||
|
endInput.setCompoundDrawablePadding(dp2px(8));
|
||||||
endInput.setTextSize(13);
|
endInput.setTextSize(13);
|
||||||
endInput.setTextColor(Color.parseColor("#333333"));
|
endInput.setTextColor(Color.parseColor("#333333"));
|
||||||
endInput.setHintTextColor(Color.GRAY);
|
endInput.setHintTextColor(Color.GRAY);
|
||||||
@@ -248,8 +251,12 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
View vSpace = new View(context);
|
View vSpace = new View(context);
|
||||||
searchArea.addView(vSpace, new LinearLayout.LayoutParams(1, dp2px(12)));
|
searchArea.addView(vSpace, new LinearLayout.LayoutParams(1, dp2px(12)));
|
||||||
|
|
||||||
Button planBtn = new Button(context);
|
AppCompatButton planBtn = new AppCompatButton(context);
|
||||||
planBtn.setText("规划路线");
|
planBtn.setText("规划路线");
|
||||||
|
planBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_path, 0, 0, 0);
|
||||||
|
planBtn.setCompoundDrawablePadding(dp2px(4));
|
||||||
|
planBtn.setGravity(Gravity.CENTER);
|
||||||
|
planBtn.setPadding(dp2px(8), 0, dp2px(8), 0);
|
||||||
planBtn.setTextColor(Color.WHITE);
|
planBtn.setTextColor(Color.WHITE);
|
||||||
planBtn.setTypeface(Typeface.DEFAULT_BOLD);
|
planBtn.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
planBtn.setBackground(getRoundedDrawable(Color.parseColor("#017143"), 99));
|
planBtn.setBackground(getRoundedDrawable(Color.parseColor("#017143"), 99));
|
||||||
@@ -377,8 +384,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
row1.setOrientation(LinearLayout.HORIZONTAL);
|
row1.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
row1.setGravity(Gravity.CENTER_VERTICAL);
|
row1.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
row1.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
row1.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||||
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "", 1.0f);
|
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "-", 1.0f);
|
||||||
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "", 1.0f);
|
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "-", 1.0f);
|
||||||
routeInfoLayout.addView(row1);
|
routeInfoLayout.addView(row1);
|
||||||
|
|
||||||
// 第二行:里程 + 过路费
|
// 第二行:里程 + 过路费
|
||||||
@@ -388,9 +395,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
row2.setPadding(0, dp2px(10), 0, 0); // 增加行间距
|
row2.setPadding(0, dp2px(10), 0, 0); // 增加行间距
|
||||||
|
|
||||||
// 里程
|
// 里程
|
||||||
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "", 1.0f);
|
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "-", 1.0f);
|
||||||
// 过路费
|
// 过路费
|
||||||
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "", 1.0f);
|
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "-", 1.0f);
|
||||||
routeInfoLayout.addView(row2);
|
routeInfoLayout.addView(row2);
|
||||||
|
|
||||||
//第三行
|
//第三行
|
||||||
@@ -398,15 +405,15 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
row3.setOrientation(LinearLayout.HORIZONTAL);
|
row3.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
row3.setGravity(Gravity.CENTER_VERTICAL);
|
row3.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
row3.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
row3.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||||
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "", 1.0f);
|
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "-", 1.0f);
|
||||||
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "", 1.0f);
|
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "-", 1.0f);
|
||||||
routeInfoLayout.addView(row3);
|
routeInfoLayout.addView(row3);
|
||||||
|
|
||||||
LinearLayout row4 = new LinearLayout(context);
|
LinearLayout row4 = new LinearLayout(context);
|
||||||
row4.setOrientation(LinearLayout.HORIZONTAL);
|
row4.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
row4.setGravity(Gravity.CENTER_VERTICAL);
|
row4.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
row4.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
row4.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||||
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "", 1.0f);
|
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "-", 1.0f);
|
||||||
routeInfoLayout.addView(row4);
|
routeInfoLayout.addView(row4);
|
||||||
|
|
||||||
|
|
||||||
@@ -431,6 +438,7 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
searchArea.setVisibility(View.VISIBLE);
|
searchArea.setVisibility(View.VISIBLE);
|
||||||
planToggleBtn.setVisibility(View.VISIBLE);
|
planToggleBtn.setVisibility(View.VISIBLE);
|
||||||
mLocBtn.setVisibility(View.VISIBLE);
|
mLocBtn.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isGetInputtips = false;
|
private boolean isGetInputtips = false;
|
||||||
@@ -449,6 +457,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
//如果是输入地址提示内容
|
//如果是输入地址提示内容
|
||||||
|
|
||||||
if (isGetInputtips) {
|
if (isGetInputtips) {
|
||||||
|
truckRouteData = null;
|
||||||
|
|
||||||
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(new LatLonPoint(startPoint.latitude, startPoint.longitude), new LatLonPoint(endPoint.latitude, endPoint.longitude));
|
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(new LatLonPoint(startPoint.latitude, startPoint.longitude), new LatLonPoint(endPoint.latitude, endPoint.longitude));
|
||||||
RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, null, null, "");
|
RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, null, null, "");
|
||||||
routeSearch.calculateDriveRouteAsyn(query);
|
routeSearch.calculateDriveRouteAsyn(query);
|
||||||
@@ -478,6 +488,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
String liaisonPhone = "-";
|
String liaisonPhone = "-";
|
||||||
String startBusiness = "-";
|
String startBusiness = "-";
|
||||||
String endBusiness = "-";
|
String endBusiness = "-";
|
||||||
|
double distanceKm = 0;
|
||||||
|
String distanceKmStr = "-";
|
||||||
|
long durationMin = 0;
|
||||||
|
String durationMinStr = "-";
|
||||||
|
String tolls = "-";
|
||||||
|
|
||||||
if (rCode == AMapException.CODE_AMAP_SUCCESS && result != null && !result.getPaths().isEmpty()) {
|
if (rCode == AMapException.CODE_AMAP_SUCCESS && result != null && !result.getPaths().isEmpty()) {
|
||||||
|
|
||||||
@@ -494,17 +509,19 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
tvStationName.setText(endName);
|
tvStationName.setText(endName);
|
||||||
tvStationAddr.setText(endAddress);
|
tvStationAddr.setText(endAddress);
|
||||||
|
|
||||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
|
||||||
|
|
||||||
|
if (truckRouteData != null) {
|
||||||
PathDto pathDto = truckRouteData.pathDto;
|
PathDto pathDto = truckRouteData.pathDto;
|
||||||
double distanceKm = 0;
|
|
||||||
long durationMin = 0;
|
|
||||||
String tolls = "-";
|
|
||||||
if (pathDto != null) {
|
if (pathDto != null) {
|
||||||
distanceKm = pathDto.distance / 1000f;
|
distanceKm = pathDto.distance / 1000f;
|
||||||
durationMin = pathDto.duration / 60;
|
durationMin = pathDto.duration / 60;
|
||||||
tolls = pathDto.tolls + "元";
|
tolls = pathDto.tolls + "元";
|
||||||
|
|
||||||
|
distanceKmStr = String.format("%.1f", distanceKm) + "公里";
|
||||||
|
durationMinStr = durationMin + "分钟";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 增加多级非空校验,防止点击搜索条目时崩溃
|
// 增加多级非空校验,防止点击搜索条目时崩溃
|
||||||
if (truckRouteData != null &&
|
if (truckRouteData != null &&
|
||||||
@@ -515,26 +532,31 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
hydrogenCost = (isGetInputtips ? "--" : hydrogenCost) + "元";
|
hydrogenCost = (isGetInputtips ? "--" : hydrogenCost) + "元";
|
||||||
}
|
}
|
||||||
|
|
||||||
tvDuration.setText("预计时间:" + durationMin + "分钟");
|
tvDuration.setText("预计时间:" + durationMinStr);
|
||||||
tvDistance.setText("行驶里程:" + String.format("%.1f", distanceKm) + "公里");
|
tvDistance.setText("行驶里程:" + distanceKmStr);
|
||||||
tvTolls.setText("过路费:" + tolls);
|
tvTolls.setText("过路费:" + tolls);
|
||||||
tvTollsFuel.setText("预计加氢费用:" + hydrogenCost);
|
tvTollsFuel.setText("预计加氢费用:" + hydrogenCost);
|
||||||
|
|
||||||
|
|
||||||
|
if (truckRouteData != null) {
|
||||||
|
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||||
if (destinationSite != null) {
|
if (destinationSite != null) {
|
||||||
startBusiness = destinationSite.startBusiness;
|
startBusiness = destinationSite.startBusiness;
|
||||||
endBusiness = destinationSite.endBusiness;
|
endBusiness = destinationSite.endBusiness;
|
||||||
hydrogenPrice = destinationSite.hydrogenPrice;
|
hydrogenPrice = destinationSite.hydrogenPrice + "/L";
|
||||||
liaisonName = destinationSite.liaisonName;
|
liaisonName = destinationSite.liaisonName;
|
||||||
liaisonPhone = destinationSite.liaisonPhone;
|
liaisonPhone = destinationSite.liaisonPhone;
|
||||||
|
//开始结束时间
|
||||||
|
startBusiness = startBusiness + "-" + endBusiness;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tvBusinessHours.setText("营业时间:" + startBusiness + "-" + endBusiness);
|
tvBusinessHours.setText("营业时间:" + startBusiness);
|
||||||
String displayValue = "";
|
|
||||||
if (liaisonName != null && liaisonName.length() > 5) {
|
if (liaisonName != null && liaisonName.length() > 5) {
|
||||||
displayValue = liaisonName.substring(0, 5) + "...";
|
liaisonName = liaisonName.substring(0, 5) + "...";
|
||||||
}
|
}
|
||||||
tvPerson.setText("站联系人:" + displayValue);
|
tvPerson.setText("站联系人:" + liaisonName);
|
||||||
tvPrice.setText("加氢价格:" + hydrogenPrice + "/L");
|
tvPrice.setText("加氢价格:" + hydrogenPrice);
|
||||||
tvPhone.setText("联系方式:" + liaisonPhone);
|
tvPhone.setText("联系方式:" + liaisonPhone);
|
||||||
|
|
||||||
isGetInputtips = false;
|
isGetInputtips = false;
|
||||||
@@ -634,6 +656,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
// 检查途径点数量,决定使用哪种导航方式
|
// 检查途径点数量,决定使用哪种导航方式
|
||||||
int wayPointsCount = waysPoiIds.size();
|
int wayPointsCount = waysPoiIds.size();
|
||||||
Log.d(TAG, "途经点数量: " + wayPointsCount);
|
Log.d(TAG, "途经点数量: " + wayPointsCount);
|
||||||
|
|
||||||
|
//如果是输入地址提示内容,不判断途经点
|
||||||
|
if (isGetInputtips) {
|
||||||
|
wayPointsCount = 0;
|
||||||
|
}
|
||||||
if (wayPointsCount > 3) {
|
if (wayPointsCount > 3) {
|
||||||
// 途经点超过3个,跳转到 NavigationActivity
|
// 途经点超过3个,跳转到 NavigationActivity
|
||||||
Intent intent = new Intent(mContext, NavigationActivity.class);
|
Intent intent = new Intent(mContext, NavigationActivity.class);
|
||||||
@@ -826,11 +853,13 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||||
resetView();
|
resetView();
|
||||||
}
|
}
|
||||||
|
modeMenu.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
aMap.setOnPOIClickListener(poi -> {
|
aMap.setOnPOIClickListener(poi -> {
|
||||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||||
resetView();
|
resetView();
|
||||||
}
|
}
|
||||||
|
modeMenu.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
MyLocationStyle myLocationStyle = new MyLocationStyle();
|
MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||||
@@ -1259,7 +1288,6 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
TextView tv = new TextView(mContext);
|
TextView tv = new TextView(mContext);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tv.setText(label + value);
|
tv.setText(label + value);
|
||||||
|
|
||||||
tv.setTextSize(12);
|
tv.setTextSize(12);
|
||||||
@@ -1298,9 +1326,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
|||||||
TextView item3 = createMenuItem(context, "加氢规划模式", true);
|
TextView item3 = createMenuItem(context, "加氢规划模式", true);
|
||||||
item3.setOnClickListener(v -> switchMode("加氢规划"));
|
item3.setOnClickListener(v -> switchMode("加氢规划"));
|
||||||
|
|
||||||
menu.addView(item1);
|
|
||||||
menu.addView(item2);
|
|
||||||
menu.addView(item3);
|
menu.addView(item3);
|
||||||
|
menu.addView(item2);
|
||||||
|
menu.addView(item1);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
@@ -12,17 +12,17 @@
|
|||||||
|
|
||||||
#import "AMapNavCommonUtil.h"
|
#import "AMapNavCommonUtil.h"
|
||||||
|
|
||||||
@interface ASearchAddressController ()<UITextFieldDelegate , AMapSearchDelegate,UITableViewDelegate , UITableViewDataSource>
|
@interface ASearchAddressController () <UITextFieldDelegate, AMapSearchDelegate, UITableViewDelegate, UITableViewDataSource>
|
||||||
|
|
||||||
@property (nonatomic , strong) UITableView *tableView;
|
@property(nonatomic, strong) UITableView *tableView;
|
||||||
@property (nonatomic , strong) UIBarButtonItem *rightItem;
|
@property(nonatomic, strong) UIBarButtonItem *rightItem;
|
||||||
@property (nonatomic ,strong)UIButton * backBtn;
|
@property(nonatomic, strong) UIButton *backBtn;
|
||||||
|
|
||||||
@property (nonatomic , strong) NSMutableArray *dataArr;
|
@property(nonatomic, strong) NSMutableArray *dataArr;
|
||||||
|
|
||||||
@property (nonatomic, strong) UITextField *inputAddressTf;
|
@property(nonatomic, strong) UITextField *inputAddressTf;
|
||||||
@property (nonatomic, strong) AMapSearchAPI *search;
|
@property(nonatomic, strong) AMapSearchAPI *search;
|
||||||
@property (nonatomic,assign)NSInteger currPage;
|
@property(nonatomic, assign) NSInteger currPage;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -56,10 +56,10 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)initSubview {
|
- (void)initSubview {
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.backBtn];
|
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.backBtn];
|
||||||
|
|
||||||
UITextField * inputAddressTf = [[UITextField alloc] init];
|
UITextField *inputAddressTf = [[UITextField alloc] init];
|
||||||
inputAddressTf.borderStyle = UITextBorderStyleRoundedRect;
|
inputAddressTf.borderStyle = UITextBorderStyleRoundedRect;
|
||||||
inputAddressTf.placeholder = @"输入地址";
|
inputAddressTf.placeholder = @"输入地址";
|
||||||
inputAddressTf.returnKeyType = UIReturnKeySearch;
|
inputAddressTf.returnKeyType = UIReturnKeySearch;
|
||||||
@@ -77,8 +77,7 @@
|
|||||||
self.inputAddressTf = inputAddressTf;
|
self.inputAddressTf = inputAddressTf;
|
||||||
|
|
||||||
|
|
||||||
|
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
||||||
[btn setTitle:@"当前位置" forState:UIControlStateNormal];
|
[btn setTitle:@"当前位置" forState:UIControlStateNormal];
|
||||||
btn.backgroundColor = [UIColor whiteColor];
|
btn.backgroundColor = [UIColor whiteColor];
|
||||||
btn.layer.borderColor = [UIColor blueColor].CGColor;
|
btn.layer.borderColor = [UIColor blueColor].CGColor;
|
||||||
@@ -112,25 +111,38 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
|
||||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
- (nonnull UITableViewCell
|
||||||
|
|
||||||
|
*)tableView:(
|
||||||
|
nonnull UITableView
|
||||||
|
*)
|
||||||
|
tableView cellForRowAtIndexPath
|
||||||
|
:(
|
||||||
|
nonnull NSIndexPath
|
||||||
|
*)indexPath {
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
|
||||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
AMapPOI * m = self.dataArr[indexPath.row];
|
AMapPOI *m = self.dataArr[indexPath.row];
|
||||||
cell.textLabel.text = [NSString stringWithFormat:@"%@" , m.name ];
|
cell.textLabel.text = [NSString stringWithFormat:@"%@", m.name];
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
- (NSInteger)tableView:(nonnull UITableView
|
||||||
|
|
||||||
|
*)
|
||||||
|
tableView numberOfRowsInSection
|
||||||
|
:(NSInteger)section {
|
||||||
return self.dataArr.count;
|
return self.dataArr.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
AMapPOI * m = self.dataArr[indexPath.row];
|
AMapPOI *m = self.dataArr[indexPath.row];
|
||||||
|
|
||||||
if (self.selectAddressBlk) {
|
if (self.selectAddressBlk) {
|
||||||
self.selectAddressBlk(m);
|
self.selectAddressBlk(m);
|
||||||
@@ -149,6 +161,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
- (UITableView *)tableView {
|
- (UITableView *)tableView {
|
||||||
if (!_tableView) {
|
if (!_tableView) {
|
||||||
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
|
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
|
||||||
@@ -159,7 +172,7 @@
|
|||||||
return _tableView;
|
return _tableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(UIButton *)backBtn{
|
- (UIButton *)backBtn {
|
||||||
if (!_backBtn) {
|
if (!_backBtn) {
|
||||||
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
_backBtn.frame = CGRectMake(0, 0, 40, 30);
|
_backBtn.frame = CGRectMake(0, 0, 40, 30);
|
||||||
@@ -172,7 +185,7 @@
|
|||||||
return _backBtn;
|
return _backBtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)backBtnAction {
|
- (void)backBtnAction {
|
||||||
[self dismissViewControllerAnimated:YES completion:^{
|
[self dismissViewControllerAnimated:YES completion:^{
|
||||||
|
|
||||||
}];
|
}];
|
||||||
@@ -180,14 +193,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Action
|
#pragma mark - Action
|
||||||
-(void)searchBtnAction {
|
|
||||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
- (void)searchBtnAction {
|
||||||
|
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||||
self.inputAddressTf.text = sdk.locationAddressDetail;
|
self.inputAddressTf.text = sdk.locationAddressDetail;
|
||||||
|
|
||||||
[self startSearchWithAddress:self.inputAddressTf.text];
|
[self startSearchWithAddress:self.inputAddressTf.text];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)startSearchWithAddress:(NSString *)addr {
|
- (void)startSearchWithAddress:(NSString *)addr {
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -196,17 +210,17 @@
|
|||||||
|
|
||||||
request.keywords = addr;
|
request.keywords = addr;
|
||||||
|
|
||||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||||
request.city = sdk.localCity;
|
request.city = sdk.localCity;
|
||||||
|
|
||||||
|
|
||||||
// request.types = @"高等院校";
|
// request.types = @"高等院校";
|
||||||
// request.requireExtension = YES;
|
// request.requireExtension = YES;
|
||||||
request.offset =20;
|
request.offset = 20;
|
||||||
request.page = 1;
|
request.page = 1;
|
||||||
|
|
||||||
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
||||||
request.cityLimit = YES;
|
// request.cityLimit = YES;
|
||||||
// request.requireSubPOIs = YES;
|
// request.requireSubPOIs = YES;
|
||||||
|
|
||||||
|
|
||||||
@@ -214,18 +228,18 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
|
- (void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
|
||||||
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
|
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
|
||||||
|
|
||||||
request.keywords = addr;
|
request.keywords = addr;
|
||||||
|
|
||||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||||
request.city = sdk.localCity;
|
request.city = sdk.localCity;
|
||||||
|
|
||||||
|
|
||||||
// request.types = @"高等院校";
|
// request.types = @"高等院校";
|
||||||
// request.requireExtension = YES;
|
// request.requireExtension = YES;
|
||||||
request.offset =20;
|
request.offset = 20;
|
||||||
request.page = page;
|
request.page = page;
|
||||||
|
|
||||||
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
||||||
@@ -237,12 +251,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
/* POI 搜索回调. */
|
/* POI 搜索回调. */
|
||||||
- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response
|
- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response {
|
||||||
{
|
NSArray *pois = response.pois;
|
||||||
NSArray * pois = response.pois;
|
if (pois.count == 0) {
|
||||||
if (pois.count == 0)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +268,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||||
[textField resignFirstResponder];
|
[textField resignFirstResponder];
|
||||||
[self.dataArr removeAllObjects];
|
[self.dataArr removeAllObjects];
|
||||||
@@ -267,8 +279,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)touchesBegan:(NSSet
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
<UITouch *> *)
|
||||||
|
touches withEvent
|
||||||
|
:(UIEvent *)event {
|
||||||
[self.inputAddressTf resignFirstResponder];
|
[self.inputAddressTf resignFirstResponder];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user