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

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm

Issue 2623853002: Remove the scroll if the Reading List is empty. (Closed)
Patch Set: Address comments Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm
index de07e31b2df7fc4a9e925ef2232165e178884042..07473acb23fbead6c96f3f3af06b9874517f93d2 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_view_controller.mm
@@ -124,6 +124,8 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
// Returns whether there are elements in the section identified by
// |sectionIdentifier|.
- (BOOL)hasItemInSection:(SectionIdentifier)sectionIdentifier;
+// Adds an empty background if needed.
+- (void)collectionIsEmpty;
// Updates the toolbar state according to the selected items.
- (void)updateToolbarState;
// Displays an action sheet to let the user choose to mark all the elements as
@@ -486,10 +488,9 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
[super loadModel];
if (self.readingListModel->size() == 0) {
- // The collection is empty, add background.
- self.collectionView.backgroundView = _emptyCollectionBackground;
- [self.audience setCollectionHasItems:NO];
+ [self collectionIsEmpty];
} else {
+ self.collectionView.alwaysBounceVertical = YES;
[self loadItems];
self.collectionView.backgroundView = nil;
[self.audience setCollectionHasItems:YES];
@@ -622,6 +623,16 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
return numberOfItems > 0;
}
+- (void)collectionIsEmpty {
+ if (self.collectionView.backgroundView) {
+ return;
+ }
+ // The collection is empty, add background.
+ self.collectionView.alwaysBounceVertical = NO;
+ self.collectionView.backgroundView = _emptyCollectionBackground;
+ [self.audience setCollectionHasItems:NO];
+}
+
#pragma mark - ReadingListToolbarDelegate
- (void)markPressed {
@@ -1083,6 +1094,9 @@ using ItemsMapByDate = std::multimap<int64_t, ReadingListCollectionViewItem*>;
}
}
completion:nil];
+ if (_readingListModel->size() == 0) {
+ [self collectionIsEmpty];
+ }
}
- (void)exitEditingModeAnimated:(BOOL)animated {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698