OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_NATIVE_APP_ITEM_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_NATIVE_APP_ITEM_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 11 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 12 |
| 13 @class MDCButton; |
| 14 |
| 15 typedef NS_ENUM(NSInteger, NativeAppItemState) { |
| 16 NativeAppItemSwitchOff, |
| 17 NativeAppItemSwitchOn, |
| 18 NativeAppItemInstall, |
| 19 }; |
| 20 |
| 21 // Item to display and interact with a Native App. |
| 22 @interface NativeAppItem : CollectionViewItem |
| 23 |
| 24 // The display name of the app. |
| 25 @property(nonatomic, copy) NSString* name; |
| 26 |
| 27 // The icon of the app. |
| 28 @property(nonatomic, strong) UIImage* icon; |
| 29 |
| 30 // The state of the item: |
| 31 // - NativeAppItemSwitchOff: displays a switch set to OFF; |
| 32 // - NativeAppItemSwitchOn: displays a switch set to ON; |
| 33 // - NativeAppItemInstall: displays an INSTALL button; |
| 34 @property(nonatomic, assign) NativeAppItemState state; |
| 35 |
| 36 @end |
| 37 |
| 38 // Cell class associated to NativeAppItem. |
| 39 @interface NativeAppCell : MDCCollectionViewCell |
| 40 |
| 41 // Label for the app name. |
| 42 @property(nonatomic, strong, readonly) UILabel* nameLabel; |
| 43 |
| 44 // Image view for the app icon. |
| 45 @property(nonatomic, strong, readonly) UIImageView* iconImageView; |
| 46 |
| 47 // Accessory controls. switchControl is available after calling |
| 48 // -updateWithState: with NativeAppItemSwitch{On|Off}, while installButton is |
| 49 // available after calling -updateWithState: with NativeAppItemInstall. |
| 50 @property(nonatomic, strong, readonly) UISwitch* switchControl; |
| 51 @property(nonatomic, strong, readonly) MDCButton* installButton; |
| 52 |
| 53 // Updates the accessory view according to the given |state|. |
| 54 - (void)updateWithState:(NativeAppItemState)state; |
| 55 |
| 56 @end |
| 57 |
| 58 #endif // IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_NATIVE_APP_ITEM_H_ |
OLD | NEW |