[ios] Added test functionality for change route mode.

This commit is contained in:
v.mikhaylenko 2015-06-24 13:34:35 +03:00 committed by Alex Zolotarev
parent bea4feb1c6
commit d0c5e0a09e
7 changed files with 52 additions and 9 deletions

View file

@ -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;
}

View file

@ -20,6 +20,7 @@
@property (nonatomic, weak) IBOutlet MapViewController * m_mapViewController;
@property (nonatomic, readonly) LocationManager * m_locationManager;
@property (nonatomic) BOOL isPedestrianRoutingMode;
+ (MapsAppDelegate *)theApp;

View file

@ -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
{

View 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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,015 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB