diff options
Diffstat (limited to 'iphone')
-rw-r--r-- | iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm | 10 | ||||
-rw-r--r-- | iphone/Maps/Classes/EAGLView.mm | 2 | ||||
-rw-r--r-- | iphone/Maps/Classes/MapViewController.h | 1 | ||||
-rw-r--r-- | iphone/Maps/Classes/MapViewController.mm | 18 | ||||
-rw-r--r-- | iphone/Maps/Core/Framework/MWMFrameworkHelper.h | 2 | ||||
-rw-r--r-- | iphone/Maps/Core/Framework/MWMFrameworkHelper.mm | 11 | ||||
-rw-r--r-- | iphone/Maps/Maps.xcodeproj/project.pbxproj | 24 | ||||
-rw-r--r-- | iphone/Maps/UI/Mapsme.storyboard | 31 | ||||
-rw-r--r-- | iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm | 1 | ||||
-rw-r--r-- | iphone/Maps/UI/PlacePage/PlacePageLayout/MWMiPhonePlacePageLayoutImpl.mm | 3 | ||||
-rw-r--r-- | iphone/Maps/UI/PlacePage/PlacePageLayout/PlacePageView/MWMPPView.mm | 10 | ||||
-rw-r--r-- | iphone/Maps/UI/Search/MWMSearchView.xib | 6 | ||||
-rw-r--r-- | iphone/Maps/UI/Search/SearchBar.swift | 6 | ||||
-rw-r--r-- | iphone/Maps/UI/VisibleArea/VisibleArea.swift | 81 |
14 files changed, 188 insertions, 18 deletions
diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm index 7628724431..235421dfa8 100644 --- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm +++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Views/RoutePreview/MWMRoutePreview.mm @@ -1,12 +1,13 @@ #import "MWMRoutePreview.h" -#import "MWMCommon.h" #import "MWMCircularProgress.h" +#import "MWMCommon.h" #import "MWMNavigationDashboardManager.h" #import "MWMRoutePointCell.h" #import "MWMRoutePointLayout.h" #import "MWMRouter.h" #import "MWMTaxiPreviewDataSource.h" #import "Statistics.h" +#import "SwiftBridge.h" #import "UIButton+Orientation.h" #import "UIImageView+Coloring.h" @@ -481,4 +482,11 @@ CGFloat constexpr kAdditionalHeight = 20.; return cell; } +#pragma mark - VisibleArea + +- (MWMVisibleAreaAffectDirection)visibleAreaAffectDirection +{ + return IPAD ? MWMVisibleAreaAffectDirectionLeft : MWMVisibleAreaAffectDirectionTop; +} + @end diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index cc3829aea3..13d6029b2d 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -110,8 +110,6 @@ double getExactDPI(double contentScaleFactor) dispatch_async(dispatch_get_main_queue(), ^ { GetFramework().OnSize(width, height); - // TODO: Temporary realization of visible viewport, this code must be removed later. - GetFramework().SetVisibleViewport(m2::RectD(0.0, 0.0, width, height)); [self.widgetsManager resize:CGSizeMake(width, height)]; self->_drapeEngineCreated = YES; }); diff --git a/iphone/Maps/Classes/MapViewController.h b/iphone/Maps/Classes/MapViewController.h index 2a65449e45..c2599aaae1 100644 --- a/iphone/Maps/Classes/MapViewController.h +++ b/iphone/Maps/Classes/MapViewController.h @@ -40,5 +40,6 @@ struct AddressInfo; @property(nonatomic, readonly) MWMMapViewControlsManager * controlsManager; @property(nonatomic) MWMAPIBar * apiBar; @property(nonatomic) MWMWelcomePageController * welcomePageController; +@property(nonatomic) CGFloat visibleAreaBottomOffset; @end diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 7036f13a5b..e679600e2d 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -1,16 +1,17 @@ #import "MapViewController.h" #import "BookmarksRootVC.h" #import "BookmarksVC.h" -#import "MWMCommon.h" #import "EAGLView.h" #import "MWMAPIBar.h" #import "MWMAlertViewController.h" #import "MWMAuthorizationCommon.h" #import "MWMAuthorizationLoginViewController.h" #import "MWMAuthorizationWebViewLoginViewController.h" +#import "MWMCommon.h" #import "MWMEditBookmarkController.h" #import "MWMEditorViewController.h" #import "MWMFrameworkListener.h" +#import "MWMKeyboard.h" #import "MWMLocationHelpers.h" #import "MWMLocationManager.h" #import "MWMMapDownloadDialog.h" @@ -94,7 +95,7 @@ BOOL gIsFirstMyPositionMode = YES; @end @interface MapViewController ()<MWMFrameworkDrapeObserver, MWMFrameworkStorageObserver, - MWMWelcomePageControllerProtocol> + MWMWelcomePageControllerProtocol, MWMKeyboardObserver> @property(nonatomic, readwrite) MWMMapViewControlsManager * controlsManager; @@ -106,6 +107,9 @@ BOOL gIsFirstMyPositionMode = YES; @property(nonatomic) BOOL skipForceTouch; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * visibleAreaBottom; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * visibleAreaKeyboard; + @end @implementation MapViewController @@ -266,6 +270,7 @@ BOOL gIsFirstMyPositionMode = YES; [super viewDidLoad]; self.view.clipsToBounds = YES; [self processMyPositionStateModeEvent:location::PendingPosition]; + [MWMKeyboard addObserver:self]; } - (void)mwm_refreshUI @@ -543,6 +548,9 @@ BOOL gIsFirstMyPositionMode = YES; } } +#pragma mark - MWMKeyboard + +- (void)onKeyboardAnimation { self.visibleAreaKeyboard.constant = [MWMKeyboard keyboardHeight]; } #pragma mark - Properties - (MWMMapViewControlsManager *)controlsManager @@ -562,4 +570,10 @@ BOOL gIsFirstMyPositionMode = YES; return _downloadDialog; } +- (CGFloat)visibleAreaBottomOffset { return self.visibleAreaBottom.constant; } +- (void)setVisibleAreaBottomOffset:(CGFloat)visibleAreaBottomOffset +{ + self.visibleAreaBottom.constant = visibleAreaBottomOffset; +} + @end diff --git a/iphone/Maps/Core/Framework/MWMFrameworkHelper.h b/iphone/Maps/Core/Framework/MWMFrameworkHelper.h index 3d1ff0fd6d..63bd5bffc2 100644 --- a/iphone/Maps/Core/Framework/MWMFrameworkHelper.h +++ b/iphone/Maps/Core/Framework/MWMFrameworkHelper.h @@ -2,4 +2,6 @@ + (void)zoomToCurrentPosition; ++ (void)setVisibleViewport:(CGRect)rect; + @end diff --git a/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm b/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm index aab338b735..4e27411e51 100644 --- a/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm +++ b/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm @@ -1,6 +1,7 @@ #import "MWMFrameworkHelper.h" #import "CLLocation+Mercator.h" #import "MWMLocationManager.h" +#import "MapViewController.h" #include "Framework.h" @@ -16,4 +17,14 @@ f.SetViewportCenter(lastLocation.mercator, 13 /* zoom */); } ++ (void)setVisibleViewport:(CGRect)rect +{ + CGFloat const scale = [MapViewController controller].view.contentScaleFactor; + CGFloat const x1 = rect.origin.x * scale; + CGFloat const y1 = rect.origin.y * scale; + CGFloat const x2 = x1 + rect.size.width * scale; + CGFloat const y2 = y1 + rect.size.height * scale; + GetFramework().SetVisibleViewport(m2::RectD(x1, y1, x2, y2)); +} + @end diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 60b5a332f8..51018df849 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -260,6 +260,12 @@ 349C3AED1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */; }; 349C3AEF1D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */; }; 349C3AF01D33A96B002AC7A9 /* MWMNavigationInfoView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */; }; + 349D1AB71E2CB6E0004A2006 /* VisibleArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1AB61E2CB6E0004A2006 /* VisibleArea.swift */; }; + 349D1AB81E2CB6E0004A2006 /* VisibleArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1AB61E2CB6E0004A2006 /* VisibleArea.swift */; }; + 349D1AB91E2CB6E0004A2006 /* VisibleArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1AB61E2CB6E0004A2006 /* VisibleArea.swift */; }; + 349D1ABB1E2D05EF004A2006 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1ABA1E2D05EF004A2006 /* SearchBar.swift */; }; + 349D1ABC1E2D05EF004A2006 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1ABA1E2D05EF004A2006 /* SearchBar.swift */; }; + 349D1ABD1E2D05EF004A2006 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349D1ABA1E2D05EF004A2006 /* SearchBar.swift */; }; 34AB39C11D2BD8310021857D /* MWMStopButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB39C01D2BD8310021857D /* MWMStopButton.mm */; }; 34AB39C21D2BD8310021857D /* MWMStopButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34AB39C01D2BD8310021857D /* MWMStopButton.mm */; }; 34ABA6161C2D185C00FE1BEC /* MWMAuthorizationOSMLoginViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34ABA6151C2D185B00FE1BEC /* MWMAuthorizationOSMLoginViewController.mm */; }; @@ -1567,6 +1573,8 @@ 349C3AEB1D33A933002AC7A9 /* MWMNavigationInfoView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNavigationInfoView.mm; sourceTree = "<group>"; }; 349C3AEE1D33A96B002AC7A9 /* MWMNavigationInfoView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMNavigationInfoView.xib; sourceTree = "<group>"; }; 349C3AF11D33C6EE002AC7A9 /* MWMNavigationDashboardInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMNavigationDashboardInfoProtocol.h; sourceTree = "<group>"; }; + 349D1AB61E2CB6E0004A2006 /* VisibleArea.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisibleArea.swift; sourceTree = "<group>"; }; + 349D1ABA1E2D05EF004A2006 /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; 34AB39BF1D2BD8310021857D /* MWMStopButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMStopButton.h; sourceTree = "<group>"; }; 34AB39C01D2BD8310021857D /* MWMStopButton.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMStopButton.mm; sourceTree = "<group>"; }; 34ABA6141C2D185B00FE1BEC /* MWMAuthorizationOSMLoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAuthorizationOSMLoginViewController.h; sourceTree = "<group>"; }; @@ -2933,6 +2941,14 @@ path = BottomMenu; sourceTree = "<group>"; }; + 349D1AB51E2CB407004A2006 /* VisibleArea */ = { + isa = PBXGroup; + children = ( + 349D1AB61E2CB6E0004A2006 /* VisibleArea.swift */, + ); + path = VisibleArea; + sourceTree = "<group>"; + }; 34ABA60F1C2D17C200FE1BEC /* Login */ = { isa = PBXGroup; children = ( @@ -3245,6 +3261,7 @@ F6E2FBFB1E097B9F0083EBEC /* UI */ = { isa = PBXGroup; children = ( + 349D1AB51E2CB407004A2006 /* VisibleArea */, F6E2FBFC1E097B9F0083EBEC /* Downloader */, F6E2FC291E097B9F0083EBEC /* EditBookmark */, F6E2FC321E097B9F0083EBEC /* Editor */, @@ -3690,6 +3707,7 @@ F6E2FD241E097BA00083EBEC /* TabButtons */, F6E2FD281E097BA00083EBEC /* TableView */, 34845DB11E165E24003D55B9 /* SearchNoResultsViewController.swift */, + 349D1ABA1E2D05EF004A2006 /* SearchBar.swift */, ); path = Search; sourceTree = "<group>"; @@ -4691,6 +4709,7 @@ 46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */, EED10A4511F78D120095FAD4 /* MapViewController.mm in Sources */, F61579341AC2CE9A0032D8E9 /* MWMRateAlert.mm in Sources */, + 349D1ABB1E2D05EF004A2006 /* SearchBar.swift in Sources */, F6E2FD791E097BA00083EBEC /* MWMMapDownloaderDefaultDataSource.mm in Sources */, F6E2FF3E1E097BA00083EBEC /* MWMSearchTableViewController.mm in Sources */, F6E2FDAC1E097BA00083EBEC /* MWMEditorAddAdditionalNameTableViewCell.mm in Sources */, @@ -4748,6 +4767,7 @@ F6BD33811B62403B00F2CE18 /* MWMRoutePreview.mm in Sources */, F6E2FD8B1E097BA00083EBEC /* MWMNoMapsView.mm in Sources */, F6BB6CC31BB1860D00DF1DF2 /* MWMRoutePointLayout.mm in Sources */, + 349D1AB71E2CB6E0004A2006 /* VisibleArea.swift in Sources */, F6E2FD701E097BA00083EBEC /* MWMMapDownloaderTableViewCell.mm in Sources */, F6E2FE4E1E097BA00083EBEC /* MWMActionBarButton.mm in Sources */, 34BF0CC61C31304A00D097EB /* MWMAuthorizationCommon.mm in Sources */, @@ -4941,6 +4961,7 @@ 6741A9B71BF340DE002C974C /* EAGLView.mm in Sources */, 6741A9B81BF340DE002C974C /* MapViewController.mm in Sources */, 6741A9B91BF340DE002C974C /* MWMRateAlert.mm in Sources */, + 349D1ABC1E2D05EF004A2006 /* SearchBar.swift in Sources */, F6E2FD7A1E097BA00083EBEC /* MWMMapDownloaderDefaultDataSource.mm in Sources */, F6E2FF3F1E097BA00083EBEC /* MWMSearchTableViewController.mm in Sources */, F6E2FDAD1E097BA00083EBEC /* MWMEditorAddAdditionalNameTableViewCell.mm in Sources */, @@ -4998,6 +5019,7 @@ F6E2FD8C1E097BA00083EBEC /* MWMNoMapsView.mm in Sources */, 6741A9DB1BF340DE002C974C /* MWMRoutePreview.mm in Sources */, 6741A9DC1BF340DE002C974C /* MWMRoutePointLayout.mm in Sources */, + 349D1AB81E2CB6E0004A2006 /* VisibleArea.swift in Sources */, F6E2FD711E097BA00083EBEC /* MWMMapDownloaderTableViewCell.mm in Sources */, F6E2FE4F1E097BA00083EBEC /* MWMActionBarButton.mm in Sources */, 340475531E081A4600C92850 /* MWMCustomFacebookEvents.mm in Sources */, @@ -5191,6 +5213,7 @@ 849CF6A01DE842290024A8A5 /* EAGLView.mm in Sources */, 849CF6A21DE842290024A8A5 /* MapViewController.mm in Sources */, 3404757F1E081B3300C92850 /* iosOGLContext.mm in Sources */, + 349D1ABD1E2D05EF004A2006 /* SearchBar.swift in Sources */, F6E2FD7B1E097BA00083EBEC /* MWMMapDownloaderDefaultDataSource.mm in Sources */, F6E2FF401E097BA00083EBEC /* MWMSearchTableViewController.mm in Sources */, F6E2FDAE1E097BA00083EBEC /* MWMEditorAddAdditionalNameTableViewCell.mm in Sources */, @@ -5248,6 +5271,7 @@ F6E2FE261E097BA00083EBEC /* MWMOpeningHoursModel.mm in Sources */, 849CF6D51DE842290024A8A5 /* MWMTableViewController.mm in Sources */, F6E2FD8D1E097BA00083EBEC /* MWMNoMapsView.mm in Sources */, + 349D1AB91E2CB6E0004A2006 /* VisibleArea.swift in Sources */, 849CF6D81DE842290024A8A5 /* MWMSegue.mm in Sources */, F6E2FD721E097BA00083EBEC /* MWMMapDownloaderTableViewCell.mm in Sources */, F6E2FE501E097BA00083EBEC /* MWMActionBarButton.mm in Sources */, diff --git a/iphone/Maps/UI/Mapsme.storyboard b/iphone/Maps/UI/Mapsme.storyboard index dcd8941ae7..82f55dd520 100644 --- a/iphone/Maps/UI/Mapsme.storyboard +++ b/iphone/Maps/UI/Mapsme.storyboard @@ -28,10 +28,25 @@ <view key="view" clearsContextBeforeDrawing="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" id="USG-6L-Uhw" customClass="EAGLView"> <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="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"/> + </view> + </subviews> <color key="backgroundColor" red="0.8666666666666667" green="0.8666666666666667" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="FFY-Dy-Wou" firstAttribute="leading" secondItem="USG-6L-Uhw" secondAttribute="leading" priority="100" id="AW8-cN-xzE"/> + <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="FFY-Dy-Wou" secondAttribute="bottom" id="QQc-TF-hhE"/> + <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="trailing" secondItem="FFY-Dy-Wou" secondAttribute="trailing" priority="100" id="qdF-Ru-TYd"/> + </constraints> </view> <navigationItem key="navigationItem" id="8E8-0f-UV9"/> <connections> + <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"/> <segue destination="QlF-CJ-cEG" kind="custom" identifier="MapToCategorySelectorSegue" customClass="MWMSegue" id="4Cc-99-mlN"/> <segue destination="5Wc-fy-NOW" kind="custom" identifier="Map2OsmLogin" customClass="MWMSegue" id="7YC-t5-0WN"/> @@ -46,7 +61,7 @@ </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="cKg-Q7-bFd" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> - <point key="canvasLocation" x="1134" y="444"/> + <point key="canvasLocation" x="1132.5" y="443.66197183098592"/> </scene> <!--Navigation Controller--> <scene sceneID="lCi-qJ-2rn"> @@ -421,18 +436,18 @@ <rect key="frame" x="0.0" y="28" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="RXe-xp-xlR" id="g0x-Vt-1FI"> - <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JcK-nR-UGw"> - <rect key="frame" x="15" y="6" width="31.5" height="19.5"/> + <rect key="frame" x="15" y="5" width="32" height="20"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Cmi-x5-6Vt"> - <rect key="frame" x="15" y="25.5" width="30.5" height="13.5"/> + <rect key="frame" x="15" y="25" width="31" height="14"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <fontDescription key="fontDescription" type="system" pointSize="11"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> @@ -1434,10 +1449,10 @@ <image name="separator_image" width="1" height="1"/> </resources> <inferredMetricsTieBreakers> - <segue reference="OEF-kR-jKi"/> - <segue reference="sMq-pa-AId"/> + <segue reference="Tkr-Ad-FQL"/> + <segue reference="0A8-4b-0A2"/> <segue reference="4Cc-99-mlN"/> - <segue reference="4ye-8o-cjF"/> - <segue reference="hU6-lr-OOV"/> + <segue reference="sMq-pa-AId"/> + <segue reference="OEF-kR-jKi"/> </inferredMetricsTieBreakers> </document> diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index b42275b9c2..2b5bf006cd 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -136,6 +136,7 @@ - (void)onPlacePageTopBoundChanged:(CGFloat)bound { + [MapViewController controller].visibleAreaBottomOffset = bound; [[MWMSideButtons buttons] setBottomBound:self.ownerViewController.view.height - bound]; } diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMiPhonePlacePageLayoutImpl.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMiPhonePlacePageLayoutImpl.mm index 0d72e7e790..e465790aef 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMiPhonePlacePageLayoutImpl.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/MWMiPhonePlacePageLayoutImpl.mm @@ -148,6 +148,7 @@ CGFloat const kMinOffset = 1; id<MWMPlacePageLayoutDelegate> delegate = self.delegate; if (offset.y <= 0) { + [delegate onPlacePageTopBoundChanged:0]; [delegate shouldClose]; return; } @@ -267,8 +268,8 @@ CGFloat const kMinOffset = 1; if (scrollView) { scrollView.delegate = self; - [self.ownerView addSubview:scrollView]; [scrollView addSubview:self.placePageView]; + [self.ownerView addSubview:scrollView]; } else { diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/PlacePageView/MWMPPView.mm b/iphone/Maps/UI/PlacePage/PlacePageLayout/PlacePageView/MWMPPView.mm index db11a02f71..0ae000aaa0 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageLayout/PlacePageView/MWMPPView.mm +++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/PlacePageView/MWMPPView.mm @@ -1,6 +1,7 @@ +#import "MWMPPView.h" #import "MWMCommon.h" #import "MWMPlacePageActionBar.h" -#import "MWMPPView.h" +#import "SwiftBridge.h" namespace { @@ -96,4 +97,11 @@ CGFloat const kTableViewTopInset = -36; } } +#pragma mark - VisibleArea + +- (MWMVisibleAreaAffectDirection)visibleAreaAffectDirection +{ + return IPAD ? MWMVisibleAreaAffectDirectionLeft : MWMVisibleAreaAffectDirectionNone; +} + @end diff --git a/iphone/Maps/UI/Search/MWMSearchView.xib b/iphone/Maps/UI/Search/MWMSearchView.xib index 7fd109fab1..b86f2290e8 100644 --- a/iphone/Maps/UI/Search/MWMSearchView.xib +++ b/iphone/Maps/UI/Search/MWMSearchView.xib @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -32,7 +32,7 @@ <outletCollection property="topViews" destination="u9y-bx-NGd" id="mAw-CD-QQV"/> </connections> </placeholder> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HcT-Cg-vp3" userLabel="SearchBar" customClass="SolidTouchView"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HcT-Cg-vp3" customClass="SearchBar" customModule="cm_beta" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8lb-Vi-0oJ" userLabel="StatusBarBackground"> diff --git a/iphone/Maps/UI/Search/SearchBar.swift b/iphone/Maps/UI/Search/SearchBar.swift new file mode 100644 index 0000000000..d2fa0bb167 --- /dev/null +++ b/iphone/Maps/UI/Search/SearchBar.swift @@ -0,0 +1,6 @@ +import UIKit + +class SearchBar: SolidTouchView { + + override var visibleAreaAffectDirection: VisibleArea.Direction { return IPAD() ? .left : .top } +} diff --git a/iphone/Maps/UI/VisibleArea/VisibleArea.swift b/iphone/Maps/UI/VisibleArea/VisibleArea.swift new file mode 100644 index 0000000000..e5770c936b --- /dev/null +++ b/iphone/Maps/UI/VisibleArea/VisibleArea.swift @@ -0,0 +1,81 @@ +import UIKit + +class VisibleArea: UIView { + + @objc(MWMVisibleAreaAffectDirection) + enum Direction: Int { + + case none + case top + case bottom + case left + case right + } + + private let observeKeyPath = "sublayers" + + private var affectingViews = Set<UIView>() + + override func didMoveToSuperview() { + super.didMoveToSuperview() + subscribe() + update() + } + + deinit { + unsubscribe() + } + + private func subscribe() { + guard let ol = superview?.layer else { return } + ol.addObserver(self, forKeyPath: observeKeyPath, options: .new, context: nil) + } + + private func unsubscribe() { + guard let ol = superview?.layer else { return } + ol.removeObserver(self, forKeyPath: observeKeyPath) + } + + override func observeValue(forKeyPath keyPath: String?, of _: Any?, change _: [NSKeyValueChangeKey: Any]?, context _: UnsafeMutableRawPointer?) { + if keyPath == observeKeyPath { + DispatchQueue.main.async { + self.update() + } + } + } + + private func update() { + guard let sv = superview else { return } + let newAVs = Set<UIView>(sv.subviews.filter { $0.visibleAreaAffectDirection != .none }) + newAVs.subtracting(affectingViews).forEach { addAffectingView($0.visibleAreaAffectView) } + affectingViews = newAVs + } + + private func addAffectingView(_ other: UIView?) { + guard let ov = other else { return } + let sa: NSLayoutAttribute + let oa: NSLayoutAttribute + let rel: NSLayoutRelation + switch ov.visibleAreaAffectDirection { + case .none: return + case .top: (sa, oa, rel) = (.top, .bottom, .greaterThanOrEqual) + case .bottom: (sa, oa, rel) = (.bottom, .top, .lessThanOrEqual) + case .left: (sa, oa, rel) = (.left, .right, .greaterThanOrEqual) + case .right: (sa, oa, rel) = (.right, .left, .lessThanOrEqual) + } + NSLayoutConstraint(item: self, attribute: sa, relatedBy: rel, toItem: ov, attribute: oa, multiplier: 1, constant: 0).isActive = true + } + + override func layoutSubviews() { + super.layoutSubviews() + print(frame) + MWMFrameworkHelper.setVisibleViewport(frame) + } +} + +extension UIView { + + var visibleAreaAffectDirection: VisibleArea.Direction { return .none } + + var visibleAreaAffectView: UIView { return self } +} |