Skip to content

Commit 0055010

Browse files
committed
Frosted glass navbar on iPhone
1 parent 9e980a3 commit 0055010

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

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

XBMC Remote/DetailViewController.m

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

@@ -1969,13 +1967,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19691967
}
19701968
else if (sender.currentIndex == 0) {
19711969
if (enableCollectionView) {
1972-
[collectionView setContentOffset:CGPointZero animated:NO];
1970+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19731971
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19741972
[self initSectionNameOverlayView];
19751973
}
19761974
}
19771975
else {
1978-
[dataList setContentOffset:CGPointZero animated:NO];
1976+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19791977
}
19801978
sectionNameLabel.text = @"🔍";
19811979
return;
@@ -2016,7 +2014,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
20162014
if (index != NSNotFound) {
20172015
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
20182016
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
2019-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
2017+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
20202018
}
20212019
return;
20222020
}
@@ -2179,6 +2177,10 @@ - (void)choseParams {
21792177

21802178
#pragma mark - Table Management
21812179

2180+
- (CGFloat)getTableInsetTop {
2181+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2182+
}
2183+
21822184
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21832185
if (isDark) {
21842186
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5514,7 +5516,7 @@ - (void)buildButtons:(int)activeTab {
55145516
// no button, no toolbar
55155517
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
55165518
frame = dataList.frame;
5517-
frame.size.height = self.view.bounds.size.height;
5519+
frame.size.height = maskView.bounds.size.height;
55185520
dataList.frame = frame;
55195521
break;
55205522
case 1:
@@ -5863,7 +5865,7 @@ - (void)viewDidLoad {
58635865
[self initSearchController];
58645866
self.navigationController.view.backgroundColor = UIColor.blackColor;
58655867
self.definesPresentationContext = NO;
5866-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5868+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58675869
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58685870

58695871
if (@available(iOS 15.0, *)) {
@@ -5874,11 +5876,16 @@ - (void)viewDidLoad {
58745876

58755877
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58765878
self.edgesForExtendedLayout = UIRectEdgeNone;
5879+
UIEdgeInsets viewInsets = dataList.contentInset;
5880+
viewInsets.top = [self getTableInsetTop];
5881+
dataList.contentInset = viewInsets;
58775882
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58785883

5879-
CGRect frame = dataList.frame;
5880-
frame.size.height = self.view.bounds.size.height;
5881-
dataList.frame = frame;
5884+
CGRect frame = maskView.frame;
5885+
frame.origin.y -= [self getTableInsetTop];
5886+
frame.size.height += [self getTableInsetTop];
5887+
maskView.frame = frame;
5888+
58825889
buttonsViewBgToolbar.hidden = NO;
58835890

58845891
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)