Skip to content

Commit 7b4f2cc

Browse files
committed
Frosted glass navbar on iPhone
1 parent fa70f5f commit 7b4f2cc

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
@@ -1112,11 +1112,9 @@ - (void)showMore {
11121112
if (moreItemsViewController == nil) {
11131113
moreItemsViewController = [[MoreItemsViewController alloc] initWithFrame:CGRectMake(dataList.bounds.size.width, 0, dataList.bounds.size.width, dataList.bounds.size.height) mainMenu:moreMenu];
11141114
moreItemsViewController.view.backgroundColor = UIColor.clearColor;
1115-
UIEdgeInsets tableViewInsets = UIEdgeInsetsZero;
1116-
tableViewInsets.bottom = buttonsViewBgToolbar.frame.size.height;
1117-
moreItemsViewController.tableView.contentInset = tableViewInsets;
1118-
moreItemsViewController.tableView.scrollIndicatorInsets = tableViewInsets;
1119-
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, - tableViewInsets.top) animated:NO];
1115+
moreItemsViewController.tableView.contentInset = activeLayoutView.contentInset;
1116+
[self setViewInset:moreItemsViewController.tableView bottom:buttonsViewBgToolbar.frame.size.height];
1117+
[moreItemsViewController.tableView setContentOffset:CGPointMake(0, -moreItemsViewController.tableView.contentInset.top) animated:NO];
11201118
[maskView insertSubview:moreItemsViewController.view aboveSubview:dataList];
11211119
}
11221120

@@ -1962,13 +1960,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19621960
}
19631961
else if (sender.currentIndex == 0) {
19641962
if (enableCollectionView) {
1965-
[collectionView setContentOffset:CGPointZero animated:NO];
1963+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19661964
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19671965
[self initSectionNameOverlayView];
19681966
}
19691967
}
19701968
else {
1971-
[dataList setContentOffset:CGPointZero animated:NO];
1969+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19721970
}
19731971
sectionNameLabel.text = @"🔍";
19741972
return;
@@ -2009,7 +2007,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
20092007
if (index != NSNotFound) {
20102008
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
20112009
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
2012-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
2010+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
20132011
}
20142012
return;
20152013
}
@@ -2172,6 +2170,10 @@ - (void)choseParams {
21722170

21732171
#pragma mark - Table Management
21742172

2173+
- (CGFloat)getTableInsetTop {
2174+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2175+
}
2176+
21752177
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21762178
if (isDark) {
21772179
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5502,7 +5504,7 @@ - (void)buildButtons:(int)activeTab {
55025504
// no button, no toolbar
55035505
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
55045506
frame = dataList.frame;
5505-
frame.size.height = self.view.bounds.size.height;
5507+
frame.size.height = maskView.bounds.size.height;
55065508
dataList.frame = frame;
55075509
break;
55085510
case 1:
@@ -5851,7 +5853,7 @@ - (void)viewDidLoad {
58515853
[self initSearchController];
58525854
self.navigationController.view.backgroundColor = UIColor.blackColor;
58535855
self.definesPresentationContext = NO;
5854-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5856+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58555857
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58565858

58575859
if (@available(iOS 15.0, *)) {
@@ -5862,11 +5864,16 @@ - (void)viewDidLoad {
58625864

58635865
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58645866
self.edgesForExtendedLayout = UIRectEdgeNone;
5867+
UIEdgeInsets viewInsets = dataList.contentInset;
5868+
viewInsets.top = [self getTableInsetTop];
5869+
dataList.contentInset = viewInsets;
58655870
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58665871

5867-
CGRect frame = dataList.frame;
5868-
frame.size.height = self.view.bounds.size.height;
5869-
dataList.frame = frame;
5872+
CGRect frame = maskView.frame;
5873+
frame.origin.y -= [self getTableInsetTop];
5874+
frame.size.height += [self getTableInsetTop];
5875+
maskView.frame = frame;
5876+
58705877
buttonsViewBgToolbar.hidden = NO;
58715878

58725879
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)