forked from organicmaps/organicmaps
Merge pull request #3864 from igrechuhin/status-bar-style
[ios] Fixed status bar style.
This commit is contained in:
commit
b4d8c1c997
4 changed files with 28 additions and 17 deletions
|
@ -14,17 +14,19 @@
|
|||
|
||||
+ (MWMMapViewControlsManager *)manager;
|
||||
|
||||
@property (nonatomic) BOOL hidden;
|
||||
@property (nonatomic) BOOL zoomHidden;
|
||||
@property (nonatomic) BOOL sideButtonsHidden;
|
||||
@property (nonatomic) MWMBottomMenuState menuState;
|
||||
@property (nonatomic, readonly) MWMNavigationDashboardState navigationState;
|
||||
@property (nonatomic, readonly) MWMPlacePageEntity * placePageEntity;
|
||||
@property (nonatomic) BOOL searchHidden;
|
||||
@property(nonatomic) BOOL hidden;
|
||||
@property(nonatomic) BOOL zoomHidden;
|
||||
@property(nonatomic) BOOL sideButtonsHidden;
|
||||
@property(nonatomic) MWMBottomMenuState menuState;
|
||||
@property(nonatomic, readonly) MWMNavigationDashboardState navigationState;
|
||||
@property(nonatomic, readonly) MWMPlacePageEntity * placePageEntity;
|
||||
@property(nonatomic) BOOL searchHidden;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("init is not available")));
|
||||
- (instancetype)initWithParentController:(MapViewController *)controller;
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle;
|
||||
|
||||
#pragma mark - Layout
|
||||
|
||||
- (void)refreshLayout;
|
||||
|
@ -37,7 +39,7 @@
|
|||
|
||||
#pragma mark - MWMPlacePageViewManager
|
||||
|
||||
@property (nonatomic, readonly) BOOL isDirectionViewShown;
|
||||
@property(nonatomic, readonly) BOOL isDirectionViewShown;
|
||||
|
||||
- (void)dismissPlacePage;
|
||||
- (void)showPlacePage:(place_page::Info const &)info;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#import "MapViewController.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "Statistics.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
|
||||
#import "3party/Alohalytics/src/alohalytics_objc.h"
|
||||
|
||||
|
@ -70,6 +71,21 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
BOOL const isNightMode = [UIColor isNightMode];
|
||||
BOOL const isLight = (self.searchManager.state == MWMSearchManagerStateMapSearch &&
|
||||
self.navigationState != MWMNavigationDashboardStateNavigation) ||
|
||||
(self.searchManager.state != MWMSearchManagerStateMapSearch &&
|
||||
self.searchManager.state != MWMSearchManagerStateHidden) ||
|
||||
self.navigationState == MWMNavigationDashboardStatePlanning ||
|
||||
self.menuState == MWMBottomMenuStateActive || self.isDirectionViewShown ||
|
||||
(isNightMode && self.navigationState != MWMNavigationDashboardStateHidden) ||
|
||||
MapsAppDelegate.theApp.routingPlaneMode != MWMRoutingPlaneModeNone;
|
||||
return (isLight || (!isLight && isNightMode)) ? UIStatusBarStyleLightContent
|
||||
: UIStatusBarStyleDefault;
|
||||
}
|
||||
|
||||
#pragma mark - My Position
|
||||
|
||||
- (void)processMyPositionStateModeEvent:(location::EMyPositionMode)mode
|
||||
|
|
|
@ -107,6 +107,7 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
|
|||
self.routePreview = nil;
|
||||
[self.navigationInfoView remove];
|
||||
self.navigationInfoView = nil;
|
||||
[MWMMapViewControlsManager manager].searchHidden = YES;
|
||||
}
|
||||
|
||||
- (void)showStatePrepare
|
||||
|
|
|
@ -371,15 +371,7 @@ BOOL gIsFirstMyPositionMode = YES;
|
|||
- (BOOL)prefersStatusBarHidden { return self.apiBar.isVisible; }
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
BOOL const isNightMode = [UIColor isNightMode];
|
||||
BOOL const isLight =
|
||||
!self.controlsManager.searchHidden ||
|
||||
self.controlsManager.menuState == MWMBottomMenuStateActive ||
|
||||
self.controlsManager.isDirectionViewShown ||
|
||||
(isNightMode && self.controlsManager.navigationState != MWMNavigationDashboardStateHidden) ||
|
||||
MapsAppDelegate.theApp.routingPlaneMode != MWMRoutingPlaneModeNone;
|
||||
return (isLight || (!isLight && isNightMode)) ? UIStatusBarStyleLightContent
|
||||
: UIStatusBarStyleDefault;
|
||||
return [self.controlsManager preferredStatusBarStyle];
|
||||
}
|
||||
|
||||
- (void)updateStatusBarStyle { [self setNeedsStatusBarAppearanceUpdate]; }
|
||||
|
|
Loading…
Add table
Reference in a new issue