Commit 617ffbc0 authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

[iOS][DarkMode] Support dark mode in collection view controller

MDCCollectionView uses a white background by default. This overrides
the default color with one that supports dark mode.

Bug: 976675
Change-Id: I3b2f6688698c90f29093cb17dbc9d30e9e3a45ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1741913Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Auto-Submit: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685513}
parent f655093d
...@@ -14,6 +14,7 @@ source_set("collection_view") { ...@@ -14,6 +14,7 @@ source_set("collection_view") {
"//base", "//base",
"//ios/chrome/browser/ui/list_model", "//ios/chrome/browser/ui/list_model",
"//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/material_components",
"//ios/chrome/common/colors",
] ]
public_deps = [ public_deps = [
"//ios/chrome/browser/ui/collection_view/cells", "//ios/chrome/browser/ui/collection_view/cells",
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h" #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/material_components/chrome_app_bar_view_controller.h" #import "ios/chrome/browser/ui/material_components/chrome_app_bar_view_controller.h"
#import "ios/chrome/browser/ui/material_components/utils.h" #import "ios/chrome/browser/ui/material_components/utils.h"
#import "ios/chrome/common/colors/UIColor+cr_semantic_colors.h"
#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h" #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -61,6 +62,9 @@ ...@@ -61,6 +62,9 @@
name:UIContentSizeCategoryDidChangeNotification name:UIContentSizeCategoryDidChangeNotification
object:nil]; object:nil];
} }
// Suport dark mode.
self.collectionView.backgroundColor = UIColor.cr_systemGroupedBackgroundColor;
} }
- (void)contentSizeCategoryDidChange:(id)sender { - (void)contentSizeCategoryDidChange:(id)sender {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment