Skip to content

Commit 63b7763

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 c82b384 commit 63b7763

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;
@@ -5478,7 +5480,7 @@ - (void)buildButtons:(int)activeTab {
54785480
// no button, no toolbar
54795481
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
54805482
frame = dataList.frame;
5481-
frame.size.height = self.view.bounds.size.height;
5483+
frame.size.height = maskView.bounds.size.height;
54825484
dataList.frame = frame;
54835485
break;
54845486
case 1:
@@ -5828,7 +5830,7 @@ - (void)viewDidLoad {
58285830
[self initSearchController];
58295831
self.navigationController.view.backgroundColor = UIColor.blackColor;
58305832
self.definesPresentationContext = NO;
5831-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5833+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58325834
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58335835

58345836
if (@available(iOS 15.0, *)) {
@@ -5839,11 +5841,16 @@ - (void)viewDidLoad {
58395841

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

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

58495856
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)