Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorИлья Гречухин <i.grechuhin@gmail.com>2016-10-21 16:42:16 +0300
committerGitHub <noreply@github.com>2016-10-21 16:42:16 +0300
commit5e13a51e30e3d5ba1bde574d138b3b64eb469855 (patch)
tree1c3ff11441fe0d2d9ba48647c730bc0ae6f85efd
parent9905082d35121f4b7fcd9fa030f8bd730530815c (diff)
parentbc1de13ecd30aebd85c993dd47fcec5242ae8465 (diff)
Merge pull request #4544 from VladiMihaylenko/vm-master
[ios] Place page bugfix
-rw-r--r--iphone/Maps/Classes/MWMPPView.h1
-rw-r--r--iphone/Maps/Classes/MWMPPView.mm16
-rw-r--r--iphone/Maps/Classes/MWMPPView.xib10
-rw-r--r--iphone/Maps/Classes/MWMPlacePageLayout.mm30
-rw-r--r--iphone/Maps/Classes/MWMPlacePagePreviewCell.h3
-rw-r--r--iphone/Maps/Classes/MWMPlacePagePreviewCell.mm17
6 files changed, 43 insertions, 34 deletions
diff --git a/iphone/Maps/Classes/MWMPPView.h b/iphone/Maps/Classes/MWMPPView.h
index fd5dd0d942..a2ba1d145a 100644
--- a/iphone/Maps/Classes/MWMPPView.h
+++ b/iphone/Maps/Classes/MWMPPView.h
@@ -20,7 +20,6 @@
@property(weak, nonatomic) IBOutlet UIView * top;
@property(weak, nonatomic) IBOutlet UIImageView * anchorImage;
-@property(weak, nonatomic) IBOutlet UIImageView * spinner;
@property(weak, nonatomic) IBOutlet UITableView * tableView;
@property(nonatomic) CGFloat currentContentHeight;
diff --git a/iphone/Maps/Classes/MWMPPView.mm b/iphone/Maps/Classes/MWMPPView.mm
index 20555ea3e4..8fa1f3c359 100644
--- a/iphone/Maps/Classes/MWMPPView.mm
+++ b/iphone/Maps/Classes/MWMPPView.mm
@@ -45,15 +45,11 @@ CGFloat const kTableViewTopInset = -36;
{
self.tableView.alpha = 0.;
self.anchorImage.hidden = YES;
- self.spinner.hidden = NO;
- [self.spinner startAnimating];
}
else
{
self.tableView.alpha = 1.;
self.anchorImage.hidden = NO;
- self.spinner.hidden = YES;
- [self.spinner stopAnimating];
}
}
@@ -89,19 +85,7 @@ CGFloat const kTableViewTopInset = -36;
self.tableView.estimatedRowHeight = 44.;
self.tableView.rowHeight = UITableViewAutomaticDimension;
-
self.tableView.contentInset = {.top = kTableViewTopInset};
-
- NSUInteger constexpr animationImagesCount = 12;
- NSMutableArray * animationImages = [NSMutableArray arrayWithCapacity:animationImagesCount];
- NSString * postfix = [UIColor isNightMode] ? @"dark" : @"light";
- for (NSUInteger i = 0; i < animationImagesCount; ++i)
- animationImages[i] =
- [UIImage imageNamed:[NSString stringWithFormat:@"Spinner_%@_%@", @(i + 1), postfix]];
-
- self.spinner.animationDuration = 0.8;
- self.spinner.animationImages = animationImages;
- [self.spinner startAnimating];
}
- (void)dealloc
diff --git a/iphone/Maps/Classes/MWMPPView.xib b/iphone/Maps/Classes/MWMPPView.xib
index 7c48d40bf0..39b26841b5 100644
--- a/iphone/Maps/Classes/MWMPPView.xib
+++ b/iphone/Maps/Classes/MWMPPView.xib
@@ -39,12 +39,6 @@
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
</view>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Spinner_1_light" translatesAutoresizingMaskIntoConstraints="NO" id="Wyo-4H-R6c">
- <constraints>
- <constraint firstAttribute="height" constant="36" id="6hU-Qs-xIL"/>
- <constraint firstAttribute="width" constant="36" id="v5J-Hs-nSv"/>
- </constraints>
- </imageView>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="Taj-ne-CBp">
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<inset key="separatorInset" minX="60" minY="0.0" maxX="0.0" maxY="0.0"/>
@@ -64,8 +58,6 @@
<constraint firstItem="Taj-ne-CBp" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="FBa-eg-ae8"/>
<constraint firstItem="bcQ-R1-NdK" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="JJA-g8-U9d"/>
<constraint firstItem="bcQ-R1-NdK" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Kcc-bP-Mbu"/>
- <constraint firstItem="Wyo-4H-R6c" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="RvW-CN-nou"/>
- <constraint firstItem="Wyo-4H-R6c" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="UFy-Dk-RbA"/>
<constraint firstAttribute="bottom" secondItem="Taj-ne-CBp" secondAttribute="bottom" id="pAf-8q-58V"/>
<constraint firstAttribute="trailing" secondItem="bcQ-R1-NdK" secondAttribute="trailing" id="zrS-z7-cab"/>
</constraints>
@@ -75,7 +67,6 @@
</userDefinedRuntimeAttributes>
<connections>
<outlet property="anchorImage" destination="V1F-KA-EKn" id="fNo-v2-XOU"/>
- <outlet property="spinner" destination="Wyo-4H-R6c" id="WK2-IU-x4H"/>
<outlet property="tableView" destination="Taj-ne-CBp" id="rdn-7z-2dz"/>
<outlet property="top" destination="bcQ-R1-NdK" id="3bW-Kf-gmH"/>
</connections>
@@ -83,7 +74,6 @@
</view>
</objects>
<resources>
- <image name="Spinner_1_light" width="36" height="36"/>
<image name="ic_anchor_up" width="22" height="6"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
diff --git a/iphone/Maps/Classes/MWMPlacePageLayout.mm b/iphone/Maps/Classes/MWMPlacePageLayout.mm
index a4532cac0e..1f24cb3138 100644
--- a/iphone/Maps/Classes/MWMPlacePageLayout.mm
+++ b/iphone/Maps/Classes/MWMPlacePageLayout.mm
@@ -30,7 +30,7 @@ enum class State
Top
};
-CGFloat const kMinOffset = 48;
+CGFloat const kMinOffset = 0;
CGFloat const kOpenPlacePageStopValue = 0.7;
CGFloat const kLuftDraggingOffset = 30;
@@ -383,8 +383,7 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
targetContentOffset:(inout CGPoint *)targetContentOffset
{
auto const actualOffset = scrollView.contentOffset.y;
- auto const openOffset =
- self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
+ auto const openOffset = self.openContentOffset;
auto const targetOffset = (*targetContentOffset).y;
if (actualOffset > self.expandedContentOffset && actualOffset < openOffset)
@@ -418,8 +417,7 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
return;
auto const actualOffset = scrollView.contentOffset.y;
- auto const openOffset =
- self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
+ auto const openOffset = self.openContentOffset;
if (actualOffset < self.expandedContentOffset + kLuftDraggingOffset)
{
@@ -450,6 +448,11 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
: CGAffineTransformIdentity;
}
+- (CGFloat)openContentOffset
+{
+ return self.isPortrait ? self.portraitOpenContentOffset : self.landscapeOpenContentOffset;
+}
+
#pragma mark - UITableViewDelegate & UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
@@ -489,7 +492,22 @@ void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil)
self.ppPreviewCell =
[tableView dequeueReusableCellWithIdentifier:[MWMPlacePagePreviewCell className]];
- [self.ppPreviewCell configure:data updateLayoutDelegate:self dataSource:self.dataSource];
+ [self.ppPreviewCell configure:data updateLayoutDelegate:self dataSource:self.dataSource tapAction:^
+ {
+ CGFloat offset = 0;
+ if (self.state == State::Top)
+ {
+ self.state = State::Bottom;
+ offset = self.expandedContentOffset;
+ }
+ else
+ {
+ self.state = State::Top;
+ offset = self.openContentOffset;
+ }
+ animate(^{ [self.scrollView setContentOffset:{0, offset} animated:YES]; });
+ }];
+
[self.ppPreviewCell setDownloaderViewHidden:!self.isDownloaderViewShown animated:NO];
return self.ppPreviewCell;
diff --git a/iphone/Maps/Classes/MWMPlacePagePreviewCell.h b/iphone/Maps/Classes/MWMPlacePagePreviewCell.h
index 7d5a18f22d..0695b38d50 100644
--- a/iphone/Maps/Classes/MWMPlacePagePreviewCell.h
+++ b/iphone/Maps/Classes/MWMPlacePagePreviewCell.h
@@ -16,7 +16,8 @@
- (void)configure:(MWMPlacePageData *)data
updateLayoutDelegate:(id<MWMPlacePageCellUpdateProtocol>)delegate
- dataSource:(id<MWMPlacePageLayoutDataSource>)dataSource;
+ dataSource:(id<MWMPlacePageLayoutDataSource>)dataSource
+ tapAction:(TMWMVoidBlock)tapAction;
- (MWMCircularProgress *)mapDownloadProgress;
diff --git a/iphone/Maps/Classes/MWMPlacePagePreviewCell.mm b/iphone/Maps/Classes/MWMPlacePagePreviewCell.mm
index 558a9c0986..682bc52173 100644
--- a/iphone/Maps/Classes/MWMPlacePagePreviewCell.mm
+++ b/iphone/Maps/Classes/MWMPlacePagePreviewCell.mm
@@ -152,6 +152,8 @@ CGFloat const kCompressedTableViewLeading = 56;
@property(nonatomic) MWMDirectionView * directionView;
+@property(copy, nonatomic) TMWMVoidBlock tapAction;
+
@end
@implementation MWMPlacePagePreviewCell
@@ -165,6 +167,9 @@ CGFloat const kCompressedTableViewLeading = 56;
self.tableView.estimatedRowHeight = 20;
self.tableView.rowHeight = UITableViewAutomaticDimension;
[self registerObserver];
+
+ UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
+ [self addGestureRecognizer:tap];
}
- (void)dealloc { [self unregisterObserver]; }
@@ -265,6 +270,7 @@ CGFloat const kCompressedTableViewLeading = 56;
- (void)configure:(MWMPlacePageData *)data
updateLayoutDelegate:(id<MWMPlacePageCellUpdateProtocol>)delegate
dataSource:(id<MWMPlacePageLayoutDataSource>)dataSource
+ tapAction:(TMWMVoidBlock)tapAction
{
self.data = data;
self.delegate = delegate;
@@ -292,6 +298,9 @@ CGFloat const kCompressedTableViewLeading = 56;
m_cells.push_back(Labels::Address);
[self.tableView reloadData];
+
+ NSAssert(tapAction, @"Cell must be tappable!");
+ self.tapAction = tapAction;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -420,4 +429,12 @@ CGFloat const kCompressedTableViewLeading = 56;
return _mapDownloadProgress;
}
+#pragma mark - Tap
+
+- (void)tap
+{
+ if (self.tapAction)
+ self.tapAction();
+}
+
@end