Skip to content

Commit 2385686

Browse files
committed
Frosted glass navbar on iPhone
1 parent 1b64899 commit 2385686

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;
@@ -5462,7 +5464,7 @@ - (void)buildButtons:(int)activeTab {
54625464
// no button, no toolbar
54635465
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
54645466
frame = dataList.frame;
5465-
frame.size.height = self.view.bounds.size.height;
5467+
frame.size.height = maskView.bounds.size.height;
54665468
dataList.frame = frame;
54675469
break;
54685470
case 1:
@@ -5811,7 +5813,7 @@ - (void)viewDidLoad {
58115813
[self initSearchController];
58125814
self.navigationController.view.backgroundColor = UIColor.blackColor;
58135815
self.definesPresentationContext = NO;
5814-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5816+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58155817
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58165818

58175819
if (@available(iOS 15.0, *)) {
@@ -5822,11 +5824,16 @@ - (void)viewDidLoad {
58225824

58235825
[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
58245826
self.edgesForExtendedLayout = UIRectEdgeNone;
5827+
UIEdgeInsets viewInsets = dataList.contentInset;
5828+
viewInsets.top = [self getTableInsetTop];
5829+
dataList.contentInset = viewInsets;
58255830
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;
58265831

5827-
CGRect frame = dataList.frame;
5828-
frame.size.height = self.view.bounds.size.height;
5829-
dataList.frame = frame;
5832+
CGRect frame = maskView.frame;
5833+
frame.origin.y -= [self getTableInsetTop];
5834+
frame.size.height += [self getTableInsetTop];
5835+
maskView.frame = frame;
5836+
58305837
buttonsViewBgToolbar.hidden = NO;
58315838

58325839
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)