forked from organicmaps/organicmaps
[MAPSME-4894] [ios] Updated place page available area estimation.
This commit is contained in:
parent
6a1f8268be
commit
d5d09e59ac
27 changed files with 254 additions and 189 deletions
|
@ -25,6 +25,7 @@
|
|||
#import "MWMNoMapsViewController.h"
|
||||
#import "MWMPlacePageButtonsProtocol.h"
|
||||
#import "MWMPlacePageCellUpdateProtocol.h"
|
||||
#import "MWMPlacePageManagerHelper.h"
|
||||
#import "MWMPlacePageTaxiProvider.h"
|
||||
#import "MWMPushNotifications.h"
|
||||
#import "MWMRouter.h"
|
||||
|
|
|
@ -129,7 +129,6 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
{
|
||||
[self.trafficButton viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
[self.menuController viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
[self.placePageManager viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
[self.searchManager viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
[coordinator animateAlongsideTransition:^(
|
||||
id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
|
||||
|
@ -296,13 +295,11 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
{
|
||||
CGFloat const bound = newFrame.origin.x + newFrame.size.width;
|
||||
self.navigationManager.leftBound = bound;
|
||||
self.placePageManager.leftBound = bound;
|
||||
self.trafficButton.leftBound = bound;
|
||||
}
|
||||
else
|
||||
{
|
||||
CGFloat const bound = newFrame.origin.y + newFrame.size.height;
|
||||
self.placePageManager.topBound = bound;
|
||||
self.sideButtons.topBound = bound;
|
||||
self.trafficButton.topBound = bound;
|
||||
}
|
||||
|
@ -312,21 +309,13 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
{
|
||||
auto nm = self.navigationManager;
|
||||
if (IPAD)
|
||||
{
|
||||
[self.placePageManager setTopBound:self.topBound + nm.leftTop];
|
||||
}
|
||||
else
|
||||
{
|
||||
auto const topBound = self.topBound + nm.rightTop;
|
||||
auto const bottomBound = nm.bottom;
|
||||
[self.sideButtons setTopBound:topBound];
|
||||
[self.sideButtons setBottomBound:bottomBound];
|
||||
[MWMMapWidgets widgetsManager].bottomBound = bottomBound;
|
||||
[MWMMapWidgets widgetsManager].leftBound = nm.left;
|
||||
BOOL const skipNavDashboardHeight =
|
||||
self.navigationManager.state == MWMNavigationDashboardStateNavigation;
|
||||
[self.placePageManager setTopBound:skipNavDashboardHeight ? self.topBound : topBound];
|
||||
}
|
||||
return;
|
||||
auto const topBound = self.topBound + nm.rightTop;
|
||||
auto const bottomBound = nm.bottom;
|
||||
[self.sideButtons setTopBound:topBound];
|
||||
[self.sideButtons setBottomBound:bottomBound];
|
||||
[MWMMapWidgets widgetsManager].bottomBound = bottomBound;
|
||||
[MWMMapWidgets widgetsManager].leftBound = nm.left;
|
||||
}
|
||||
|
||||
- (void)setDisableStandbyOnRouteFollowing:(BOOL)disableStandbyOnRouteFollowing
|
||||
|
@ -511,7 +500,6 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
if (IPAD)
|
||||
return;
|
||||
_topBound = topBound;
|
||||
self.placePageManager.topBound = topBound;
|
||||
self.sideButtons.topBound = topBound;
|
||||
self.navigationManager.topBound = topBound;
|
||||
self.trafficButton.topBound = topBound;
|
||||
|
@ -523,8 +511,8 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
return;
|
||||
if ([MWMRouter isRoutingActive])
|
||||
return;
|
||||
_leftBound = self.placePageManager.leftBound = self.navigationManager.leftBound =
|
||||
self.menuController.leftBound = self.trafficButton.leftBound = leftBound;
|
||||
_leftBound = self.navigationManager.leftBound = self.menuController.leftBound =
|
||||
self.trafficButton.leftBound = leftBound;
|
||||
}
|
||||
|
||||
- (BOOL)searchHidden { return self.searchManager.state == MWMSearchManagerStateHidden; }
|
||||
|
|
|
@ -60,8 +60,10 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
@interface MWMNavigationInfoView ()<MWMLocationObserver>
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIView * streetNameView;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * streetNameViewHideOffset;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * streetNameLabel;
|
||||
@property(weak, nonatomic) IBOutlet UIView * turnsView;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * turnsViewHideOffset;
|
||||
@property(weak, nonatomic) IBOutlet UIImageView * nextTurnImageView;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * roundTurnLabel;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * distanceToNextTurnLabel;
|
||||
|
@ -273,16 +275,16 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
return;
|
||||
if (info.streetName.length != 0)
|
||||
{
|
||||
self.streetNameView.hidden = NO;
|
||||
[self setStreetNameVisible:YES];
|
||||
self.streetNameLabel.text = info.streetName;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.streetNameView.hidden = YES;
|
||||
[self setStreetNameVisible:NO];
|
||||
}
|
||||
if (info.turnImage)
|
||||
{
|
||||
self.turnsView.hidden = NO;
|
||||
[self setTurnsViewVisible:YES];
|
||||
self.nextTurnImageView.image = info.turnImage;
|
||||
self.nextTurnImageView.mwm_coloring = MWMImageColoringWhite;
|
||||
|
||||
|
@ -327,9 +329,8 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
}
|
||||
else
|
||||
{
|
||||
self.turnsView.hidden = YES;
|
||||
[self setTurnsViewVisible:NO];
|
||||
}
|
||||
self.hidden = self.streetNameView.hidden && self.turnsView.hidden;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
|
@ -491,12 +492,26 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
break;
|
||||
case MWMNavigationInfoViewStatePrepare:
|
||||
self.isVisible = YES;
|
||||
self.streetNameView.hidden = YES;
|
||||
self.turnsView.hidden = YES;
|
||||
[self setStreetNameVisible:NO];
|
||||
[self setTurnsViewVisible:NO];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setStreetNameVisible:(BOOL)isVisible
|
||||
{
|
||||
self.streetNameView.hidden = !isVisible;
|
||||
self.streetNameViewHideOffset.priority =
|
||||
isVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
|
||||
- (void)setTurnsViewVisible:(BOOL)isVisible
|
||||
{
|
||||
self.turnsView.hidden = !isVisible;
|
||||
self.turnsViewHideOffset.priority =
|
||||
isVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
|
||||
- (void)setIsVisible:(BOOL)isVisible
|
||||
{
|
||||
[self setNeedsLayout];
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<outlet property="separator" destination="pWX-NL-dy3" id="DC7-YE-KjK"/>
|
||||
</connections>
|
||||
</view>
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YYv-pG-Wkw" userLabel="Street name" customClass="SolidTouchView">
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YYv-pG-Wkw" userLabel="Street name" customClass="NavigationStreetNameView" customModule="cm_beta" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="1024" height="65.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ленинградский проспект" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ShI-bz-5g8">
|
||||
|
@ -95,6 +95,7 @@
|
|||
<constraints>
|
||||
<constraint firstItem="ShI-bz-5g8" firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="top" constant="32" id="KK1-dA-hII"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ShI-bz-5g8" secondAttribute="trailing" priority="999" constant="8" id="ZPY-xp-9Ew"/>
|
||||
<constraint firstItem="ShI-bz-5g8" firstAttribute="leading" secondItem="YYv-pG-Wkw" secondAttribute="leading" priority="300" constant="112" id="nVP-3U-KG2"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ShI-bz-5g8" secondAttribute="bottom" constant="12" id="w0r-Ip-f9E"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -241,7 +242,7 @@
|
|||
<action selector="searchMainButtonTouchUpInside" destination="iN0-l3-epB" eventType="touchUpInside" id="gd5-zu-3i5"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aa6-N8-acP" userLabel="Turns">
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aa6-N8-acP" userLabel="Turns" customClass="NavigationTurnsView" customModule="cm_beta" customModuleProvider="target">
|
||||
<rect key="frame" x="8" y="28" width="96" height="153"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wt8-EO-MKz" userLabel="First turn" customClass="SolidTouchView">
|
||||
|
@ -376,7 +377,7 @@
|
|||
<constraint firstItem="Xna-Q1-7zW" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="6" id="J7x-54-WT5"/>
|
||||
<constraint firstItem="Tzc-l6-Vvt" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="bottom" priority="750" id="JqF-da-c1k"/>
|
||||
<constraint firstItem="Xna-Q1-7zW" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" priority="500" constant="32" id="KQb-ju-1bf"/>
|
||||
<constraint firstItem="YYv-pG-Wkw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Rd5-Hl-fSF"/>
|
||||
<constraint firstItem="YYv-pG-Wkw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" priority="500" id="Rd5-Hl-fSF"/>
|
||||
<constraint firstItem="Tzc-l6-Vvt" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="TvX-b3-3Sa"/>
|
||||
<constraint firstItem="XMv-au-OYf" firstAttribute="centerX" secondItem="Xna-Q1-7zW" secondAttribute="centerX" id="XwW-6c-UzJ"/>
|
||||
<constraint firstItem="TMW-aw-1RT" firstAttribute="leading" secondItem="Xna-Q1-7zW" secondAttribute="leading" priority="250" constant="-2" id="Y9b-UG-buF"/>
|
||||
|
@ -384,10 +385,12 @@
|
|||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Xna-Q1-7zW" secondAttribute="bottom" constant="64" id="btg-Xq-UVZ"/>
|
||||
<constraint firstItem="TMW-aw-1RT" firstAttribute="centerX" secondItem="Xna-Q1-7zW" secondAttribute="centerX" priority="500" id="ctJ-SL-eKZ"/>
|
||||
<constraint firstItem="Aa6-N8-acP" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="28" id="goU-O7-rpS"/>
|
||||
<constraint firstItem="ShI-bz-5g8" firstAttribute="leading" secondItem="Aa6-N8-acP" secondAttribute="trailing" priority="999" constant="8" id="mdA-B9-tvQ"/>
|
||||
<constraint firstItem="ShI-bz-5g8" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Aa6-N8-acP" secondAttribute="trailing" priority="999" constant="8" id="mdA-B9-tvQ"/>
|
||||
<constraint firstItem="Tzc-l6-Vvt" firstAttribute="top" relation="greaterThanOrEqual" secondItem="Xna-Q1-7zW" secondAttribute="bottom" priority="200" constant="12" id="pFP-r6-dGK"/>
|
||||
<constraint firstItem="Aa6-N8-acP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="pXD-dk-ku2"/>
|
||||
<constraint firstItem="Aa6-N8-acP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" priority="500" constant="8" id="pXD-dk-ku2"/>
|
||||
<constraint firstItem="Xna-Q1-7zW" firstAttribute="top" secondItem="XMv-au-OYf" secondAttribute="bottom" constant="8" id="tEP-Qf-uBZ"/>
|
||||
<constraint firstAttribute="top" secondItem="YYv-pG-Wkw" secondAttribute="bottom" priority="250" id="xMz-Tm-KEn"/>
|
||||
<constraint firstAttribute="leading" secondItem="Aa6-N8-acP" secondAttribute="trailing" priority="250" id="xO2-jM-2bk"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Tzc-l6-Vvt" secondAttribute="bottom" priority="500" id="yP1-ip-l24"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
|
@ -409,10 +412,12 @@
|
|||
<outlet property="secondTurnView" destination="8Zu-Ff-6p2" id="yEK-rY-S50"/>
|
||||
<outlet property="streetNameLabel" destination="ShI-bz-5g8" id="eZd-Es-g0l"/>
|
||||
<outlet property="streetNameView" destination="YYv-pG-Wkw" id="gbk-SH-idq"/>
|
||||
<outlet property="streetNameViewHideOffset" destination="xMz-Tm-KEn" id="Lwv-ep-zvo"/>
|
||||
<outlet property="toastView" destination="Tzc-l6-Vvt" id="gTw-kd-UAJ"/>
|
||||
<outlet property="toastViewHideOffset" destination="JqF-da-c1k" id="WtX-JJ-0lS"/>
|
||||
<outlet property="turnsTopOffset" destination="goU-O7-rpS" id="MEy-6X-7Qq"/>
|
||||
<outlet property="turnsView" destination="Aa6-N8-acP" id="daB-uQ-UFM"/>
|
||||
<outlet property="turnsViewHideOffset" destination="xO2-jM-2bk" id="U11-pU-2ka"/>
|
||||
<outlet property="turnsWidth" destination="6Ja-Xp-g8h" id="kCr-a1-fph"/>
|
||||
<outletCollection property="searchLandscapeConstraints" destination="iSp-hy-tmq" id="h2M-dj-EiD"/>
|
||||
<outletCollection property="searchLandscapeConstraints" destination="C9o-Bx-KXq" id="5a5-4m-Dyf"/>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
final class NavigationStreetNameView: SolidTouchView {
|
||||
override var visibleAreaAffectDirections: MWMAvailableAreaAffectDirections {
|
||||
return alternative(iPhone: [], iPad: .top)
|
||||
}
|
||||
|
||||
override var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections {
|
||||
return alternative(iPhone: [], iPad: .top)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
final class NavigationTurnsView: UIView {
|
||||
override var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections { return alternative(iPhone: [], iPad: .left) }
|
||||
}
|
|
@ -318,4 +318,11 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
return IPAD ? MWMAvailableAreaAffectDirectionsLeft : MWMAvailableAreaAffectDirectionsTop;
|
||||
}
|
||||
|
||||
#pragma mark - PlacePageArea
|
||||
|
||||
- (MWMAvailableAreaAffectDirections)placePageAreaAffectDirections
|
||||
{
|
||||
return IPAD ? MWMAvailableAreaAffectDirectionsLeft : MWMAvailableAreaAffectDirectionsNone;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -111,6 +111,7 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * visibleAreaBottom;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * visibleAreaKeyboard;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * placePageAreaKeyboard;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -596,7 +597,12 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
|
||||
#pragma mark - MWMKeyboard
|
||||
|
||||
- (void)onKeyboardAnimation { self.visibleAreaKeyboard.constant = [MWMKeyboard keyboardHeight]; }
|
||||
- (void)onKeyboardAnimation
|
||||
{
|
||||
auto const kbHeight = [MWMKeyboard keyboardHeight];
|
||||
self.visibleAreaKeyboard.constant = kbHeight;
|
||||
self.placePageAreaKeyboard.constant = kbHeight;
|
||||
}
|
||||
#pragma mark - Properties
|
||||
|
||||
- (MWMMapViewControlsManager *)controlsManager
|
||||
|
|
|
@ -499,6 +499,18 @@
|
|||
34E776131F14B17F003040B3 /* AvailableArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776121F14B17F003040B3 /* AvailableArea.swift */; };
|
||||
34E776141F14B17F003040B3 /* AvailableArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776121F14B17F003040B3 /* AvailableArea.swift */; };
|
||||
34E776151F14B17F003040B3 /* AvailableArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776121F14B17F003040B3 /* AvailableArea.swift */; };
|
||||
34E7761E1F14DB48003040B3 /* PlacePageArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E7761D1F14DB48003040B3 /* PlacePageArea.swift */; };
|
||||
34E7761F1F14DB48003040B3 /* PlacePageArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E7761D1F14DB48003040B3 /* PlacePageArea.swift */; };
|
||||
34E776201F14DB48003040B3 /* PlacePageArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E7761D1F14DB48003040B3 /* PlacePageArea.swift */; };
|
||||
34E776261F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776251F14FE77003040B3 /* NavigationStreetNameView.swift */; };
|
||||
34E776271F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776251F14FE77003040B3 /* NavigationStreetNameView.swift */; };
|
||||
34E776281F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776251F14FE77003040B3 /* NavigationStreetNameView.swift */; };
|
||||
34E7762A1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776291F150AFD003040B3 /* NavigationTurnsView.swift */; };
|
||||
34E7762B1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776291F150AFD003040B3 /* NavigationTurnsView.swift */; };
|
||||
34E7762C1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E776291F150AFD003040B3 /* NavigationTurnsView.swift */; };
|
||||
34E776321F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */; };
|
||||
34E776331F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */; };
|
||||
34E776341F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */; };
|
||||
34EE259D1EFA682D00F870AB /* PPViatorCarouselCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34EE259C1EFA682D00F870AB /* PPViatorCarouselCell.swift */; };
|
||||
34EE259E1EFA682D00F870AB /* PPViatorCarouselCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34EE259C1EFA682D00F870AB /* PPViatorCarouselCell.swift */; };
|
||||
34EE259F1EFA682D00F870AB /* PPViatorCarouselCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34EE259C1EFA682D00F870AB /* PPViatorCarouselCell.swift */; };
|
||||
|
@ -1922,6 +1934,11 @@
|
|||
34E7760E1F14B165003040B3 /* VisibleArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisibleArea.swift; sourceTree = "<group>"; };
|
||||
34E776121F14B17F003040B3 /* AvailableArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableArea.swift; sourceTree = "<group>"; };
|
||||
34E776161F14B6E2003040B3 /* MWMAvailableAreaAffectDirection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMAvailableAreaAffectDirection.h; sourceTree = "<group>"; };
|
||||
34E7761D1F14DB48003040B3 /* PlacePageArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlacePageArea.swift; sourceTree = "<group>"; };
|
||||
34E776251F14FE77003040B3 /* NavigationStreetNameView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationStreetNameView.swift; sourceTree = "<group>"; };
|
||||
34E776291F150AFD003040B3 /* NavigationTurnsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationTurnsView.swift; sourceTree = "<group>"; };
|
||||
34E776301F15FAC2003040B3 /* MWMPlacePageManagerHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageManagerHelper.h; sourceTree = "<group>"; };
|
||||
34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageManagerHelper.mm; sourceTree = "<group>"; };
|
||||
34EE259C1EFA682D00F870AB /* PPViatorCarouselCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PPViatorCarouselCell.swift; sourceTree = "<group>"; };
|
||||
34EE25A01EFA68BC00F870AB /* PPViatorCarouselCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PPViatorCarouselCell.xib; sourceTree = "<group>"; };
|
||||
34EE25A41EFA6AD400F870AB /* ViatorElement.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ViatorElement.xib; sourceTree = "<group>"; };
|
||||
|
@ -3364,6 +3381,8 @@
|
|||
F6BD33821B6240F200F2CE18 /* MWMNavigationView.h */,
|
||||
F6BD33831B6240F200F2CE18 /* MWMNavigationView.mm */,
|
||||
34D783CD1B5F9D7800E0C0EE /* RoutePreview */,
|
||||
34E776251F14FE77003040B3 /* NavigationStreetNameView.swift */,
|
||||
34E776291F150AFD003040B3 /* NavigationTurnsView.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3389,6 +3408,7 @@
|
|||
34E776121F14B17F003040B3 /* AvailableArea.swift */,
|
||||
34E7760E1F14B165003040B3 /* VisibleArea.swift */,
|
||||
34E776161F14B6E2003040B3 /* MWMAvailableAreaAffectDirection.h */,
|
||||
34E7761D1F14DB48003040B3 /* PlacePageArea.swift */,
|
||||
);
|
||||
path = AvailableArea;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3973,6 +3993,8 @@
|
|||
F6E2FC9B1E097B9F0083EBEC /* MWMPlacePageProtocol.h */,
|
||||
F68224A11E5B1B1A00BC1C18 /* MWMPlacePageButtonsProtocol.h */,
|
||||
F6E2FC9C1E097B9F0083EBEC /* PlacePageLayout */,
|
||||
34E776301F15FAC2003040B3 /* MWMPlacePageManagerHelper.h */,
|
||||
34E776311F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm */,
|
||||
);
|
||||
path = PlacePage;
|
||||
sourceTree = "<group>";
|
||||
|
@ -5413,12 +5435,14 @@
|
|||
3454D7C11E07F045004AF2AD /* NSString+Categories.mm in Sources */,
|
||||
340E1EFA1E2F614400CE49BF /* Storyboard.swift in Sources */,
|
||||
F6E2FE7B1E097BA00083EBEC /* MWMPlacePageOpeningHoursCell.mm in Sources */,
|
||||
34E776321F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */,
|
||||
F6E2FF351E097BA00083EBEC /* MWMSearchSuggestionCell.mm in Sources */,
|
||||
F6E2FE391E097BA00083EBEC /* MWMMigrationView.mm in Sources */,
|
||||
F6E2FF3B1E097BA00083EBEC /* MWMSearchTableView.mm in Sources */,
|
||||
F6E2FF651E097BA00083EBEC /* MWMTTSSettingsViewController.mm in Sources */,
|
||||
F6381BF51CD12045004CA943 /* LocaleTranslator.mm in Sources */,
|
||||
346DB82D1E5C4F6700E3123E /* GalleryItemViewController.swift in Sources */,
|
||||
34E7761E1F14DB48003040B3 /* PlacePageArea.swift in Sources */,
|
||||
340475551E081A4600C92850 /* Statistics.mm in Sources */,
|
||||
F68FCB851DA7BBA6007CC7D7 /* MWMTaxiPreviewDataSource.mm in Sources */,
|
||||
F653CE161C71F60200A453F1 /* MWMAddPlaceNavigationBar.mm in Sources */,
|
||||
|
@ -5488,6 +5512,7 @@
|
|||
F6E2FDA31E097BA00083EBEC /* MWMCuisineEditorViewController.mm in Sources */,
|
||||
346EDADB1B9F0E35004F8DB5 /* MWMMultilineLabel.mm in Sources */,
|
||||
34D3B0291E389D05004100F9 /* MWMEditorAdditionalNameTableViewCell.mm in Sources */,
|
||||
34E776261F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */,
|
||||
34926BE61EA4C2A700DCF14C /* SearchBanners.swift in Sources */,
|
||||
34D4FA621E26572D003F53EF /* FirstLaunchController.swift in Sources */,
|
||||
34C9BD041C6DB693000DC38D /* MWMViewController.mm in Sources */,
|
||||
|
@ -5498,6 +5523,7 @@
|
|||
F6E2FEFC1E097BA00083EBEC /* MWMSearchCategoryCell.mm in Sources */,
|
||||
3454D7CA1E07F045004AF2AD /* UIColor+MapsMeColor.mm in Sources */,
|
||||
3454D7BE1E07F045004AF2AD /* DateComponentsFormatter+ETA.swift in Sources */,
|
||||
34E7762A1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */,
|
||||
34D3B0471E389D05004100F9 /* MWMNoteCell.mm in Sources */,
|
||||
F626D52E1C3E6CAA00C17D15 /* MWMTableViewCell.mm in Sources */,
|
||||
F6E2FE961E097BA00083EBEC /* ContextViews.mm in Sources */,
|
||||
|
@ -5719,12 +5745,14 @@
|
|||
F6664C021E6459DA00E703C2 /* PPReviewHeaderCell.swift in Sources */,
|
||||
F6E2FE7C1E097BA00083EBEC /* MWMPlacePageOpeningHoursCell.mm in Sources */,
|
||||
340E1EFB1E2F614400CE49BF /* Storyboard.swift in Sources */,
|
||||
34E776331F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */,
|
||||
F6E2FF361E097BA00083EBEC /* MWMSearchSuggestionCell.mm in Sources */,
|
||||
F6E2FE3A1E097BA00083EBEC /* MWMMigrationView.mm in Sources */,
|
||||
F6E2FF3C1E097BA00083EBEC /* MWMSearchTableView.mm in Sources */,
|
||||
F6E2FF661E097BA00083EBEC /* MWMTTSSettingsViewController.mm in Sources */,
|
||||
3454D7C21E07F045004AF2AD /* NSString+Categories.mm in Sources */,
|
||||
6741A9FE1BF340DE002C974C /* SelectSetVC.mm in Sources */,
|
||||
34E7761F1F14DB48003040B3 /* PlacePageArea.swift in Sources */,
|
||||
346DB82E1E5C4F6700E3123E /* GalleryItemViewController.swift in Sources */,
|
||||
340475561E081A4600C92850 /* Statistics.mm in Sources */,
|
||||
F6381BF61CD12045004CA943 /* LocaleTranslator.mm in Sources */,
|
||||
|
@ -5794,6 +5822,7 @@
|
|||
34C9BD051C6DB693000DC38D /* MWMViewController.mm in Sources */,
|
||||
F6E2FDA41E097BA00083EBEC /* MWMCuisineEditorViewController.mm in Sources */,
|
||||
3454D7CB1E07F045004AF2AD /* UIColor+MapsMeColor.mm in Sources */,
|
||||
34E776271F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */,
|
||||
34926BE71EA4C2A700DCF14C /* SearchBanners.swift in Sources */,
|
||||
34D3B02A1E389D05004100F9 /* MWMEditorAdditionalNameTableViewCell.mm in Sources */,
|
||||
340475711E081A4600C92850 /* MWMSettings.mm in Sources */,
|
||||
|
@ -5804,6 +5833,7 @@
|
|||
F6E2FEFD1E097BA00083EBEC /* MWMSearchCategoryCell.mm in Sources */,
|
||||
3486B5081E27A4B50069C126 /* LocalNotificationManager.mm in Sources */,
|
||||
3454D7BF1E07F045004AF2AD /* DateComponentsFormatter+ETA.swift in Sources */,
|
||||
34E7762B1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */,
|
||||
6741AA1C1BF340DE002C974C /* MWMRoutingDisclaimerAlert.mm in Sources */,
|
||||
34D3B0481E389D05004100F9 /* MWMNoteCell.mm in Sources */,
|
||||
F6E2FE971E097BA00083EBEC /* ContextViews.mm in Sources */,
|
||||
|
@ -6025,12 +6055,14 @@
|
|||
849CF6F61DE842290024A8A5 /* MWMNavigationDashboardEntity.mm in Sources */,
|
||||
340E1EFC1E2F614400CE49BF /* Storyboard.swift in Sources */,
|
||||
F6E2FE7D1E097BA00083EBEC /* MWMPlacePageOpeningHoursCell.mm in Sources */,
|
||||
34E776341F15FAC2003040B3 /* MWMPlacePageManagerHelper.mm in Sources */,
|
||||
F6E2FF371E097BA00083EBEC /* MWMSearchSuggestionCell.mm in Sources */,
|
||||
F6E2FE3B1E097BA00083EBEC /* MWMMigrationView.mm in Sources */,
|
||||
F6E2FF3D1E097BA00083EBEC /* MWMSearchTableView.mm in Sources */,
|
||||
F6E2FF671E097BA00083EBEC /* MWMTTSSettingsViewController.mm in Sources */,
|
||||
3454D7D81E07F045004AF2AD /* UIKitCategories.mm in Sources */,
|
||||
346DB82F1E5C4F6700E3123E /* GalleryItemViewController.swift in Sources */,
|
||||
34E776201F14DB48003040B3 /* PlacePageArea.swift in Sources */,
|
||||
849CF6FB1DE842290024A8A5 /* BookmarksVC.mm in Sources */,
|
||||
849CF6FC1DE842290024A8A5 /* MWMSideButtonsView.mm in Sources */,
|
||||
3454D7C01E07F045004AF2AD /* DateComponentsFormatter+ETA.swift in Sources */,
|
||||
|
@ -6100,6 +6132,7 @@
|
|||
3454D7C31E07F045004AF2AD /* NSString+Categories.mm in Sources */,
|
||||
34D4FA641E26572D003F53EF /* FirstLaunchController.swift in Sources */,
|
||||
34D3B02B1E389D05004100F9 /* MWMEditorAdditionalNameTableViewCell.mm in Sources */,
|
||||
34E776281F14FE77003040B3 /* NavigationStreetNameView.swift in Sources */,
|
||||
34926BE81EA4C2A700DCF14C /* SearchBanners.swift in Sources */,
|
||||
849CF7371DE842290024A8A5 /* MWMTaxiCollectionLayout.mm in Sources */,
|
||||
3454D7C61E07F045004AF2AD /* UIButton+Orientation.mm in Sources */,
|
||||
|
@ -6110,6 +6143,7 @@
|
|||
3404754B1E081A4600C92850 /* AppInfo.mm in Sources */,
|
||||
849CF73C1DE842290024A8A5 /* MWMMultilineLabel.mm in Sources */,
|
||||
849CF73D1DE842290024A8A5 /* MWMViewController.mm in Sources */,
|
||||
34E7762C1F150AFD003040B3 /* NavigationTurnsView.swift in Sources */,
|
||||
34D3B0491E389D05004100F9 /* MWMNoteCell.mm in Sources */,
|
||||
F6E2FE981E097BA00083EBEC /* ContextViews.mm in Sources */,
|
||||
349B926E1DF0518E007779DD /* MWMToast.mm in Sources */,
|
||||
|
|
|
@ -35,14 +35,26 @@ class AvailableArea: UIView {
|
|||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
notifyObserver(frame)
|
||||
scheduleNotification()
|
||||
}
|
||||
|
||||
private func newAffectingViews(view: UIView) -> Set<UIView> {
|
||||
var views = Set<UIView>()
|
||||
if isAreaAffectingView(view) {
|
||||
views.insert(view)
|
||||
}
|
||||
view.subviews.forEach {
|
||||
views.formUnion(newAffectingViews(view: $0))
|
||||
}
|
||||
return views
|
||||
}
|
||||
|
||||
private func update() {
|
||||
guard let sv = superview else { return }
|
||||
let newAVs = Set<UIView>(sv.subviews.filter(filterAffectingViews))
|
||||
let newAVs = newAffectingViews(view: sv)
|
||||
newAVs.subtracting(affectingViews).forEach(addAffectingView)
|
||||
affectingViews = newAVs
|
||||
scheduleNotification()
|
||||
}
|
||||
|
||||
func addConstraints(otherView: UIView, directions: MWMAvailableAreaAffectDirections) {
|
||||
|
@ -60,14 +72,21 @@ class AvailableArea: UIView {
|
|||
.forEach(add)
|
||||
}
|
||||
|
||||
func filterAffectingViews(_ other: UIView) -> Bool {
|
||||
@objc
|
||||
private func scheduleNotification() {
|
||||
let selector = #selector(notifyObserver)
|
||||
NSObject.cancelPreviousPerformRequests(withTarget: self, selector: selector, object: nil)
|
||||
perform(selector, with: nil, afterDelay: 0)
|
||||
}
|
||||
|
||||
func isAreaAffectingView(_ other: UIView) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func addAffectingView(_ other: UIView) {
|
||||
}
|
||||
|
||||
func notifyObserver(_ rect: CGRect) {
|
||||
func notifyObserver() {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
21
iphone/Maps/UI/AvailableArea/PlacePageArea.swift
Normal file
21
iphone/Maps/UI/AvailableArea/PlacePageArea.swift
Normal file
|
@ -0,0 +1,21 @@
|
|||
final class PlacePageArea: AvailableArea {
|
||||
override func isAreaAffectingView(_ other: UIView) -> Bool {
|
||||
return !other.placePageAreaAffectDirections.isEmpty
|
||||
}
|
||||
|
||||
override func addAffectingView(_ other: UIView) {
|
||||
let ov = other.placePageAreaAffectView
|
||||
let directions = ov.placePageAreaAffectDirections
|
||||
addConstraints(otherView: ov, directions: directions)
|
||||
}
|
||||
|
||||
override func notifyObserver() {
|
||||
MWMPlacePageManagerHelper.updateAvailableArea(frame)
|
||||
}
|
||||
}
|
||||
|
||||
extension UIView {
|
||||
var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections { return [] }
|
||||
|
||||
var placePageAreaAffectView: UIView { return self }
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
final class VisibleArea: AvailableArea {
|
||||
override func filterAffectingViews(_ other: UIView) -> Bool {
|
||||
override func isAreaAffectingView(_ other: UIView) -> Bool {
|
||||
return !other.visibleAreaAffectDirections.isEmpty
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ final class VisibleArea: AvailableArea {
|
|||
addConstraints(otherView: ov, directions: directions)
|
||||
}
|
||||
|
||||
override func notifyObserver(_ rect: CGRect) {
|
||||
MWMFrameworkHelper.setVisibleViewport(rect)
|
||||
override func notifyObserver() {
|
||||
MWMFrameworkHelper.setVisibleViewport(frame)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -741,4 +741,11 @@ CGFloat constexpr kTimeWidthRegular = 128;
|
|||
_searchIsActive = self.searchButton.selected = searchIsActive;
|
||||
}
|
||||
|
||||
#pragma mark - VisibleArea / PlacePageArea
|
||||
|
||||
- (MWMAvailableAreaAffectDirections)placePageAreaAffectDirections
|
||||
{
|
||||
return IPAD ? MWMAvailableAreaAffectDirectionsBottom : MWMAvailableAreaAffectDirectionsNone;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -605,25 +605,21 @@ void logPointEvent(MWMRoutePoint * pt, NSString * eventType)
|
|||
|
||||
- (void)reviewOn:(NSInteger)starNumber
|
||||
{
|
||||
GetFramework().GetUGCApi().GetUGCUpdate(self.data.featureId, [self, starNumber](ugc::UGCUpdate const & ugc) {
|
||||
auto viewModel = self.data.reviewViewModel;
|
||||
[viewModel setDefaultStarCount:starNumber];
|
||||
auto controller = [MWMUGCReviewController instanceFromViewModel:viewModel];
|
||||
[self.ownerViewController.navigationController pushViewController:controller animated:YES];
|
||||
});
|
||||
GetFramework().GetUGCApi().GetUGCUpdate(self.data.featureId, [self, starNumber](ugc::UGCUpdate const & ugc) {
|
||||
auto viewModel = self.data.reviewViewModel;
|
||||
[viewModel setDefaultStarCount:starNumber];
|
||||
auto controller = [MWMUGCReviewController instanceFromViewModel:viewModel];
|
||||
[self.ownerViewController.navigationController pushViewController:controller animated:YES];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - On rotate
|
||||
#pragma mark - AvailableArea / PlacePageArea
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size
|
||||
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||
- (void)updateAvailableArea:(CGRect)frame
|
||||
{
|
||||
[coordinator
|
||||
animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
||||
[self.layout layoutWithSize:size];
|
||||
}
|
||||
completion:^(id<UIViewControllerTransitionCoordinatorContext> context){
|
||||
}];
|
||||
auto data = self.data;
|
||||
if (data)
|
||||
[self.layout updateAvailableArea:frame];
|
||||
}
|
||||
|
||||
#pragma mark - MWMFeatureHolder
|
||||
|
@ -639,26 +635,4 @@ void logPointEvent(MWMRoutePoint * pt, NSString * eventType)
|
|||
|
||||
- (MapViewController *)ownerViewController { return [MapViewController controller]; }
|
||||
|
||||
#pragma mark - Deprecated
|
||||
|
||||
@synthesize leftBound = _leftBound;
|
||||
@synthesize topBound = _topBound;
|
||||
|
||||
- (void)setTopBound:(CGFloat)topBound
|
||||
{
|
||||
if (_topBound == topBound)
|
||||
return;
|
||||
|
||||
_topBound = topBound;
|
||||
[self.layout updateTopBound];
|
||||
}
|
||||
|
||||
- (void)setLeftBound:(CGFloat)leftBound
|
||||
{
|
||||
if (_leftBound == leftBound)
|
||||
return;
|
||||
|
||||
_leftBound = leftBound;
|
||||
[self.layout updateLeftBound];
|
||||
}
|
||||
@end
|
||||
|
|
5
iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h
Normal file
5
iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
@interface MWMPlacePageManagerHelper : NSObject
|
||||
|
||||
+ (void)updateAvailableArea:(CGRect)frame;
|
||||
|
||||
@end
|
24
iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm
Normal file
24
iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm
Normal file
|
@ -0,0 +1,24 @@
|
|||
#import "MWMPlacePageManagerHelper.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMPlacePageManager.h"
|
||||
|
||||
@interface MWMMapViewControlsManager ()
|
||||
|
||||
@property(nonatomic) MWMPlacePageManager * placePageManager;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMPlacePageManager ()
|
||||
|
||||
- (void)updateAvailableArea:(CGRect)frame;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageManagerHelper
|
||||
|
||||
+ (void)updateAvailableArea:(CGRect)frame
|
||||
{
|
||||
[[MWMMapViewControlsManager manager].placePageManager updateAvailableArea:frame];
|
||||
}
|
||||
|
||||
@end
|
|
@ -48,9 +48,6 @@ struct HotelFacility;
|
|||
|
||||
@protocol MWMPlacePageProtocol<MWMActionBarProtocol, MWMPlacePageButtonsProtocol, MWMFeatureHolder, MWMBookingInfoHolder>
|
||||
|
||||
@property(nonatomic) CGFloat topBound;
|
||||
@property(nonatomic) CGFloat leftBound;
|
||||
|
||||
- (void)show:(place_page::Info const &)info;
|
||||
- (void)close;
|
||||
- (void)mwm_refreshUI;
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
- (NSString *)distanceToObject;
|
||||
- (void)downloadSelectedArea;
|
||||
- (CGFloat)leftBound;
|
||||
- (CGFloat)topBound;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -31,7 +29,6 @@
|
|||
MWMActionBarProtocol>)delegate
|
||||
dataSource:(id<MWMPlacePageLayoutDataSource>)dataSource;
|
||||
|
||||
- (void)layoutWithSize:(CGSize const &)size;
|
||||
- (void)showWithData:(MWMPlacePageData *)data;
|
||||
- (void)close;
|
||||
|
||||
|
@ -48,10 +45,8 @@
|
|||
- (void)processDownloaderEventWithStatus:(storage::NodeStatus)status progress:(CGFloat)progress;
|
||||
|
||||
- (void)checkCellsVisible;
|
||||
#pragma mark - iPad only
|
||||
|
||||
- (void)updateTopBound;
|
||||
- (void)updateLeftBound;
|
||||
- (void)updateAvailableArea:(CGRect)frame;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -86,9 +86,6 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
auto const Impl = IPAD ? [MWMiPadPlacePageLayoutImpl class] : [MWMiPhonePlacePageLayoutImpl class];
|
||||
_layoutImpl = [[Impl alloc] initOwnerView:view placePageView:_placePageView delegate:delegate];
|
||||
|
||||
if ([_layoutImpl respondsToSelector:@selector(setInitialTopBound:leftBound:)])
|
||||
[_layoutImpl setInitialTopBound:dataSource.topBound leftBound:dataSource.leftBound];
|
||||
|
||||
auto tableView = _placePageView.tableView;
|
||||
_previewLayoutHelper = [[MWMPPPreviewLayoutHelper alloc]
|
||||
initWithTableView:tableView];
|
||||
|
@ -118,11 +115,6 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
[tv registerWithCellClass:pair.second];
|
||||
}
|
||||
|
||||
- (void)layoutWithSize:(CGSize const &)size
|
||||
{
|
||||
[self.layoutImpl onScreenResize:size];
|
||||
}
|
||||
|
||||
- (UIView *)shareAnchor { return self.actionBar.shareAnchor; }
|
||||
- (void)showWithData:(MWMPlacePageData *)data
|
||||
{
|
||||
|
@ -331,30 +323,9 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - iPad only
|
||||
|
||||
- (void)updateTopBound
|
||||
{
|
||||
if (![self.layoutImpl respondsToSelector:@selector(updateLayoutWithTopBound:)])
|
||||
{
|
||||
NSAssert(!IPAD, @"iPad layout must implement updateLayoutWithTopBound:!");
|
||||
return;
|
||||
}
|
||||
|
||||
[self.layoutImpl updateLayoutWithTopBound:self.dataSource.topBound];
|
||||
}
|
||||
|
||||
- (void)updateLeftBound
|
||||
{
|
||||
if (![self.layoutImpl respondsToSelector:@selector(updateLayoutWithLeftBound:)])
|
||||
{
|
||||
NSAssert(!IPAD, @"iPad layout must implement updateLayoutWithLeftBound:!");
|
||||
return;
|
||||
}
|
||||
|
||||
[self.layoutImpl updateLayoutWithLeftBound:self.dataSource.leftBound];
|
||||
}
|
||||
#pragma mark - AvailableArea / PlacePageArea
|
||||
|
||||
- (void)updateAvailableArea:(CGRect)frame { [self.layoutImpl updateAvailableArea:frame]; }
|
||||
#pragma mark - UITableViewDelegate & UITableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
|
@ -678,18 +649,14 @@ map<MetainfoRows, Class> const kMetaInfoCells = {
|
|||
|
||||
#pragma mark - MWMPlacePageViewUpdateProtocol
|
||||
|
||||
- (void)updateWithHeight:(CGFloat)height
|
||||
- (void)updateLayout
|
||||
{
|
||||
auto const sel = @selector(updatePlacePageHeight);
|
||||
auto const sel = @selector(updateContentLayout);
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:sel object:nil];
|
||||
[self performSelector:sel withObject:nil afterDelay:0.1];
|
||||
}
|
||||
|
||||
- (void)updatePlacePageHeight
|
||||
{
|
||||
[self.layoutImpl onUpdatePlacePageWithHeight:self.placePageView.tableView.contentSize.height];
|
||||
}
|
||||
|
||||
- (void)updateContentLayout { [self.layoutImpl updateContentLayout]; }
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setData:(MWMPlacePageData *)data
|
||||
|
|
|
@ -10,9 +10,7 @@ inline void animate(MWMVoidBlock animate, MWMVoidBlock completion = nil)
|
|||
[UIView animateWithDuration:kAnimationSpeed
|
||||
delay:0
|
||||
options:UIViewAnimationOptionCurveEaseIn
|
||||
animations:^{
|
||||
animate();
|
||||
}
|
||||
animations:animate
|
||||
completion:^(BOOL finished) {
|
||||
if (completion)
|
||||
completion();
|
||||
|
@ -30,8 +28,6 @@ inline void animate(MWMVoidBlock animate, MWMVoidBlock completion = nil)
|
|||
delegate:(id<MWMPlacePageLayoutDelegate>)delegate;
|
||||
- (void)onShow;
|
||||
- (void)onClose;
|
||||
- (void)onScreenResize:(CGSize const &)size;
|
||||
- (void)onUpdatePlacePageWithHeight:(CGFloat)height;
|
||||
|
||||
@property(weak, nonatomic) UIView * ownerView;
|
||||
@property(weak, nonatomic) MWMPPView * placePageView;
|
||||
|
@ -39,9 +35,8 @@ inline void animate(MWMVoidBlock animate, MWMVoidBlock completion = nil)
|
|||
@property(weak, nonatomic) MWMPlacePageActionBar * actionBar;
|
||||
|
||||
@optional
|
||||
- (void)updateLayoutWithTopBound:(CGFloat)topBound;
|
||||
- (void)updateLayoutWithLeftBound:(CGFloat)leftBound;
|
||||
- (void)setInitialTopBound:(CGFloat)topBound leftBound:(CGFloat)leftBound;
|
||||
- (void)setPreviewLayoutHelper:(MWMPPPreviewLayoutHelper *)layoutHelper;
|
||||
- (void)updateAvailableArea:(CGRect)frame;
|
||||
- (void)updateContentLayout;
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,13 +7,12 @@ namespace
|
|||
CGFloat const kPlacePageWidth = 360;
|
||||
CGFloat const kLeftOffset = 12;
|
||||
CGFloat const kTopOffset = 36;
|
||||
CGFloat const kBottomOffset = 60;
|
||||
CGFloat const kBottomOffset = 36;
|
||||
} // namespace
|
||||
|
||||
@interface MWMiPadPlacePageLayoutImpl ()<UITableViewDelegate>
|
||||
|
||||
@property(nonatomic) CGFloat topBound;
|
||||
@property(nonatomic) CGFloat leftBound;
|
||||
@property(nonatomic) CGRect availableArea;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -86,67 +85,43 @@ CGFloat const kBottomOffset = 60;
|
|||
});
|
||||
}
|
||||
|
||||
- (void)onScreenResize:(CGSize const &)size
|
||||
- (void)updateAvailableArea:(CGRect)frame
|
||||
{
|
||||
[self layoutPlacePage:self.placePageView.tableView.contentSize.height onScreen:size.height];
|
||||
}
|
||||
|
||||
- (void)onUpdatePlacePageWithHeight:(CGFloat)height
|
||||
{
|
||||
[self layoutPlacePage:height onScreen:self.ownerView.height];
|
||||
}
|
||||
|
||||
- (void)setInitialTopBound:(CGFloat)topBound leftBound:(CGFloat)leftBound
|
||||
{
|
||||
self.topBound = topBound;
|
||||
self.leftBound = leftBound;
|
||||
}
|
||||
|
||||
- (void)updateLayoutWithTopBound:(CGFloat)topBound
|
||||
{
|
||||
self.topBound = topBound;
|
||||
[self layoutPlacePage:self.placePageView.tableView.contentSize.height onScreen:self.ownerView.height];
|
||||
}
|
||||
|
||||
- (void)updateLayoutWithLeftBound:(CGFloat)leftBound
|
||||
{
|
||||
self.leftBound = leftBound;
|
||||
self.availableArea = frame;
|
||||
[self updateContentLayout];
|
||||
place_page_layout::animate(^{
|
||||
self.placePageView.minX = self.leftBound;
|
||||
});
|
||||
}
|
||||
|
||||
- (void)layoutPlacePage:(CGFloat)placePageHeight onScreen:(CGFloat)screenHeight
|
||||
- (void)updateContentLayout
|
||||
{
|
||||
BOOL const isPlacePageWithinScreen = [self isPlacePage:placePageHeight withinScreen:screenHeight];
|
||||
auto ppView = self.placePageView;
|
||||
|
||||
place_page_layout::animate(^{
|
||||
ppView.minY = self.topBound;
|
||||
});
|
||||
CGFloat const placePageHeight = ppView.tableView.contentSize.height;
|
||||
CGFloat const screenHeight = self.availableArea.size.height;
|
||||
|
||||
ppView.height = [self actualPlacePageViewHeightWithPlacePageHeight:placePageHeight
|
||||
screenHeight:screenHeight];
|
||||
|
||||
if (!ppView.tableView.scrollEnabled && !isPlacePageWithinScreen)
|
||||
ppView.tableView.scrollEnabled = YES;
|
||||
place_page_layout::animate(^{
|
||||
ppView.minY = self.topBound;
|
||||
});
|
||||
}
|
||||
|
||||
- (CGFloat)actualPlacePageViewHeightWithPlacePageHeight:(CGFloat)placePageHeight
|
||||
screenHeight:(CGFloat)screenHeight
|
||||
{
|
||||
auto ppView = self.placePageView;
|
||||
if ([self isPlacePage:placePageHeight withinScreen:screenHeight])
|
||||
return placePageHeight + ppView.top.height;
|
||||
|
||||
return screenHeight - kBottomOffset - self.topBound + (ppView.tableView.scrollEnabled ?
|
||||
self.actionBar.height : 0);
|
||||
BOOL const isPlacePageWithinScreen = [self isPlacePage:placePageHeight withinScreen:screenHeight];
|
||||
ppView.tableView.scrollEnabled = !isPlacePageWithinScreen;
|
||||
return isPlacePageWithinScreen ? placePageHeight + ppView.top.height
|
||||
: screenHeight - kBottomOffset - kTopOffset;
|
||||
}
|
||||
|
||||
- (BOOL)isPlacePage:(CGFloat)placePageHeight withinScreen:(CGFloat)screenHeight
|
||||
{
|
||||
auto const placePageFullHeight = placePageHeight;
|
||||
auto const availableSpace = screenHeight - self.topBound - kBottomOffset;
|
||||
auto const availableSpace = screenHeight - kTopOffset - kBottomOffset;
|
||||
return availableSpace > placePageFullHeight;
|
||||
}
|
||||
|
||||
|
@ -184,8 +159,8 @@ CGFloat const kBottomOffset = 60;
|
|||
|
||||
#pragma mark - Top and left bound
|
||||
|
||||
- (CGFloat)topBound { return _topBound + kTopOffset; }
|
||||
- (CGFloat)leftBound { return _leftBound + kLeftOffset; }
|
||||
- (CGFloat)topBound { return self.availableArea.origin.y + kTopOffset; }
|
||||
- (CGFloat)leftBound { return self.availableArea.origin.x + kLeftOffset; }
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
|
|
@ -37,6 +37,8 @@ CGFloat const kMinOffset = 1;
|
|||
@property(nonatomic) CGFloat expandedContentOffset;
|
||||
@property(weak, nonatomic) MWMPPPreviewLayoutHelper * previewLayoutHelper;
|
||||
|
||||
@property(nonatomic) CGRect availableArea;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMiPhonePlacePageLayoutImpl
|
||||
|
@ -104,24 +106,28 @@ CGFloat const kMinOffset = 1;
|
|||
});
|
||||
}
|
||||
|
||||
- (void)onScreenResize:(CGSize const &)size
|
||||
- (void)updateAvailableArea:(CGRect)frame
|
||||
{
|
||||
self.availableArea = frame;
|
||||
|
||||
UIScrollView * sv = self.scrollView;
|
||||
sv.delegate = nil;
|
||||
sv.frame = {{}, size};
|
||||
sv.frame = frame;
|
||||
sv.delegate = self;
|
||||
auto const size = frame.size;
|
||||
self.placePageView.minY = size.height;
|
||||
auto actionBar = self.actionBar;
|
||||
actionBar.frame = {{0., size.height - actionBar.height},
|
||||
{size.width, actionBar.height}};
|
||||
actionBar.frame = {{0., size.height - actionBar.height}, {size.width, actionBar.height}};
|
||||
[self.delegate onPlacePageTopBoundChanged:self.scrollView.contentOffset.y];
|
||||
[sv setContentOffset:{0, self.state == State::Top ? self.topContentOffset : self.expandedContentOffset}
|
||||
animated:YES];
|
||||
[sv setContentOffset:{
|
||||
0, self.state == State::Top ? self.topContentOffset : self.expandedContentOffset
|
||||
}
|
||||
animated:YES];
|
||||
}
|
||||
|
||||
- (void)onUpdatePlacePageWithHeight:(CGFloat)height
|
||||
- (void)updateContentLayout
|
||||
{
|
||||
auto const & size = self.ownerView.size;
|
||||
auto const & size = self.availableArea.size;
|
||||
self.scrollView.contentSize = {size.width, size.height + self.placePageView.height};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@protocol MWMPlacePageViewUpdateProtocol<NSObject>
|
||||
|
||||
- (void)updateWithHeight:(CGFloat)height;
|
||||
- (void)updateLayout;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ CGFloat const kTableViewTopInset = -36;
|
|||
self.currentContentHeight = height;
|
||||
self.height = height + self.top.height;
|
||||
[self setNeedsLayout];
|
||||
[self.delegate updateWithHeight:self.height];
|
||||
[self.delegate updateLayout];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,4 +2,6 @@ import UIKit
|
|||
|
||||
class SearchBar: SolidTouchView {
|
||||
override var visibleAreaAffectDirections: MWMAvailableAreaAffectDirections { return alternative(iPhone: .top, iPad: .left) }
|
||||
|
||||
override var placePageAreaAffectDirections: MWMAvailableAreaAffectDirections { return alternative(iPhone: [], iPad: .left) }
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Wns-nH-AQU">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Wns-nH-AQU">
|
||||
<device id="retina4_0" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
|
@ -29,6 +29,10 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="awj-9E-eBS" customClass="PlacePageArea" customModule="cm_beta" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
|
||||
</view>
|
||||
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FFY-Dy-Wou" customClass="VisibleArea" customModule="cm_beta" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<color key="backgroundColor" red="0.0" green="1" blue="0.0" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
|
||||
|
@ -36,15 +40,21 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" red="0.8666666666666667" green="0.8666666666666667" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="awj-9E-eBS" secondAttribute="trailing" priority="100" id="6cS-mj-HcX"/>
|
||||
<constraint firstItem="FFY-Dy-Wou" firstAttribute="leading" secondItem="USG-6L-Uhw" secondAttribute="leading" priority="100" id="AW8-cN-xzE"/>
|
||||
<constraint firstAttribute="bottomMargin" secondItem="awj-9E-eBS" secondAttribute="bottom" priority="100" id="Kf4-GM-1aY"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="FFY-Dy-Wou" secondAttribute="bottom" id="QQc-TF-hhE"/>
|
||||
<constraint firstItem="awj-9E-eBS" firstAttribute="leading" secondItem="USG-6L-Uhw" secondAttribute="leading" priority="100" id="YBB-Wd-lq6"/>
|
||||
<constraint firstAttribute="bottom" secondItem="FFY-Dy-Wou" secondAttribute="bottom" priority="100" id="ZFU-IG-uZh"/>
|
||||
<constraint firstItem="FFY-Dy-Wou" firstAttribute="top" secondItem="USG-6L-Uhw" secondAttribute="top" priority="100" id="aOI-yX-CJY"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="awj-9E-eBS" secondAttribute="bottom" id="dNo-wc-hvO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="FFY-Dy-Wou" secondAttribute="trailing" priority="100" id="qdF-Ru-TYd"/>
|
||||
<constraint firstAttribute="topMargin" secondItem="awj-9E-eBS" secondAttribute="top" priority="100" id="xFF-Ic-RDu"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="8E8-0f-UV9"/>
|
||||
<connections>
|
||||
<outlet property="placePageAreaKeyboard" destination="dNo-wc-hvO" id="WPJ-RF-gzS"/>
|
||||
<outlet property="visibleAreaBottom" destination="ZFU-IG-uZh" id="Zmh-A4-yUm"/>
|
||||
<outlet property="visibleAreaKeyboard" destination="QQc-TF-hhE" id="rzk-WW-ab6"/>
|
||||
<segue destination="Lfa-Zp-orR" kind="custom" identifier="Map2EditorSegue" customClass="MWMSegue" id="OEF-kR-jKi"/>
|
||||
|
|
|
@ -922,7 +922,7 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
|
|||
{
|
||||
info.m_sponsoredType = SponsoredType::Viator;
|
||||
auto const & sponsoredId = info.GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
|
||||
info.m_sponsoredUrl = viator::Api::GetCityUrl(sponsoredId, info.GetDefaultName());
|
||||
info.m_sponsoredUrl = viator::Api::GetCityUrl(sponsoredId);
|
||||
info.m_isPreviewExtended = true;
|
||||
}
|
||||
else if (ftypes::IsHotelChecker::Instance()(ft))
|
||||
|
|
Loading…
Add table
Reference in a new issue