Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/settings/translate_collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/translate_collection_view_controller.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 _translationItem.get().text = | 100 _translationItem.get().text = |
| 101 l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING); | 101 l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING); |
| 102 _translationItem.get().on = [_translationEnabled value]; | 102 _translationItem.get().on = [_translationEnabled value]; |
| 103 [model addItem:_translationItem | 103 [model addItem:_translationItem |
| 104 toSectionWithIdentifier:SectionIdentifierTranslate]; | 104 toSectionWithIdentifier:SectionIdentifierTranslate]; |
| 105 | 105 |
| 106 CollectionViewTextItem* resetTranslate = [[[CollectionViewTextItem alloc] | 106 CollectionViewTextItem* resetTranslate = [[[CollectionViewTextItem alloc] |
| 107 initWithType:ItemTypeResetTranslate] autorelease]; | 107 initWithType:ItemTypeResetTranslate] autorelease]; |
| 108 resetTranslate.text = l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_RESET); | 108 resetTranslate.text = l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_RESET); |
| 109 resetTranslate.accessibilityTraits |= UIAccessibilityTraitButton; | 109 resetTranslate.accessibilityTraits |= UIAccessibilityTraitButton; |
| 110 resetTranslate.textFont = | |
| 111 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
|
lpromero
2017/03/24 09:28:24
Idem for Roboto→Typography.
gambard
2017/03/24 09:49:03
Done.
| |
| 110 [model addItem:resetTranslate | 112 [model addItem:resetTranslate |
| 111 toSectionWithIdentifier:SectionIdentifierTranslate]; | 113 toSectionWithIdentifier:SectionIdentifierTranslate]; |
| 112 | 114 |
| 113 // Footer Section | 115 // Footer Section |
| 114 [model addSectionWithIdentifier:SectionIdentifierFooter]; | 116 [model addSectionWithIdentifier:SectionIdentifierFooter]; |
| 115 CollectionViewFooterItem* footer = [[[CollectionViewFooterItem alloc] | 117 CollectionViewFooterItem* footer = [[[CollectionViewFooterItem alloc] |
| 116 initWithType:ItemTypeFooter] autorelease]; | 118 initWithType:ItemTypeFooter] autorelease]; |
| 117 footer.text = l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_DESCRIPTION); | 119 footer.text = l10n_util::GetNSString(IDS_IOS_TRANSLATE_SETTING_DESCRIPTION); |
| 118 footer.linkURL = google_util::AppendGoogleLocaleParam( | 120 footer.linkURL = google_util::AppendGoogleLocaleParam( |
| 119 GURL(kTranslateLearnMoreUrl), | 121 GURL(kTranslateLearnMoreUrl), |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 133 | 135 |
| 134 switch (itemType) { | 136 switch (itemType) { |
| 135 case ItemTypeTranslate: { | 137 case ItemTypeTranslate: { |
| 136 CollectionViewSwitchCell* switchCell = | 138 CollectionViewSwitchCell* switchCell = |
| 137 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); | 139 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); |
| 138 [switchCell.switchView addTarget:self | 140 [switchCell.switchView addTarget:self |
| 139 action:@selector(translateToggled:) | 141 action:@selector(translateToggled:) |
| 140 forControlEvents:UIControlEventValueChanged]; | 142 forControlEvents:UIControlEventValueChanged]; |
| 141 break; | 143 break; |
| 142 } | 144 } |
| 143 case ItemTypeResetTranslate: { | |
| 144 MDCCollectionViewTextCell* textCell = | |
| 145 base::mac::ObjCCastStrict<MDCCollectionViewTextCell>(cell); | |
| 146 textCell.textLabel.font = | |
| 147 [[MDFRobotoFontLoader sharedInstance] mediumFontOfSize:14]; | |
| 148 break; | |
| 149 } | |
| 150 default: | 145 default: |
| 151 break; | 146 break; |
| 152 } | 147 } |
| 153 | 148 |
| 154 return cell; | 149 return cell; |
| 155 } | 150 } |
| 156 | 151 |
| 157 #pragma mark UICollectionViewDelegate | 152 #pragma mark UICollectionViewDelegate |
| 158 - (void)collectionView:(UICollectionView*)collectionView | 153 - (void)collectionView:(UICollectionView*)collectionView |
| 159 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { | 154 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 base::mac::ObjCCastStrict<CollectionViewSwitchCell>( | 248 base::mac::ObjCCastStrict<CollectionViewSwitchCell>( |
| 254 [self.collectionView cellForItemAtIndexPath:switchPath]); | 249 [self.collectionView cellForItemAtIndexPath:switchPath]); |
| 255 | 250 |
| 256 DCHECK_EQ(switchCell.switchView, sender); | 251 DCHECK_EQ(switchCell.switchView, sender); |
| 257 BOOL isOn = switchCell.switchView.isOn; | 252 BOOL isOn = switchCell.switchView.isOn; |
| 258 switchItem.on = isOn; | 253 switchItem.on = isOn; |
| 259 [_translationEnabled setValue:isOn]; | 254 [_translationEnabled setValue:isOn]; |
| 260 } | 255 } |
| 261 | 256 |
| 262 @end | 257 @end |
| OLD | NEW |