Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: remoting/ios/app/host_collection_view_controller.mm

Issue 2921413002: [CRD iOS] Finish up the host list UI (Closed)
Patch Set: Added sources to the target. Hopefully it will fix the issue Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/ios/app/host_collection_header_view.mm ('k') | remoting/ios/app/remoting_view_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/app/host_collection_view_controller.mm
diff --git a/remoting/ios/app/host_collection_view_controller.mm b/remoting/ios/app/host_collection_view_controller.mm
index 0fabb038040dfca823b3d8bd09cbd1db9110f95b..72945970e7d85dd75db9bc7faf86a5aebd876b62 100644
--- a/remoting/ios/app/host_collection_view_controller.mm
+++ b/remoting/ios/app/host_collection_view_controller.mm
@@ -12,11 +12,13 @@
#import "ios/third_party/material_components_ios/src/components/NavigationBar/src/MaterialNavigationBar.h"
#import "ios/third_party/material_components_ios/src/components/ShadowElevations/src/MaterialShadowElevations.h"
#import "ios/third_party/material_components_ios/src/components/ShadowLayer/src/MaterialShadowLayer.h"
+#import "remoting/ios/app/host_collection_header_view.h"
static NSString* const kReusableIdentifierItem =
@"remotingHostCollectionViewControllerItem";
static CGFloat kHostCollectionViewControllerCellHeight = 70.f;
+static CGFloat kHostCollectionHeaderViewHeight = 25.f;
@implementation HostCollectionViewController
@@ -31,6 +33,10 @@ static CGFloat kHostCollectionViewControllerCellHeight = 70.f;
[self.collectionView registerClass:[HostCollectionViewCell class]
forCellWithReuseIdentifier:NSStringFromClass(
[HostCollectionViewCell class])];
+
+ [self.collectionView registerClass:[HostCollectionHeaderView class]
+ forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
+ withReuseIdentifier:UICollectionElementKindSectionHeader];
}
return self;
}
@@ -39,7 +45,7 @@ static CGFloat kHostCollectionViewControllerCellHeight = 70.f;
- (void)viewDidLoad {
[super viewDidLoad];
- self.styler.cellStyle = MDCCollectionViewCellStyleGrouped;
+ self.styler.cellStyle = MDCCollectionViewCellStyleDefault;
self.styler.cellLayoutType = MDCCollectionViewCellLayoutTypeList;
}
@@ -74,6 +80,19 @@ static CGFloat kHostCollectionViewControllerCellHeight = 70.f;
return cell;
}
+- (UICollectionReusableView*)collectionView:(UICollectionView*)collectionView
+ viewForSupplementaryElementOfKind:(NSString*)kind
+ atIndexPath:(NSIndexPath*)indexPath {
+ HostCollectionHeaderView* supplementaryView =
+ [collectionView dequeueReusableSupplementaryViewOfKind:kind
+ withReuseIdentifier:kind
+ forIndexPath:indexPath];
+ if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
+ supplementaryView.text = @"Remote devices";
+ }
+ return supplementaryView;
+}
+
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView*)collectionView
@@ -100,6 +119,16 @@ static CGFloat kHostCollectionViewControllerCellHeight = 70.f;
scrollViewDidScroll:scrollView];
}
+#pragma mark - UICollectionViewDelegateFlowLayout
+
+- (CGSize)collectionView:(UICollectionView*)collectionView
+ layout:
+ (UICollectionViewLayout*)collectionViewLayout
+ referenceSizeForHeaderInSection:(NSInteger)section {
+ return CGSizeMake(collectionView.bounds.size.width,
+ kHostCollectionHeaderViewHeight);
+}
+
#pragma mark - Private
- (void)setFlexHeaderContainerViewController:
« no previous file with comments | « remoting/ios/app/host_collection_header_view.mm ('k') | remoting/ios/app/remoting_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698