forked from organicmaps/organicmaps
[ios] Added test functionality for change route mode.
This commit is contained in:
parent
bea4feb1c6
commit
d0c5e0a09e
7 changed files with 52 additions and 9 deletions
|
@ -12,6 +12,7 @@
|
|||
#import "MWMPlacePageViewManager.h"
|
||||
#import "MWMPlacePageEntity.h"
|
||||
#import "UIKitCategories.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
|
@ -41,6 +42,8 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
|
|||
BOOL const isMyPosition = placePage.manager.entity.type == MWMPlacePageEntityTypeMyPosition;
|
||||
bar.routeButton.hidden = isMyPosition;
|
||||
bar.autoresizingMask = UIViewAutoresizingNone;
|
||||
NSString * routeImageName = [MapsAppDelegate theApp].isPedestrianRoutingMode ? @"ic_route_walk" : @"ic_route";
|
||||
[bar.routeButton setImage:[UIImage imageNamed:routeImageName] forState:UIControlStateNormal];
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
@property (nonatomic, weak) IBOutlet MapViewController * m_mapViewController;
|
||||
@property (nonatomic, readonly) LocationManager * m_locationManager;
|
||||
@property (nonatomic) BOOL isPedestrianRoutingMode;
|
||||
|
||||
+ (MapsAppDelegate *)theApp;
|
||||
|
||||
|
|
|
@ -393,14 +393,14 @@ static BOOL keyboardLoaded = NO;
|
|||
}
|
||||
|
||||
// TODO: This code only for demonstration purposes and will be removed soon
|
||||
- (bool)tryChangeMapStyleCmd:(NSString*)str
|
||||
- (BOOL)tryChangeMapStyleCmd:(NSString *)cmd
|
||||
{
|
||||
// Hook for shell command on change map style
|
||||
bool const isDark = [str isEqualToString: @"mapstyle:dark"];
|
||||
bool const isLight = isDark ? false : [str isEqualToString: @"mapstyle:light"];
|
||||
BOOL const isDark = [cmd isEqualToString:@"mapstyle:dark"];
|
||||
BOOL const isLight = isDark ? NO : [cmd isEqualToString:@"mapstyle:light"];
|
||||
|
||||
if (!isDark && !isLight)
|
||||
return false;
|
||||
return NO;
|
||||
|
||||
// close Search panel
|
||||
[self searchBarDidPressCancelButton:nil];
|
||||
|
@ -409,20 +409,36 @@ static BOOL keyboardLoaded = NO;
|
|||
MapStyle const mapStyle = isDark ? MapStyleDark : MapStyleLight;
|
||||
[[MapsAppDelegate theApp] setMapStyle: mapStyle];
|
||||
|
||||
return true;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)tryToChangeRoutingModeCmd:(NSString *)cmd
|
||||
{
|
||||
if (![cmd isEqual:@"?pedestrian"])
|
||||
return NO;
|
||||
|
||||
MapsAppDelegate * delegate = [MapsAppDelegate theApp];
|
||||
BOOL const isPedestrianRoutingMode = delegate.isPedestrianRoutingMode;
|
||||
delegate.isPedestrianRoutingMode = !isPedestrianRoutingMode;
|
||||
[self searchBarDidPressCancelButton:nil];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)textFieldTextChanged:(id)sender
|
||||
{
|
||||
NSString * newText = self.searchBar.textField.text;
|
||||
NSString * currentText = self.searchBar.textField.text;
|
||||
|
||||
// TODO: This code only for demonstration purposes and will be removed soon
|
||||
if ([self tryChangeMapStyleCmd: newText])
|
||||
if ([self tryChangeMapStyleCmd:currentText])
|
||||
return;
|
||||
|
||||
if ([newText length])
|
||||
// TODO(Vlad): This code only for demonstration purposes and will be removed soon
|
||||
if ([self tryToChangeRoutingModeCmd:currentText])
|
||||
return;
|
||||
|
||||
if ([currentText length])
|
||||
{
|
||||
[self search:newText];
|
||||
[self search:currentText];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
23
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/Contents.json
vendored
Normal file
23
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "ic_route_walk.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "ic_route_walk@2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"filename" : "ic_route_walk@3x.png"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 548 B |
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk@2x.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,015 B |
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk@3x.png
vendored
Normal file
BIN
iphone/Maps/Images.xcassets/New Place Page/ic_route_walk.imageset/ic_route_walk@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Add table
Reference in a new issue