Skip to content

Commit c2998e7

Browse files
committed
Frosted glass navbar on iPhone
1 parent e917a64 commit c2998e7

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

XBMC Remote/AppDelegate.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,14 @@ - (void)registerDefaultsFromSettingsBundle {
411411
}
412412

413413
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
414-
// iOS 13 and later use appearance for the navigationbar, from iOS 15 this is required as it else defaults to unwanted transparency
414+
// Make navigation bar transparent
415415
if (@available(iOS 13, *)) {
416416
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
417417
[appearance configureWithOpaqueBackground];
418+
[appearance configureWithTransparentBackground];
419+
appearance.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
418420
appearance.titleTextAttributes = @{NSForegroundColorAttributeName : UIColor.whiteColor};
419-
appearance.backgroundColor = NAVBAR_TINT_COLOR;
421+
appearance.backgroundColor = UIColor.clearColor;
420422
[UINavigationBar appearance].standardAppearance = appearance;
421423
[UINavigationBar appearance].scrollEdgeAppearance = appearance;
422424
}

XBMC Remote/DetailViewController.m

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,11 +1114,9 @@ - (void)showMore {
11141114
if (moreItemsViewController == nil) {
11151115
moreItemsViewController = [[MoreItemsViewController alloc] initWithFrame:CGRectMake(dataList.bounds.size.width, 0, dataList.bounds.size.width, dataList.bounds.size.height) mainMenu:moreMenu];
11161116
moreItemsViewController.view.backgroundColor = UIColor.clearColor;
1117-
UIEdgeInsets tableViewInsets = UIEdgeInsetsZero;
1118-
tableViewInsets.bottom = buttonsViewBgToolbar.frame.size.height;
1119-
moreItemsViewController.tableView.contentInset = tableViewInsets;
1120-
moreItemsViewController.tableView.scrollIndicatorInsets = tableViewInsets;
1121-
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, - tableViewInsets.top) animated:NO];
1117+
moreItemsViewController.tableView.contentInset = activeLayoutView.contentInset;
1118+
[self setViewInset:moreItemsViewController.tableView bottom:buttonsViewBgToolbar.frame.size.height];
1119+
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, -moreItemsViewController.tableView.contentInset.top) animated:NO];
11221120
[maskView insertSubview:moreItemsViewController.view aboveSubview:dataList];
11231121
}
11241122

@@ -1964,13 +1962,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19641962
}
19651963
else if (sender.currentIndex == 0) {
19661964
if (enableCollectionView) {
1967-
[collectionView setContentOffset:CGPointZero animated:NO];
1965+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19681966
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19691967
[self initSectionNameOverlayView];
19701968
}
19711969
}
19721970
else {
1973-
[dataList setContentOffset:CGPointZero animated:NO];
1971+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19741972
}
19751973
sectionNameLabel.text = @"🔍";
19761974
return;
@@ -2011,7 +2009,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
20112009
if (index != NSNotFound) {
20122010
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
20132011
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
2014-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
2012+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
20152013
}
20162014
return;
20172015
}
@@ -2174,6 +2172,10 @@ - (void)choseParams {
21742172

21752173
#pragma mark - Table Management
21762174

2175+
- (CGFloat)getTableInsetTop {
2176+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2177+
}
2178+
21772179
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21782180
if (isDark) {
21792181
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5504,7 +5506,7 @@ - (void)buildButtons:(int)activeTab {
55045506
// no button, no toolbar
55055507
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
55065508
frame = dataList.frame;
5507-
frame.size.height = self.view.bounds.size.height;
5509+
frame.size.height = maskView.bounds.size.height;
55085510
dataList.frame = frame;
55095511
break;
55105512
case 1:
@@ -5853,7 +5855,7 @@ - (void)viewDidLoad {
58535855
[self initSearchController];
58545856
self.navigationController.view.backgroundColor = UIColor.blackColor;
58555857
self.definesPresentationContext = NO;
5856-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5858+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58575859
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58585860

58595861
if (@available(iOS 15.0, *)) {
@@ -5864,11 +5866,16 @@ - (void)viewDidLoad {
58645866

58655867
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58665868
self.edgesForExtendedLayout = UIRectEdgeNone;
5869+
UIEdgeInsets viewInsets = dataList.contentInset;
5870+
viewInsets.top = [self getTableInsetTop];
5871+
dataList.contentInset = viewInsets;
58675872
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58685873

5869-
CGRect frame = dataList.frame;
5870-
frame.size.height = self.view.bounds.size.height;
5871-
dataList.frame = frame;
5874+
CGRect frame = maskView.frame;
5875+
frame.origin.y -= [self getTableInsetTop];
5876+
frame.size.height += [self getTableInsetTop];
5877+
maskView.frame = frame;
5878+
58725879
buttonsViewBgToolbar.hidden = NO;
58735880

58745881
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)