Skip to content

Commit 9cbd176

Browse files
committed
Frosted glass navbar on iPhone
1 parent 053fded commit 9cbd176

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
@@ -113,12 +113,14 @@ - (void)registerDefaultsFromSettingsBundle {
113113
}
114114

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

XBMC Remote/DetailViewController.m

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

@@ -1968,13 +1966,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19681966
}
19691967
else if (sender.currentIndex == 0) {
19701968
if (enableCollectionView) {
1971-
[collectionView setContentOffset:CGPointZero animated:NO];
1969+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19721970
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19731971
[self initSectionNameOverlayView];
19741972
}
19751973
}
19761974
else {
1977-
[dataList setContentOffset:CGPointZero animated:NO];
1975+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19781976
}
19791977
sectionNameLabel.text = @"🔍";
19801978
return;
@@ -2015,7 +2013,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
20152013
if (index != NSNotFound) {
20162014
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
20172015
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
2018-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
2016+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
20192017
}
20202018
return;
20212019
}
@@ -2178,6 +2176,10 @@ - (void)choseParams {
21782176

21792177
#pragma mark - Table Management
21802178

2179+
- (CGFloat)getTableInsetTop {
2180+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2181+
}
2182+
21812183
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21822184
if (isDark) {
21832185
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5512,7 +5514,7 @@ - (void)buildButtons:(int)activeTab {
55125514
// no button, no toolbar
55135515
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
55145516
frame = dataList.frame;
5515-
frame.size.height = self.view.bounds.size.height;
5517+
frame.size.height = maskView.bounds.size.height;
55165518
dataList.frame = frame;
55175519
break;
55185520
case 1:
@@ -5861,7 +5863,7 @@ - (void)viewDidLoad {
58615863
[self initSearchController];
58625864
self.navigationController.view.backgroundColor = UIColor.blackColor;
58635865
self.definesPresentationContext = NO;
5864-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5866+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58655867
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58665868

58675869
if (@available(iOS 15.0, *)) {
@@ -5872,11 +5874,16 @@ - (void)viewDidLoad {
58725874

58735875
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58745876
self.edgesForExtendedLayout = UIRectEdgeNone;
5877+
UIEdgeInsets viewInsets = dataList.contentInset;
5878+
viewInsets.top = [self getTableInsetTop];
5879+
dataList.contentInset = viewInsets;
58755880
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58765881

5877-
CGRect frame = dataList.frame;
5878-
frame.size.height = self.view.bounds.size.height;
5879-
dataList.frame = frame;
5882+
CGRect frame = maskView.frame;
5883+
frame.origin.y -= [self getTableInsetTop];
5884+
frame.size.height += [self getTableInsetTop];
5885+
maskView.frame = frame;
5886+
58805887
buttonsViewBgToolbar.hidden = NO;
58815888

58825889
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)