Skip to content

Commit 007e059

Browse files
committed
Frosted glass navbar on iPhone
Make navbar transparent and add the desired blur effect. Let the table view and the collection view extend underneath the navbar and set the inset accordingly.
1 parent 90a7154 commit 007e059

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
@@ -110,12 +110,14 @@ - (void)registerDefaultsFromSettingsBundle {
110110
}
111111

112112
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
113-
// iOS 13 and later use appearance for the navigationbar, from iOS 15 this is required as it else defaults to unwanted transparency
113+
// Make navigation bar transparent
114114
if (@available(iOS 13, *)) {
115115
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
116116
[appearance configureWithOpaqueBackground];
117+
[appearance configureWithTransparentBackground];
118+
appearance.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
117119
appearance.titleTextAttributes = @{NSForegroundColorAttributeName : UIColor.whiteColor};
118-
appearance.backgroundColor = NAVBAR_TINT_COLOR;
120+
appearance.backgroundColor = UIColor.clearColor;
119121
[UINavigationBar appearance].standardAppearance = appearance;
120122
[UINavigationBar appearance].scrollEdgeAppearance = appearance;
121123
}

XBMC Remote/DetailViewController.m

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,11 +1058,9 @@ - (void)showMore {
10581058
if (moreItemsViewController == nil) {
10591059
moreItemsViewController = [[MoreItemsViewController alloc] initWithFrame:CGRectMake(dataList.bounds.size.width, 0, dataList.bounds.size.width, dataList.bounds.size.height) mainMenu:moreMenu];
10601060
moreItemsViewController.view.backgroundColor = UIColor.clearColor;
1061-
UIEdgeInsets tableViewInsets = UIEdgeInsetsZero;
1062-
tableViewInsets.bottom = buttonsViewBgToolbar.frame.size.height;
1063-
moreItemsViewController.tableView.contentInset = tableViewInsets;
1064-
moreItemsViewController.tableView.scrollIndicatorInsets = tableViewInsets;
1065-
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, - tableViewInsets.top) animated:NO];
1061+
moreItemsViewController.tableView.contentInset = activeLayoutView.contentInset;
1062+
[self setViewInset:moreItemsViewController.tableView bottom:buttonsViewBgToolbar.frame.size.height];
1063+
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, -moreItemsViewController.tableView.contentInset.top) animated:NO];
10661064
[maskView insertSubview:moreItemsViewController.view aboveSubview:dataList];
10671065
}
10681066

@@ -1910,13 +1908,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19101908
}
19111909
else if (sender.currentIndex == 0) {
19121910
if (enableCollectionView) {
1913-
[collectionView setContentOffset:CGPointZero animated:NO];
1911+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19141912
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19151913
[self initSectionNameOverlayView];
19161914
}
19171915
}
19181916
else {
1919-
[dataList setContentOffset:CGPointZero animated:NO];
1917+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19201918
}
19211919
sectionNameLabel.text = @"🔍";
19221920
return;
@@ -1957,7 +1955,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19571955
if (index != NSNotFound) {
19581956
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
19591957
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
1960-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
1958+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
19611959
}
19621960
return;
19631961
}
@@ -2120,6 +2118,10 @@ - (void)setCellLayoutParameters {
21202118

21212119
#pragma mark - Table Management
21222120

2121+
- (CGFloat)getTableInsetTop {
2122+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2123+
}
2124+
21232125
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21242126
if (isDark) {
21252127
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5477,7 +5479,7 @@ - (void)buildButtons:(int)activeTab {
54775479
// no button, no toolbar
54785480
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
54795481
frame = dataList.frame;
5480-
frame.size.height = self.view.bounds.size.height;
5482+
frame.size.height = maskView.bounds.size.height;
54815483
dataList.frame = frame;
54825484
break;
54835485
case 1:
@@ -5827,7 +5829,7 @@ - (void)viewDidLoad {
58275829
[self initSearchController];
58285830
self.navigationController.view.backgroundColor = UIColor.blackColor;
58295831
self.definesPresentationContext = NO;
5830-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5832+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58315833
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58325834

58335835
if (@available(iOS 15.0, *)) {
@@ -5838,11 +5840,16 @@ - (void)viewDidLoad {
58385840

58395841
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58405842
self.edgesForExtendedLayout = UIRectEdgeNone;
5843+
UIEdgeInsets viewInsets = dataList.contentInset;
5844+
viewInsets.top = [self getTableInsetTop];
5845+
dataList.contentInset = viewInsets;
58415846
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58425847

5843-
CGRect frame = dataList.frame;
5844-
frame.size.height = self.view.bounds.size.height;
5845-
dataList.frame = frame;
5848+
CGRect frame = maskView.frame;
5849+
frame.origin.y -= [self getTableInsetTop];
5850+
frame.size.height += [self getTableInsetTop];
5851+
maskView.frame = frame;
5852+
58465853
buttonsViewBgToolbar.hidden = NO;
58475854

58485855
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)