Skip to content

Commit 83b21d9

Browse files
committed
Frosted glass navbar on iPhone
1 parent ae5e02d commit 83b21d9

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

@@ -1907,13 +1905,13 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19071905
}
19081906
else if (sender.currentIndex == 0) {
19091907
if (enableCollectionView) {
1910-
[collectionView setContentOffset:CGPointZero animated:NO];
1908+
[collectionView setContentOffset:CGPointMake(0, -collectionView.contentInset.top) animated:NO];
19111909
if (sectionNameOverlayView == nil && stackscrollFullscreen) {
19121910
[self initSectionNameOverlayView];
19131911
}
19141912
}
19151913
else {
1916-
[dataList setContentOffset:CGPointZero animated:NO];
1914+
[dataList setContentOffset:CGPointMake(0, -dataList.contentInset.top) animated:NO];
19171915
}
19181916
sectionNameLabel.text = @"🔍";
19191917
return;
@@ -1954,7 +1952,7 @@ - (void)indexViewValueChanged:(BDKCollectionIndexView*)sender {
19541952
if (index != NSNotFound) {
19551953
NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:0];
19561954
[collectionView scrollToItemAtIndexPath:path atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
1957-
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT);
1955+
collectionView.contentOffset = CGPointMake(collectionView.contentOffset.x, collectionView.contentOffset.y - GRID_SECTION_HEADER_HEIGHT + [Utilities getTopPadding]);
19581956
}
19591957
return;
19601958
}
@@ -2117,6 +2115,10 @@ - (void)setCellLayoutParameters {
21172115

21182116
#pragma mark - Table Management
21192117

2118+
- (CGFloat)getTableInsetTop {
2119+
return IS_IPHONE ? [Utilities getTopPaddingWithNavBar:self.navigationController] : 0;
2120+
}
2121+
21202122
- (void)setSearchBar:(UISearchBar*)searchBar toDark:(BOOL)isDark {
21212123
if (isDark) {
21222124
searchBar.backgroundColor = SYSTEMGRAY6_DARKMODE;
@@ -5461,7 +5463,7 @@ - (void)buildButtons:(int)activeTab {
54615463
// no button, no toolbar
54625464
button1.hidden = button2.hidden = button3.hidden = button4.hidden = button5.hidden = YES;
54635465
frame = dataList.frame;
5464-
frame.size.height = self.view.bounds.size.height;
5466+
frame.size.height = maskView.bounds.size.height;
54655467
dataList.frame = frame;
54665468
break;
54675469
case 1:
@@ -5810,7 +5812,7 @@ - (void)viewDidLoad {
58105812
[self initSearchController];
58115813
self.navigationController.view.backgroundColor = UIColor.blackColor;
58125814
self.definesPresentationContext = NO;
5813-
iOSYDelta = self.searchController.searchBar.frame.size.height;
5815+
iOSYDelta = self.searchController.searchBar.frame.size.height - [self getTableInsetTop];
58145816
dataList.tableHeaderView = [self createFakeSearchbarInDark:NO];
58155817

58165818
if (@available(iOS 15.0, *)) {
@@ -5821,11 +5823,16 @@ - (void)viewDidLoad {
58215823

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

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

58315838
__weak DetailViewController *weakSelf = self;

0 commit comments

Comments
 (0)