[ios] Resources

This commit is contained in:
Igor Khmurets 2014-09-29 23:39:52 +03:00 committed by Alex Zolotarev
parent 1c5cce2d9d
commit ec2958c329
35 changed files with 273 additions and 23 deletions

View file

@ -5,11 +5,12 @@
@interface RouteView ()
@property (nonatomic) UIButton * closeButton;
@property (nonatomic) UIButton * startButton;
@property (nonatomic) UILabel * distanceLabel;
@property (nonatomic) UIView * wrapView;
@property (nonatomic) UILabel * metricsLabel;
@property (nonatomic) UIImageView * backgroundView;
@property (nonatomic, readonly) BOOL visible;
@property (nonatomic) UIImageView * distanceView;
@end
@ -19,11 +20,17 @@
{
self = [super initWithFrame:frame];
[self addSubview:self.backgroundView];
[self addSubview:self.wrapView];
[self addSubview:self.distanceView];
[self.distanceView addSubview:self.wrapView];
[self.wrapView addSubview:self.distanceLabel];
[self.wrapView addSubview:self.metricsLabel];
[self addSubview:self.closeButton];
[self addSubview:self.startButton];
CGFloat const originY = 20;
self.distanceView.minY = originY;
self.closeButton.minY = originY;
self.startButton.minY = originY;
return self;
}
@ -35,23 +42,27 @@
[self layoutSubviews];
}
#define BUTTON_HEIGHT 44
- (void)layoutSubviews
{
[self.distanceLabel sizeToFit];
[self.metricsLabel sizeToFit];
CGFloat const betweenOffset = 0;
self.wrapView.size = CGSizeMake(self.distanceLabel.width + betweenOffset + self.metricsLabel.width, 40);
self.distanceLabel.midY = self.wrapView.height / 2;
self.metricsLabel.maxY = self.distanceLabel.maxY - 4;
self.distanceLabel.minX = 0;
self.metricsLabel.minX = self.distanceLabel.minX + self.distanceLabel.width + betweenOffset;
self.wrapView.center = CGPointMake(self.width / 2, self.height - 41);
self.closeButton.center = CGPointMake(self.width - 22, self.height - 40);
self.distanceView.size = CGSizeMake(self.wrapView.width + 24, BUTTON_HEIGHT);
self.wrapView.center = CGPointMake(self.wrapView.superview.width / 2, self.wrapView.superview.height / 2);
}
- (void)didMoveToSuperview
{
self.minY = [self viewMinY];
[self setVisible:NO animated:NO];
}
@ -60,14 +71,30 @@
[self.delegate routeViewDidCancelRouting:self];
}
- (void)startButtonPressed:(id)sender
{
[self.delegate routeViewDidStartRouting:self];
}
- (void)setVisible:(BOOL)visible animated:(BOOL)animated
{
_visible = visible;
[UIView animateWithDuration:(animated ? 0.5 : 0) delay:0 damping:0.9 initialVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
CGFloat const offsetInnerX = 3;
CGFloat const offsetBetweenX = 0;
CGFloat const offsetOuterX = 18;
[UIView animateWithDuration:(animated ? 0.5 : 0) delay:0 damping:0.8 initialVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
if (visible)
self.minY = [self viewMinY];
{
self.distanceView.minX = offsetInnerX;
self.closeButton.maxX = self.width - offsetInnerX;
self.startButton.maxX = self.closeButton.minX - offsetBetweenX;
}
else
self.maxY = 0;
{
self.distanceView.maxX = -offsetOuterX;
self.startButton.minX = self.width + offsetOuterX;
self.closeButton.maxX = self.startButton.maxX + offsetBetweenX;
}
} completion:nil];
}
@ -76,29 +103,51 @@
return SYSTEM_VERSION_IS_LESS_THAN(@"7") ? -20 : 0;
}
- (UIImageView *)backgroundView
{
if (!_backgroundView)
{
_backgroundView = [[UIImageView alloc] initWithFrame:self.bounds];
_backgroundView.image = [[UIImage imageNamed:@"PlacePageBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 18, 0)];
_backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
return _backgroundView;
}
- (UIButton *)closeButton
{
if (!_closeButton)
{
_closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 44)];
_closeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, BUTTON_HEIGHT)];
_closeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
[_closeButton setImage:[UIImage imageNamed:@"PlacePageCancelRouteButton"] forState:UIControlStateNormal];
UIImage * backgroundImage = [[UIImage imageNamed:@"RoutingButtonBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
[_closeButton setBackgroundImage:backgroundImage forState:UIControlStateNormal];
UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"StopRoutingButton"]];
[_closeButton addSubview:imageView];
imageView.center = CGPointMake(_closeButton.width / 2, _closeButton.height / 2);
[_closeButton addTarget:self action:@selector(closeButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;
}
- (UIButton *)startButton
{
if (!_startButton)
{
UIImageView * imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"StopRoutingButton"]];
NSString * title = @"Поехали!";
UIFont * font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14];
CGFloat const width = [title sizeWithDrawSize:CGSizeMake(200, 30) font:font].width + imageView.width + 40;
_startButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, width, BUTTON_HEIGHT)];
_startButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
UIImage * backgroundImage = [[UIImage imageNamed:@"RoutingButtonBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
[_startButton setBackgroundImage:backgroundImage forState:UIControlStateNormal];
[_startButton addSubview:imageView];
imageView.center = CGPointMake(_startButton.width - imageView.width - 4, _startButton.height / 2);
_startButton.titleLabel.font = font;
_startButton.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, imageView.width + 8);
[_startButton setTitle:title forState:UIControlStateNormal];
[_startButton setTitleColor:[UIColor colorWithColorCode:@"179E4D"] forState:UIControlStateNormal];
[_startButton addTarget:self action:@selector(startButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
}
return _startButton;
}
- (UILabel *)distanceLabel
{
if (!_distanceLabel)
@ -123,6 +172,19 @@
return _metricsLabel;
}
- (UIImageView *)distanceView
{
if (!_distanceView)
{
_distanceView = [[UIImageView alloc] initWithFrame:CGRectZero];
UIImage * image = [[UIImage imageNamed:@"RoutingButtonBackground"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
_distanceView.image = image;
_distanceView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
[_distanceView addSubview:self.wrapView];
}
return _distanceView;
}
- (UIView *)wrapView
{
if (!_wrapView)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "AccessoryView.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "AccessoryView@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "AccessoryView@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Badge.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "Badge@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "Badge@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "routing_get_mdpi.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "routing_get_xhdpi.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "routing_get_xxhdpi.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "routing_ok_mdpi.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "routing_ok_xhdpi.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "routing_ok_xxhdpi.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -20,4 +20,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

View file

@ -0,0 +1,27 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "drive.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "drive@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "drive@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
<<<<<<< HEAD
}
=======
}
>>>>>>> 56a28db... [ios] Downloader UI

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "route_bg_hdpi.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "route_bg_xhdpi.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "route_bg_xxhdpi.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "route_go_mdpi.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "route_go_xhdpi.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "route_go_xxhdpi.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "close_mdpi.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "close_xhdpi.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "close_xxhdpi.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -13,7 +13,7 @@
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "search-delete-onmap@2x-1.png"
"filename" : "search-delete-onmap@3x.png"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B