Skip to content

Commit 911dd95

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 fb3637f commit 911dd95

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
@@ -1054,11 +1054,9 @@ - (void)showMore {
10541054
if (moreItemsViewController == nil) {
10551055
moreItemsViewController = [[MoreItemsViewController alloc] initWithFrame:CGRectMake(dataList.bounds.size.width, 0, dataList.bounds.size.width, dataList.bounds.size.height) mainMenu:moreMenu];
10561056
moreItemsViewController.view.backgroundColor = UIColor.clearColor;
1057-
UIEdgeInsets tableViewInsets = UIEdgeInsetsZero;
1058-
tableViewInsets.bottom = buttonsViewBgToolbar.frame.size.height;
1059-
moreItemsViewController.tableView.contentInset = tableViewInsets;
1060-
moreItemsViewController.tableView.scrollIndicatorInsets = tableViewInsets;
1061-
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, - tableViewInsets.top) animated:NO];
1057+
moreItemsViewController.tableView.contentInset = activeLayoutView.contentInset;
1058+
[self setViewInset:moreItemsViewController.tableView bottom:buttonsViewBgToolbar.frame.size.height];
1059+
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, -moreItemsViewController.tableView.contentInset.top) animated:NO];
10621060
[maskView insertSubview:moreItemsViewController.view aboveSubview:dataList];
10631061
}
10641062

@@ -1906,13 +1904,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19061904
}
19071905
else if (sender.currentIndex == 0) {
19081906
if (enableCollectionView) {
1909-
[collectionView setContentOffset:CGPointZero animated:NO];
1907+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19101908
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19111909
[self initSectionNameOverlayView];
19121910
}
19131911
}
19141912
else {
1915-
[dataList setContentOffset:CGPointZero animated:NO];
1913+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19161914
}
19171915
sectionNameLabel.text = @"🔍";
19181916
return;
@@ -1953,7 +1951,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19531951
if (index != NSNotFound) {
19541952
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
19551953
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
1956-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
1954+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
19571955
}
19581956
return;
19591957
}
@@ -2116,6 +2114,10 @@ - (void)setCellLayoutParameters {
21162114

21172115
#pragma mark - Table Management
21182116

2117+
- (CGFloat)getTableInsetTop {
2118+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2119+
}
2120+
21192121
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21202122
if (isDark) {
21212123
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5456,7 +5458,7 @@ - (void)buildButtons:(int)activeTab {
54565458
// no button, no toolbar
54575459
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
54585460
frame = dataList.frame;
5459-
frame.size.height = self.view.bounds.size.height;
5461+
frame.size.height = maskView.bounds.size.height;
54605462
dataList.frame = frame;
54615463
break;
54625464
case 1:
@@ -5808,7 +5810,7 @@ - (void)viewDidLoad {
58085810
[self initSearchController];
58095811
self.navigationController.view.backgroundColor = UIColor.blackColor;
58105812
self.definesPresentationContext = NO;
5811-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5813+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58125814
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58135815

58145816
if (@available(iOS 15.0, *)) {
@@ -5819,11 +5821,16 @@ - (void)viewDidLoad {
58195821

58205822
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58215823
self.edgesForExtendedLayout = UIRectEdgeNone;
5824+
UIEdgeInsets viewInsets = dataList.contentInset;
5825+
viewInsets.top = [self getTableInsetTop];
5826+
dataList.contentInset = viewInsets;
58225827
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58235828

5824-
CGRect frame = dataList.frame;
5825-
frame.size.height = self.view.bounds.size.height;
5826-
dataList.frame = frame;
5829+
CGRect frame = maskView.frame;
5830+
frame.origin.y -= [self getTableInsetTop];
5831+
frame.size.height += [self getTableInsetTop];
5832+
maskView.frame = frame;
5833+
58275834
buttonsViewBgToolbar.hidden = NO;
58285835

58295836
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)