Merge branch 'dev_map' into dev

version 1.2.5
# Conflicts:
#	ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/Class/ASearchAddressController.m
#	ln_jq_app/ios/AMapNavIOSSDK/AMapNavIOSSDK/Classes/View/AStationDetailPopupView.m
This commit is contained in:
2026-04-16 10:50:57 +08:00
6 changed files with 433 additions and 398 deletions

View File

@@ -37,8 +37,8 @@ android {
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 7 versionCode = 8
versionName = "1.2.4" versionName = "1.2.5"
} }
signingConfigs { signingConfigs {

View File

@@ -74,6 +74,8 @@
/// ///
@property (nonatomic, weak) UIButton *addHBtn; @property (nonatomic, weak) UIButton *addHBtn;
@property (nonatomic ,strong)MAAnnotationView * currAnnotionView;
@end @end
@implementation ARoutePlaneController @implementation ARoutePlaneController
@@ -285,7 +287,8 @@
[bottomBar mas_makeConstraints:^(MASConstraintMaker *make) { [bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view); make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-AMP_TabbarHeight - 10); // make.bottom.equalTo(self.view).offset(-AMP_TabbarHeight - 13);
make.bottom.equalTo(self.view).offset(0);
}]; }];
// startTf / dstTf // startTf / dstTf
@@ -426,7 +429,7 @@
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(self.latitude, self.longitude); CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(self.latitude, self.longitude);
[_mapView setCenterCoordinate:coord animated:YES]; [_mapView setCenterCoordinate:coord animated:YES];
// [_mapView setZoomLevel:10 animated:YES]; [_mapView setZoomLevel:15.0 animated:YES];
} else { } else {
// //
[_mapView setUserTrackingMode:MAUserTrackingModeFollow animated:YES]; [_mapView setUserTrackingMode:MAUserTrackingModeFollow animated:YES];
@@ -1018,6 +1021,7 @@
} }
- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view { - (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view {
self.currAnnotionView = view;
id pointAnnotation = view.annotation; id pointAnnotation = view.annotation;
if ([pointAnnotation isMemberOfClass:ACustomPointAnnotation.class]) { if ([pointAnnotation isMemberOfClass:ACustomPointAnnotation.class]) {
@@ -1041,6 +1045,7 @@
// //
// self.bottomBarView.destinationText = aoi.name; // self.bottomBarView.destinationText = aoi.name;
self.bottomBarView.destinationText = nil;
} }
} }
@@ -1052,6 +1057,7 @@
self.dstPoi = nil; self.dstPoi = nil;
self.dstTf.text = nil; self.dstTf.text = nil;
self.bottomBarView.destinationText = nil; self.bottomBarView.destinationText = nil;
self.currAnnotionView = nil;
} }
} }
@@ -1199,6 +1205,10 @@
#pragma mark - ABottomBarViewDelegate #pragma mark - ABottomBarViewDelegate
- (void)bottomBarViewDidTapCalRoute:(ABottomBarView *)barView { - (void)bottomBarViewDidTapCalRoute:(ABottomBarView *)barView {
if (self.currAnnotionView) {
[self.mapView deselectAnnotation:self.currAnnotionView.annotation animated:NO];
self.currAnnotionView = nil;
}
// //
[self willRequestTJDInfo]; [self willRequestTJDInfo];
@@ -1209,6 +1219,11 @@
/// ///
self.tjdPathInfoModel = nil; self.tjdPathInfoModel = nil;
if (self.currAnnotionView) {
[self.mapView deselectAnnotation:self.currAnnotionView.annotation animated:NO];
self.currAnnotionView = nil;
}
// //
ASearchAddressController *vc = [[ASearchAddressController alloc] init]; ASearchAddressController *vc = [[ASearchAddressController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];

View File

@@ -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
@@ -34,50 +34,52 @@
self.title = @"选择地点"; self.title = @"选择地点";
self.currPage = 1; self.currPage = 1;
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
[self initSubview]; [self initSubview];
self.search = [[AMapSearchAPI alloc] init]; self.search = [[AMapSearchAPI alloc] init];
self.search.delegate = self; self.search.delegate = self;
#ifdef kAMapSDKDebugFlag #ifdef kAMapSDKDebugFlag
self.inputAddressTf.text = @"人民广场"; self.inputAddressTf.text = @"人民广场";
#endif #endif
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.inputAddressTf becomeFirstResponder]; [self.inputAddressTf becomeFirstResponder];
}); });
} }
- (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;
inputAddressTf.tag = 100; inputAddressTf.tag = 100;
inputAddressTf.delegate = self; inputAddressTf.delegate = self;
[self.view addSubview:inputAddressTf]; [self.view addSubview:inputAddressTf];
[inputAddressTf mas_makeConstraints:^(MASConstraintMaker *make) { [inputAddressTf mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.view).offset(10); make.left.mas_equalTo(self.view).offset(10);
make.right.mas_equalTo(self.view).offset(-10);
make.top.mas_equalTo(self.view).offset(kRoutePlanBarHeight + 10); make.top.mas_equalTo(self.view).offset(kRoutePlanBarHeight + 10);
make.height.mas_equalTo(@30); make.height.mas_equalTo(@35);
}]; }];
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;
@@ -85,69 +87,56 @@
btn.layer.cornerRadius = 5; btn.layer.cornerRadius = 5;
btn.titleLabel.font = [UIFont systemFontOfSize:12]; btn.titleLabel.font = [UIFont systemFontOfSize:12];
btn.hidden = YES; btn.hidden = YES;
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside]; [btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn]; [self.view addSubview:btn];
[btn mas_makeConstraints:^(MASConstraintMaker *make) { [btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(inputAddressTf.mas_right).offset(12); make.left.equalTo(inputAddressTf.mas_right).offset(12);
make.top.mas_equalTo(inputAddressTf); make.top.mas_equalTo(inputAddressTf);
make.right.mas_equalTo(self.view).offset(-10); make.right.mas_equalTo(self.view).offset(-10);
make.height.mas_equalTo(@30); make.height.mas_equalTo(@30);
make.width.mas_equalTo(70); make.width.mas_equalTo(70);
}]; }];
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(inputAddressTf.mas_bottom).offset(5); make.top.mas_equalTo(inputAddressTf.mas_bottom).offset(5);
make.left.equalTo(self.view); make.left.equalTo(self.view);
make.bottom.equalTo(self.view); make.bottom.equalTo(self.view);
make.centerX.equalTo(self.view); make.centerX.equalTo(self.view);
}]; }];
[self.tableView reloadData]; [self.tableView reloadData];
} }
#pragma mark - #pragma mark -
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
- (nonnull UITableViewCell UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
*)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 - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
*)
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);
} }
[self backBtnAction]; [self backBtnAction];
// [self.navigationController popViewControllerAnimated:YES]; // [self.navigationController popViewControllerAnimated:YES];
} }
@@ -157,27 +146,26 @@ tableView numberOfRowsInSection
self.currPage = self.currPage + 1; self.currPage = self.currPage + 1;
[self requestAddressWithAddress:self.inputAddressTf.text atPage:self.currPage]; [self requestAddressWithAddress:self.inputAddressTf.text atPage:self.currPage];
} }
} }
#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];
_tableView.delegate = self; _tableView.delegate = self;
_tableView.dataSource = self; _tableView.dataSource = self;
} }
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);
_backBtn.imageEdgeInsets = UIEdgeInsetsMake(2, -5, 2, 5); _backBtn.imageEdgeInsets = UIEdgeInsetsMake(2, -5, 2, 5);
// _backBtn.backgroundColor = UIColor.redColor; // _backBtn.backgroundColor = UIColor.redColor;
[_backBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_fanhui"] forState:UIControlStateNormal]; [_backBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_fanhui"] forState:UIControlStateNormal];
[_backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside]; [_backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
@@ -185,105 +173,85 @@ tableView numberOfRowsInSection
return _backBtn; return _backBtn;
} }
- (void)backBtnAction { -(void)backBtnAction {
[self dismissViewControllerAnimated:YES completion:^{ [self dismissViewControllerAnimated:YES completion:^{
}]; }];
} }
#pragma mark - Action #pragma mark - Action
-(void)searchBtnAction {
- (void)searchBtnAction { AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
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;
} }
[self requestAddressWithAddress:addr atPage:1];
}
-(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 = 1; request.page = page;
/* SDK 3.2.0 POI*/ /* SDK 3.2.0 POI*/
// request.cityLimit = YES; // request.cityLimit = YES;
// request.requireSubPOIs = YES; // request.requireSubPOIs = YES;
[self.search AMapPOIKeywordsSearch:request];
}
- (void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
request.keywords = addr;
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
request.city = sdk.localCity;
// request.types = @"高等院校";
// request.requireExtension = YES;
request.offset = 20;
request.page = page;
/* SDK 3.2.0 POI*/
request.cityLimit = YES;
// request.requireSubPOIs = YES;
[self.search AMapPOIKeywordsSearch:request]; [self.search AMapPOIKeywordsSearch:request];
} }
#pragma mark - #pragma mark -
/* POI . */ /* POI . */
- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response { - (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response
NSArray *pois = response.pois; {
if (pois.count == 0) { NSArray * pois = response.pois;
if (pois.count == 0)
{
return; return;
} }
//responsePOI Demo //responsePOI Demo
[self.dataArr addObjectsFromArray:pois]; [self.dataArr addObjectsFromArray:pois];
[self.tableView reloadData]; [self.tableView reloadData];
} }
- (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder]; [textField resignFirstResponder];
[self.dataArr removeAllObjects]; [self.dataArr removeAllObjects];
self.currPage = 1; self.currPage = 1;
[self startSearchWithAddress:textField.text]; [self startSearchWithAddress:textField.text];
return YES; return YES;
} }
- (void)touchesBegan:(NSSet
<UITouch *> *) - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
touches withEvent
:(UIEvent *)event {
[self.inputAddressTf resignFirstResponder]; [self.inputAddressTf resignFirstResponder];
} }
@end @end

View File

@@ -173,7 +173,7 @@ static inline UIColor *ABottomBarThemeGreen(void) {
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(48); make.height.mas_equalTo(48);
make.bottom.equalTo(card).offset(-40); make.bottom.equalTo(card).offset(-40 + (-AMP_TabbarHeight - 13));
}]; }];
} }

View File

@@ -68,9 +68,6 @@ static inline UIColor *AStationThemeGreen(void) {
@property (nonatomic, strong) UIImageView *phoneIconView; @property (nonatomic, strong) UIImageView *phoneIconView;
@property (nonatomic, strong) UILabel *phoneLabel; @property (nonatomic, strong) UILabel *phoneLabel;
/// bottom constraint
@property (nonatomic, strong) MASConstraint *cardBottomConstraint;
@end @end
@implementation AStationDetailPopupView @implementation AStationDetailPopupView
@@ -81,277 +78,43 @@ static inline UIColor *AStationThemeGreen(void) {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor];
[self _buildUI]; [self setupUI];
[self _setupMasonryConstraints];
[self _updateUI];
} }
return self; return self;
} }
#pragma mark - Public #pragma mark - Setup UI
- (void)showInView:(UIView *)parentView { - (void)setupUI {
self.alpha = 0; [self addSubview:self.maskControl];
self.maskControl.alpha = 0; [self.cardView addSubview:self.closeButton];
[parentView addSubview:self]; [self.cardView addSubview:self.stationNameLabel];
[self mas_remakeConstraints:^(MASConstraintMaker *make) { [self.cardView addSubview:self.costLabel];
// make.edges.equalTo(parentView); [self.cardView addSubview:self.businessHoursLabel];
make.top.left.right.equalTo(parentView); [self.cardView addSubview:self.addressLabel];
make.bottom.equalTo(parentView).offset((-AMP_TabbarSafeBottomMargin - 35)); [self.cardView addSubview:self.costIconView];
}]; [self.cardView addSubview:self.separator];
[self _playShowAnimation]; [self.cardView addSubview:self.timeIconView];
} [self.cardView addSubview:self.timeLabel];
[self.cardView addSubview:self.distanceIconView];
[self.cardView addSubview:self.distanceLabel];
[self.cardView addSubview:self.tollIconView];
[self.cardView addSubview:self.tollLabel];
[self.cardView addSubview:self.contactPersonIconView];
[self.cardView addSubview:self.contactPersonLabel];
[self.cardView addSubview:self.priceIconView];
[self.cardView addSubview:self.priceLabel];
[self.cardView addSubview:self.phoneIconView];
[self.cardView addSubview:self.phoneLabel];
[self.cardView addSubview:self.startNaviButton];
- (void)hide { [self setupConstraints];
[self hideWithCompletion:nil]; [self updateUI];
}
- (void)hideWithCompletion:(void(^)(void))completion {
[self _playDismissAnimationWithCompletion:^{
[self removeFromSuperview];
if (completion) {
completion();
}
}];
}
#pragma mark - Setter Override
- (void)setPointModel:(ANavPointModel *)pointModel {
_pointModel = pointModel;
[self _updateUI];
}
- (void)setEstimatedCost:(NSString *)estimatedCost {
_estimatedCost = [estimatedCost copy];
[self _updateUI];
}
- (void)setEstimatedTime:(NSString *)estimatedTime {
_estimatedTime = [estimatedTime copy];
[self _updateUI];
}
- (void)setDriveDistance:(NSString *)driveDistance {
_driveDistance = [driveDistance copy];
[self _updateUI];
}
- (void)setTollFee:(NSString *)tollFee {
_tollFee = [tollFee copy];
[self _updateUI];
}
- (void)setBusinessHours:(NSString *)businessHours {
_businessHours = [businessHours copy];
[self _updateUI];
}
- (void)setContactName:(NSString *)contactName {
_contactName = [contactName copy];
[self _updateUI];
}
- (void)setContactPhone:(NSString *)contactPhone {
_contactPhone = [contactPhone copy];
[self _updateUI];
}
- (void)setHydrogenPrice:(NSString *)hydrogenPrice {
_hydrogenPrice = [hydrogenPrice copy];
[self _updateUI];
}
#pragma mark - Build UI
/**
[]
-- 20pt
[icon] --
[icon] -- [icon] --
(30pt)
*/
- (void)_buildUI {
//
UIControl *mask = [[UIControl alloc] init];
mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
[mask addTarget:self action:@selector(_onMaskTapped) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:mask];
self.maskControl = mask;
//
UIView *card = [[UIView alloc] init];
card.backgroundColor = [UIColor whiteColor];
card.layer.cornerRadius = 16;
card.layer.masksToBounds = NO;
card.layer.shadowColor = [UIColor blackColor].CGColor;
card.layer.shadowOpacity = 0.15;
card.layer.shadowRadius = 12;
card.layer.shadowOffset = CGSizeMake(0, -4);
[self addSubview:card];
self.cardView = card;
//
UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[closeBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal];
[closeBtn setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal];
closeBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[closeBtn addTarget:self action:@selector(_onCloseTapped) forControlEvents:UIControlEventTouchUpInside];
[card addSubview:closeBtn];
self.closeButton = closeBtn;
UIColor *headTextColor = [UIColor hp_colorWithRGBHex:0x1D2129];
UIFont *headTextFont = [UIFont hp_pingFangMedium:14];
//
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.font = [UIFont hp_pingFangMedium:18];
nameLabel.textColor = headTextColor;
nameLabel.numberOfLines = 2;
nameLabel.minimumScaleFactor = 0.8;
[card addSubview:nameLabel];
self.stationNameLabel = nameLabel;
// 20pt
UILabel *costLabel = [[UILabel alloc] init];
costLabel.font = headTextFont;
costLabel.textColor = headTextColor;
costLabel.numberOfLines = 1;
costLabel.textAlignment = NSTextAlignmentLeft;
[card addSubview:costLabel];
self.costLabel = costLabel;
// 4pt
UILabel *bizHoursLabel = [[UILabel alloc] init];
bizHoursLabel.font = [UIFont hp_pingFangRegular:14];
bizHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
bizHoursLabel.numberOfLines = 1;
[card addSubview:bizHoursLabel];
self.businessHoursLabel = bizHoursLabel;
//
UILabel *addrLabel = [[UILabel alloc] init];
addrLabel.font = [UIFont hp_pingFangRegular:14];
addrLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C];
addrLabel.numberOfLines = 2;
[card addSubview:addrLabel];
self.addressLabel = addrLabel;
UIImageView *costIcon = [[UIImageView alloc] init];
costIcon.contentMode = UIViewContentModeScaleAspectFit;
costIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"];
[card addSubview:costIcon];
self.costIconView = costIcon;
// 线
UIView *sep = [[UIView alloc] init];
sep.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1];
[card addSubview:sep];
self.separator = sep;
//
UIImageView *timeIcon = [[UIImageView alloc] init];
timeIcon.contentMode = UIViewContentModeScaleAspectFit;
timeIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"];
[card addSubview:timeIcon];
self.timeIconView = timeIcon;
//
UILabel *timeLabel = [[UILabel alloc] init];
timeLabel.font = headTextFont;
timeLabel.textColor = headTextColor;
[card addSubview:timeLabel];
self.timeLabel = timeLabel;
//
UIImageView *distIcon = [[UIImageView alloc] init];
distIcon.contentMode = UIViewContentModeScaleAspectFit;
distIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"];
[card addSubview:distIcon];
self.distanceIconView = distIcon;
//
UILabel *distLabel = [[UILabel alloc] init];
distLabel.font = headTextFont;
distLabel.textColor = headTextColor;
[card addSubview:distLabel];
self.distanceLabel = distLabel;
//
UIImageView *tollIcon = [[UIImageView alloc] init];
tollIcon.contentMode = UIViewContentModeScaleAspectFit;
tollIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"];
[card addSubview:tollIcon];
self.tollIconView = tollIcon;
//
UILabel *tollLabel = [[UILabel alloc] init];
tollLabel.font = headTextFont;
tollLabel.textColor = headTextColor;
[card addSubview:tollLabel];
self.tollLabel = tollLabel;
// &
UIImageView *personIcon = [[UIImageView alloc] init];
personIcon.contentMode = UIViewContentModeScaleAspectFit;
personIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"];
[card addSubview:personIcon];
self.contactPersonIconView = personIcon;
UILabel *personLabel = [[UILabel alloc] init];
personLabel.font = headTextFont;
personLabel.textColor = headTextColor;
[card addSubview:personLabel];
self.contactPersonLabel = personLabel;
// &
UIImageView *priceIcon = [[UIImageView alloc] init];
priceIcon.contentMode = UIViewContentModeScaleAspectFit;
priceIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"];
[card addSubview:priceIcon];
self.priceIconView = priceIcon;
UILabel *priceLabel = [[UILabel alloc] init];
priceLabel.font = headTextFont;
priceLabel.textColor = headTextColor;
[card addSubview:priceLabel];
self.priceLabel = priceLabel;
// &
UIImageView *phoneIcon = [[UIImageView alloc] init];
phoneIcon.contentMode = UIViewContentModeScaleAspectFit;
phoneIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"];
[card addSubview:phoneIcon];
self.phoneIconView = phoneIcon;
UILabel *phoneLabel = [[UILabel alloc] init];
phoneLabel.font = headTextFont;
phoneLabel.textColor = headTextColor;
[card addSubview:phoneLabel];
self.phoneLabel = phoneLabel;
//
UIButton *naviBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[naviBtn setTitle:@"开始导航" forState:UIControlStateNormal];
[naviBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
naviBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17];
naviBtn.backgroundColor = AStationThemeGreen();
naviBtn.layer.cornerRadius = 24;
[naviBtn addTarget:self action:@selector(_onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside];
[card addSubview:naviBtn];
self.startNaviButton = naviBtn;
} }
#pragma mark - Masonry Constraints #pragma mark - Masonry Constraints
- (void)_setupMasonryConstraints { - (void)setupConstraints {
UIView *card = self.cardView; UIView *card = self.cardView;
CGFloat iconSize = 16; CGFloat iconSize = 16;
@@ -507,13 +270,85 @@ static inline UIColor *AStationThemeGreen(void) {
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(48); make.height.mas_equalTo(48);
make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin); make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin + (-AMP_TabbarHeight - 13));
}]; }];
} }
#pragma mark - Public
- (void)showInView:(UIView *)parentView {
self.alpha = 0;
self.maskControl.alpha = 0;
[parentView addSubview:self];
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(parentView);
}];
[self playShowAnimation];
}
- (void)hide {
[self hideWithCompletion:nil];
}
- (void)hideWithCompletion:(void(^)(void))completion {
[self playDismissAnimationWithCompletion:^{
[self removeFromSuperview];
if (completion) {
completion();
}
}];
}
#pragma mark - Setter Override
- (void)setPointModel:(ANavPointModel *)pointModel {
_pointModel = pointModel;
[self updateUI];
}
- (void)setEstimatedCost:(NSString *)estimatedCost {
_estimatedCost = [estimatedCost copy];
[self updateUI];
}
- (void)setEstimatedTime:(NSString *)estimatedTime {
_estimatedTime = [estimatedTime copy];
[self updateUI];
}
- (void)setDriveDistance:(NSString *)driveDistance {
_driveDistance = [driveDistance copy];
[self updateUI];
}
- (void)setTollFee:(NSString *)tollFee {
_tollFee = [tollFee copy];
[self updateUI];
}
- (void)setBusinessHours:(NSString *)businessHours {
_businessHours = [businessHours copy];
[self updateUI];
}
- (void)setContactName:(NSString *)contactName {
_contactName = [contactName copy];
[self updateUI];
}
- (void)setContactPhone:(NSString *)contactPhone {
_contactPhone = [contactPhone copy];
[self updateUI];
}
- (void)setHydrogenPrice:(NSString *)hydrogenPrice {
_hydrogenPrice = [hydrogenPrice copy];
[self updateUI];
}
#pragma mark - Data Update #pragma mark - Data Update
- (void)_updateUI { - (void)updateUI {
self.stationNameLabel.text = (self.pointModel.name.length > 0) self.stationNameLabel.text = (self.pointModel.name.length > 0)
? self.pointModel.name : @"-"; ? self.pointModel.name : @"-";
@@ -522,7 +357,7 @@ static inline UIColor *AStationThemeGreen(void) {
? [NSString stringWithFormat:@"营业时间:%@", self.businessHours] ? [NSString stringWithFormat:@"营业时间:%@", self.businessHours]
: @"营业时间:-"; : @"营业时间:-";
self.costLabel.text = (self.estimatedCost.length > 0) self.costLabel.text = ((self.estimatedCost.length > 0) && [self.estimatedCost doubleValue])
? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost] ? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost]
: @"预计加氢费用:-"; : @"预计加氢费用:-";
@@ -530,12 +365,12 @@ static inline UIColor *AStationThemeGreen(void) {
? self.pointModel.address : @"-"; ? self.pointModel.address : @"-";
// "-- 分钟" // "-- 分钟"
self.timeLabel.text = (self.estimatedTime.length > 0) self.timeLabel.text = ((self.estimatedTime.length > 0) && [self.estimatedTime doubleValue] > 0)
? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime] ? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime]
: @"预计时间:-"; : @"预计时间:-";
// "-- 公里" // "-- 公里"
self.distanceLabel.text = (self.driveDistance.length > 0) self.distanceLabel.text = ((self.driveDistance.length > 0) && [self.driveDistance doubleValue] > 0)
? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance] ? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance]
: @"行驶里程:-"; : @"行驶里程:-";
@@ -560,7 +395,6 @@ static inline UIColor *AStationThemeGreen(void) {
: @"联系方式:-"; : @"联系方式:-";
} }
// UI
- (void)resetUI { - (void)resetUI {
self.stationNameLabel.text = @"-"; self.stationNameLabel.text = @"-";
self.businessHoursLabel.text = @"营业时间:-"; self.businessHoursLabel.text = @"营业时间:-";
@@ -579,7 +413,7 @@ static inline UIColor *AStationThemeGreen(void) {
/** /**
*/ */
- (void)_playShowAnimation { - (void)playShowAnimation {
// //
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0); make.left.equalTo(self).offset(0);
@@ -593,7 +427,7 @@ static inline UIColor *AStationThemeGreen(void) {
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0); make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0); make.right.equalTo(self).offset(-0);
make.bottom.equalTo(self).offset(-AMP_TabbarSafeBottomMargin); make.bottom.equalTo(self).offset(0);
}]; }];
[UIView animateWithDuration:0.36 [UIView animateWithDuration:0.36
@@ -608,7 +442,7 @@ static inline UIColor *AStationThemeGreen(void) {
} completion:nil]; } completion:nil];
} }
- (void)_playDismissAnimationWithCompletion:(void(^)(void))completion { - (void)playDismissAnimationWithCompletion:(void(^)(void))completion {
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) { [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0); make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0); make.right.equalTo(self).offset(-0);
@@ -628,21 +462,21 @@ static inline UIColor *AStationThemeGreen(void) {
#pragma mark - Actions #pragma mark - Actions
- (void)_onMaskTapped { - (void)onMaskTapped {
if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) { if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
[self.delegate stationDetailPopupViewDidTapClose:self]; [self.delegate stationDetailPopupViewDidTapClose:self];
} }
[self hide]; [self hide];
} }
- (void)_onCloseTapped { - (void)onCloseTapped {
if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) { if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
[self.delegate stationDetailPopupViewDidTapClose:self]; [self.delegate stationDetailPopupViewDidTapClose:self];
} }
[self hide]; [self hide];
} }
- (void)_onStartNaviTapped { - (void)onStartNaviTapped {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[self hideWithCompletion:^{ [self hideWithCompletion:^{
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
@@ -652,4 +486,222 @@ static inline UIColor *AStationThemeGreen(void) {
}]; }];
} }
#pragma mark - Lazy Load
- (UIControl *)maskControl {
if (!_maskControl) {
_maskControl = [[UIControl alloc] init];
_maskControl.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
[_maskControl addTarget:self action:@selector(onMaskTapped) forControlEvents:UIControlEventTouchUpInside];
}
return _maskControl;
}
- (UIView *)cardView {
if (!_cardView) {
_cardView = [[UIView alloc] init];
_cardView.backgroundColor = [UIColor whiteColor];
_cardView.layer.cornerRadius = 16;
_cardView.layer.masksToBounds = NO;
_cardView.layer.shadowColor = [UIColor blackColor].CGColor;
_cardView.layer.shadowOpacity = 0.15;
_cardView.layer.shadowRadius = 12;
_cardView.layer.shadowOffset = CGSizeMake(0, -4);
[self addSubview:_cardView];
}
return _cardView;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeButton setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal];
[_closeButton setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal];
_closeButton.titleLabel.font = [UIFont systemFontOfSize:16];
[_closeButton addTarget:self action:@selector(onCloseTapped) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;
}
- (UILabel *)stationNameLabel {
if (!_stationNameLabel) {
_stationNameLabel = [[UILabel alloc] init];
_stationNameLabel.font = [UIFont hp_pingFangMedium:18];
_stationNameLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
_stationNameLabel.numberOfLines = 2;
_stationNameLabel.minimumScaleFactor = 0.8;
}
return _stationNameLabel;
}
- (UILabel *)costLabel {
if (!_costLabel) {
_costLabel = [[UILabel alloc] init];
_costLabel.font = [UIFont hp_pingFangMedium:14];
_costLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
_costLabel.numberOfLines = 1;
_costLabel.textAlignment = NSTextAlignmentLeft;
}
return _costLabel;
}
- (UILabel *)businessHoursLabel {
if (!_businessHoursLabel) {
_businessHoursLabel = [[UILabel alloc] init];
_businessHoursLabel.font = [UIFont hp_pingFangRegular:14];
_businessHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
_businessHoursLabel.numberOfLines = 1;
}
return _businessHoursLabel;
}
- (UILabel *)addressLabel {
if (!_addressLabel) {
_addressLabel = [[UILabel alloc] init];
_addressLabel.font = [UIFont hp_pingFangRegular:14];
_addressLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C];
_addressLabel.numberOfLines = 2;
}
return _addressLabel;
}
- (UIImageView *)costIconView {
if (!_costIconView) {
_costIconView = [[UIImageView alloc] init];
_costIconView.contentMode = UIViewContentModeScaleAspectFit;
_costIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"];
}
return _costIconView;
}
- (UIView *)separator {
if (!_separator) {
_separator = [[UIView alloc] init];
_separator.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1];
_separator.hidden = YES;
}
return _separator;
}
- (UIImageView *)timeIconView {
if (!_timeIconView) {
_timeIconView = [[UIImageView alloc] init];
_timeIconView.contentMode = UIViewContentModeScaleAspectFit;
_timeIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"];
}
return _timeIconView;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont hp_pingFangMedium:14];
_timeLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _timeLabel;
}
- (UIImageView *)distanceIconView {
if (!_distanceIconView) {
_distanceIconView = [[UIImageView alloc] init];
_distanceIconView.contentMode = UIViewContentModeScaleAspectFit;
_distanceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"];
}
return _distanceIconView;
}
- (UILabel *)distanceLabel {
if (!_distanceLabel) {
_distanceLabel = [[UILabel alloc] init];
_distanceLabel.font = [UIFont hp_pingFangMedium:14];
_distanceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _distanceLabel;
}
- (UIImageView *)tollIconView {
if (!_tollIconView) {
_tollIconView = [[UIImageView alloc] init];
_tollIconView.contentMode = UIViewContentModeScaleAspectFit;
_tollIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"];
}
return _tollIconView;
}
- (UILabel *)tollLabel {
if (!_tollLabel) {
_tollLabel = [[UILabel alloc] init];
_tollLabel.font = [UIFont hp_pingFangMedium:14];
_tollLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _tollLabel;
}
- (UIImageView *)contactPersonIconView {
if (!_contactPersonIconView) {
_contactPersonIconView = [[UIImageView alloc] init];
_contactPersonIconView.contentMode = UIViewContentModeScaleAspectFit;
_contactPersonIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"];
}
return _contactPersonIconView;
}
- (UILabel *)contactPersonLabel {
if (!_contactPersonLabel) {
_contactPersonLabel = [[UILabel alloc] init];
_contactPersonLabel.font = [UIFont hp_pingFangMedium:14];
_contactPersonLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _contactPersonLabel;
}
- (UIImageView *)priceIconView {
if (!_priceIconView) {
_priceIconView = [[UIImageView alloc] init];
_priceIconView.contentMode = UIViewContentModeScaleAspectFit;
_priceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"];
}
return _priceIconView;
}
- (UILabel *)priceLabel {
if (!_priceLabel) {
_priceLabel = [[UILabel alloc] init];
_priceLabel.font = [UIFont hp_pingFangMedium:14];
_priceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _priceLabel;
}
- (UIImageView *)phoneIconView {
if (!_phoneIconView) {
_phoneIconView = [[UIImageView alloc] init];
_phoneIconView.contentMode = UIViewContentModeScaleAspectFit;
_phoneIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"];
}
return _phoneIconView;
}
- (UILabel *)phoneLabel {
if (!_phoneLabel) {
_phoneLabel = [[UILabel alloc] init];
_phoneLabel.font = [UIFont hp_pingFangMedium:14];
_phoneLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
}
return _phoneLabel;
}
- (UIButton *)startNaviButton {
if (!_startNaviButton) {
_startNaviButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_startNaviButton setTitle:@"开始导航" forState:UIControlStateNormal];
[_startNaviButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_startNaviButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
_startNaviButton.backgroundColor = AStationThemeGreen();
_startNaviButton.layer.cornerRadius = 24;
[_startNaviButton addTarget:self action:@selector(onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside];
}
return _startNaviButton;
}
@end @end

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.2.4+7 version: 1.2.5+8
environment: environment:
sdk: ^3.9.0 sdk: ^3.9.0