Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
91f0480
Added warnings to examples.
randallli Nov 13, 2017
1b8df1d
fixed some warnings
randallli Nov 13, 2017
49bcdb9
using button sender parameter.
randallli Nov 13, 2017
4a80e7c
use button sender in example
randallli Nov 13, 2017
8925260
use button sender in example
randallli Nov 13, 2017
c642e04
removed sender from methods that don’t use it.
randallli Nov 13, 2017
b934edc
removed sender from methods that don’t use it.
randallli Nov 13, 2017
5769ee2
use button sender in example
randallli Nov 13, 2017
ac1b54f
use button sender in example
randallli Nov 13, 2017
420e8d4
use button sender in example
randallli Nov 13, 2017
5411430
use button sender in example
randallli Nov 13, 2017
1e9c0d2
Fixed init of header configurator to use passed in parameter
randallli Nov 13, 2017
ba49eb8
removed unused API
randallli Nov 13, 2017
be7c247
use button sender in example
randallli Nov 13, 2017
ff1700f
Revert "Added warnings to examples."
randallli Nov 14, 2017
6677a3b
fixed example: Using the view controllers navigationItem rather than …
randallli Nov 14, 2017
a0da361
removed finished checks from animation blocks in examples.
randallli Nov 17, 2017
a8fd4f8
reverted id sender checks
randallli Nov 17, 2017
08c1900
revert id sender check for Flexible header UINavigationBar
randallli Nov 17, 2017
b87590d
revert clug
randallli Nov 17, 2017
94a8c38
revert clug
randallli Nov 17, 2017
ce5e314
addressing nits
randallli Nov 17, 2017
57296d6
removed sender check for FeatureHighlightTypicalUseView
randallli Nov 17, 2017
e6dda25
more nits
randallli Nov 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ - (void)viewWillAppear:(BOOL)animated {
@implementation BottomAppBarExampleTableViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nil bundle:nil];
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
NSArray<NSString *> *listItems = @[ @"Leading Floating Button",
@"Center Floating Button",
Expand Down Expand Up @@ -90,7 +90,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"cell"];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell =
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ - (void)viewDidLayoutSubviews {
CGFloat lastButtonMaxY = (CGRectGetHeight(lastButton.bounds) / 2) + lastButton.center.y;
if (lastButtonMaxY > CGRectGetHeight(self.view.bounds)) {
CGFloat columnOffset = CGRectGetWidth(self.view.bounds) / 4;
NSUInteger splitIndex = ceil(self.buttons.count / 2);
NSUInteger splitIndex = (NSUInteger)ceil(self.buttons.count / 2);

if (((MDCButton *)self.buttons[splitIndex - 1]).enabled) {
splitIndex++;
Expand Down Expand Up @@ -117,7 +117,7 @@ - (void)layoutButtonsInRange:(NSRange)range around:(CGFloat)centerX {
MDCButton *lastButton = self.buttons[NSMaxRange(range) - 1];
CGFloat verticalCenterY =
(viewHeight - (lastButton.center.y + (CGRectGetHeight(lastButton.bounds) / 2))) / 2;
for (NSInteger i = range.location; i < NSMaxRange(range); i++) {
for (NSUInteger i = range.location; i < NSMaxRange(range); i++) {
MDCButton *button = self.buttons[i];
UILabel *label = self.labels[i];
button.center = MDCRoundCenterWithBoundsAndScale(CGPointMake(button.center.x,
Expand Down
36 changes: 18 additions & 18 deletions components/Dialogs/examples/DialogsAlertViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
[super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
switch (indexPath.row) {
case 0:
[self didTapShowAlert:nil];
[self didTapShowAlert];
break;
case 1:
[self didTapShowLongAlert:nil];
[self didTapShowLongAlert];
break;
case 2:
[self didTapNondismissingAlert:nil];
[self didTapNondismissingAlert];
break;
case 3:
[self didTapDynamicAlert:nil];
[self didTapDynamicAlert];
break;
case 4:
[self didTapOverpopulatedAlert:nil];
[self didTapOverpopulatedAlert];
break;
}
}

- (IBAction)didTapShowAlert:(id)sender {
- (IBAction)didTapShowAlert {

NSString *titleString = @"Using Material alert controller?";
NSString *messageString = @"Be careful with modal alerts as they can be annoying if over-used.";
Expand All @@ -71,7 +71,7 @@ - (IBAction)didTapShowAlert:(id)sender {
[self presentViewController:materialAlertController animated:YES completion:NULL];
}

- (IBAction)didTapShowLongAlert:(id)sender {
- (IBAction)didTapShowLongAlert {
NSString *messageString =
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur "
"ultricies diam libero, eget porta arcu feugiat sit amet. Maecenas placerat felis sed risus "
Expand Down Expand Up @@ -114,16 +114,16 @@ - (IBAction)didTapShowLongAlert:(id)sender {
MDCAlertController *materialAlertController =
[MDCAlertController alertControllerWithTitle:nil message:messageString];

MDCAlertAction *action = [MDCAlertAction actionWithTitle:@"OK"
handler:^(MDCAlertAction *action) {
MDCAlertAction *okAction = [MDCAlertAction actionWithTitle:@"OK"
handler:^(MDCAlertAction *action) {
NSLog(@"%@", @"OK pressed");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more spaces

}];
[materialAlertController addAction:action];
[materialAlertController addAction:okAction];

[self presentViewController:materialAlertController animated:YES completion:NULL];
}

- (IBAction)didTapNondismissingAlert:(id)sender {
- (IBAction)didTapNondismissingAlert {
NSString *titleString = @"This alert requires an action.";
NSString *messageString = @"You can't dismiss it by tapping the background. You must choose "
"one of the actions available.";
Expand Down Expand Up @@ -151,7 +151,7 @@ - (IBAction)didTapNondismissingAlert:(id)sender {
[self presentViewController:materialAlertController animated:YES completion:NULL];
}

- (IBAction)didTapDynamicAlert:(id)sender {
- (IBAction)didTapDynamicAlert {
// The following strings are extra verbose to better demonstrate the dynamic handling of an alert.
NSString *titleString = @"This alert supports Dynamic Type font sizing.";
NSString *messageString =
Expand Down Expand Up @@ -185,7 +185,7 @@ - (IBAction)didTapDynamicAlert:(id)sender {
[self presentViewController:materialAlertController animated:YES completion:NULL];
}

- (IBAction)didTapOverpopulatedAlert:(id)sender {
- (IBAction)didTapOverpopulatedAlert {
NSString *messageString =
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur "
"ultricies diam libero, eget porta arcu feugiat sit amet. Maecenas placerat felis sed risus "
Expand Down Expand Up @@ -229,11 +229,11 @@ - (IBAction)didTapOverpopulatedAlert:(id)sender {
[MDCAlertController alertControllerWithTitle:nil message:messageString];
materialAlertController.mdc_adjustsFontForContentSizeCategory = YES;

MDCAlertAction *action = [MDCAlertAction actionWithTitle:@"OK"
handler:^(MDCAlertAction *action) {
NSLog(@"%@", @"OK pressed");
}];
[materialAlertController addAction:action];
MDCAlertAction *okAction = [MDCAlertAction actionWithTitle:@"OK"
handler:^(MDCAlertAction *action) {
NSLog(@"%@", @"OK pressed");
}];
[materialAlertController addAction:okAction];

MDCAlertAction *action2 = [MDCAlertAction actionWithTitle:@"OK - 2"
handler:^(MDCAlertAction *action) {
Expand Down
16 changes: 8 additions & 8 deletions components/Dialogs/examples/DialogsTypicalUseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ - (void)viewDidLoad {
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
if (indexPath.row == 0) {
[self didTapProgrammatic:nil];
[self didTapProgrammatic];
} else if (indexPath.row == 1) {
[self didTapStoryboard:nil];
[self didTapStoryboard];
} else if (indexPath.row == 2) {
[self didTapModalProgrammatic:nil];
[self didTapModalProgrammatic];
} else if (indexPath.row == 3) {
[self didTapOpenURL:nil];
[self didTapOpenURL];
}
}

- (IBAction)didTapProgrammatic:(id)sender {
- (IBAction)didTapProgrammatic {
UIViewController *viewController =
[[ProgrammaticViewController alloc] initWithNibName:nil bundle:nil];
viewController.modalPresentationStyle = UIModalPresentationCustom;
Expand All @@ -57,7 +57,7 @@ - (IBAction)didTapProgrammatic:(id)sender {
[self presentViewController:viewController animated:YES completion:NULL];
}

- (IBAction)didTapModalProgrammatic:(id)sender {
- (IBAction)didTapModalProgrammatic {
UIViewController *viewController =
[[ProgrammaticViewController alloc] initWithNibName:nil bundle:nil];
viewController.modalPresentationStyle = UIModalPresentationCustom;
Expand All @@ -72,7 +72,7 @@ - (IBAction)didTapModalProgrammatic:(id)sender {
}
}

- (IBAction)didTapOpenURL:(id)sender {
- (IBAction)didTapOpenURL {
UIViewController *viewController =
[[OpenURLViewController alloc] initWithNibName:nil bundle:nil];
viewController.modalPresentationStyle = UIModalPresentationCustom;
Expand All @@ -81,7 +81,7 @@ - (IBAction)didTapOpenURL:(id)sender {
[self presentViewController:viewController animated:YES completion:NULL];
}

- (IBAction)didTapStoryboard:(id)sender {
- (IBAction)didTapStoryboard {
// If you are using this code outside of the MDCCatalog in your own app, your bundle may be nil.
NSBundle *bundle = [NSBundle bundleForClass:[DialogsTypicalUseViewController class]];
UIStoryboard *storyboard =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ - (void)viewWillTransitionToSize:(CGSize)size
#pragma mark -

- (void)didTap:(id)sender {
NSLog(@"Button was tapped.");
NSLog(@"Button was tapped. %@", sender);
}

#pragma mark - <UIScrollViewDelegate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ - (void)viewDidLoad {
NSMutableArray *pages = [NSMutableArray array];

// Add pages to scrollView.
for (NSInteger i = 0; i < pageColors.count; i++) {
for (NSUInteger i = 0; i < pageColors.count; i++) {
CGRect pageFrame = CGRectOffset(pageScrollViewFrame, i * boundsWidth, 0);
UILabel *page = [[UILabel alloc] initWithFrame:pageFrame];
page.text = [NSString stringWithFormat:@"Page %zd", i + 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ - (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
}

#pragma - MDCFlexibleHeaderViewLayoutDelegate
#pragma mark - MDCFlexibleHeaderViewLayoutDelegate

- (void)flexibleHeaderViewController:(MDCFlexibleHeaderViewController *)flexibleHeaderViewController
flexibleHeaderViewFrameDidChange:(MDCFlexibleHeaderView *)flexibleHeaderView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ - (void)commonMDCFlexibleHeaderViewControllerInit {
target:self
action:@selector(doneAction:)];

UINavigationItem *navItem = [[UINavigationItem alloc] initWithTitle:@"UINavigationBar"];
[navItem setLeftBarButtonItem:backItem animated:YES];
[navItem setRightBarButtonItem:doneItem animated:YES];
[navBar setItems:[NSArray arrayWithObject:navItem] animated:YES];

[self.navigationItem setLeftBarButtonItem:backItem animated:YES];
[self.navigationItem setRightBarButtonItem:doneItem animated:YES];
[navBar setItems:@[self.navigationItem] animated:YES];

self.button = [[UIButton alloc] init];
[self.button setTitle:@"UIButton" forState:UIControlStateNormal];
Expand All @@ -98,7 +98,7 @@ - (void)commonMDCFlexibleHeaderViewControllerInit {
}

- (void)didTapButton:(id)sender {
NSLog(@"Button Tapped");
NSLog(@"Button Tapped: %@", sender);
}

- (void)doneAction:(id)sender {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (instancetype)init {
}

- (instancetype)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:kStyle];
self = [super initWithStyle:style];
if (self) {
self.fhvc = [[MDCFlexibleHeaderViewController alloc] initWithNibName:nil bundle:nil];
[self addChildViewController:self.fhvc];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ - (BOOL)catalogShouldHideNavigation {

@implementation FlexibleHeaderUINavigationBarExample (Supplemental)

- (void)didTap:(id)button {
NSLog(@"Button Tapped.");
}

- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ - (void)viewDidLoad {
NSMutableArray *pages = [NSMutableArray array];

// Add pages to scrollView.
for (NSInteger i = 0; i < pageColors.count; i++) {
for (NSUInteger i = 0; i < pageColors.count; i++) {
CGRect pageFrame = CGRectOffset(self.view.bounds, i * boundsWidth, 0);
UILabel *page = [[UILabel alloc] initWithFrame:pageFrame];
page.text = [NSString stringWithFormat:@"Page %zd", i + 1];
Expand Down
2 changes: 1 addition & 1 deletion components/PageControl/examples/PageControlButtonExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (void)viewDidLoad {
NSMutableArray *pages = [NSMutableArray array];

// Add pages to scrollView.
for (NSInteger i = 0; i < pageColors.count; i++) {
for (NSUInteger i = 0; i < pageColors.count; i++) {
CGRect pageFrame = CGRectOffset(self.view.bounds, i * boundsWidth, 0);
UILabel *page = [[UILabel alloc] initWithFrame:pageFrame];
page.text = [NSString stringWithFormat:@"Page %zd", i + 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)viewDidLoad {
NSMutableArray *pages = [NSMutableArray array];

// Add pages to scrollView.
for (NSInteger i = 0; i < pageColors.count; i++) {
for (NSUInteger i = 0; i < pageColors.count; i++) {
CGRect pageFrame = CGRectOffset(self.view.bounds, i * boundsWidth, 0);
UILabel *page = [[UILabel alloc] initWithFrame:pageFrame];
page.text = [NSString stringWithFormat:@"Page %zd", i + 1];
Expand Down
4 changes: 2 additions & 2 deletions components/ProgressView/examples/ProgressViewExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ - (void)setupProgressViews {
_backwardProgressResetView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_backwardProgressResetView];
// Have a non-zero progress at setup time.
_backwardProgressResetView.progress = 0.33;
_backwardProgressResetView.progress = 0.33f;

_backwardProgressAnimateView = [[MDCProgressView alloc] init];
_backwardProgressAnimateView.translatesAutoresizingMaskIntoConstraints = NO;
_backwardProgressAnimateView.backwardProgressAnimationMode =
MDCProgressViewBackwardAnimationModeAnimate;
[self.view addSubview:_backwardProgressAnimateView];
// Have a non-zero progress at setup time.
_backwardProgressAnimateView.progress = 0.33;
_backwardProgressAnimateView.progress = 0.33f;
}

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ - (void)setElevation:(MDCShadowElevation)elevation {
[(MDCShadowLayer *)self.layer setElevation:elevation];
}

- (MDCShadowElevation)elevation {
return [(MDCShadowLayer *)self.layer elevation];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (void)viewDidLoad {
- (IBAction)materialSliderDidChange:(id)sender {
NSLog(@"Material Slider : %.2f", self.materialSlider.value);

self.vanillaSlider.value = self.materialSlider.value;
self.vanillaSlider.value = (float)self.materialSlider.value;
}

- (IBAction)vanillaSliderDidChange:(id)sender {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

@interface TabBarIconExample : UIViewController <MDCTabBarDelegate>

@property MDCTabBar *_Nullable tabBar;
@property MDCRaisedButton *_Nullable alignmentButton;
@property MDCAppBar *_Nullable appBar;
@property UIScrollView *_Nullable scrollView;
@property UIView *_Nullable starPage;
@property(nonatomic, nullable) MDCTabBar * tabBar;
@property(nonatomic, nullable) MDCRaisedButton * alignmentButton;
@property(nonatomic, nullable) MDCAppBar * appBar;
@property(nonatomic, nullable) UIScrollView * scrollView;
@property(nonatomic, nullable) UIView * starPage;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

@interface TabBarTextOnlyExample : MDCCollectionViewController

@property(nullable) MDCAppBar *appBar;
@property(nullable) MDCTabBar *tabBar;
@property(nullable) NSArray *choices;
@property(nonatomic, nullable) MDCAppBar *appBar;
@property(nonatomic, nullable) MDCTabBar *tabBar;
@property(nonatomic, nullable) NSArray *choices;
@end

@interface TabBarTextOnlyExample (Supplemental)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ - (void)viewDidLoad {
];

_opacities = @[
[NSNumber numberWithFloat:[MDCTypography headlineFontOpacity]],
[NSNumber numberWithFloat:[MDCTypography titleFontOpacity]],
[NSNumber numberWithFloat:[MDCTypography subheadFontOpacity]],
[NSNumber numberWithFloat:[MDCTypography body2FontOpacity]],
[NSNumber numberWithFloat:[MDCTypography body1FontOpacity]],
[NSNumber numberWithFloat:[MDCTypography captionFontOpacity]],
[NSNumber numberWithFloat:[MDCTypography buttonFontOpacity]],
[NSNumber numberWithFloat:[MDCTypography display1FontOpacity]],
[NSNumber numberWithFloat:[MDCTypography display2FontOpacity]],
[NSNumber numberWithFloat:[MDCTypography display3FontOpacity]],
[NSNumber numberWithFloat:[MDCTypography display4FontOpacity]]
@([MDCTypography headlineFontOpacity]),
@([MDCTypography titleFontOpacity]),
@([MDCTypography subheadFontOpacity]),
@([MDCTypography body2FontOpacity]),
@([MDCTypography body1FontOpacity]),
@([MDCTypography captionFontOpacity]),
@([MDCTypography buttonFontOpacity]),
@([MDCTypography display1FontOpacity]),
@([MDCTypography display2FontOpacity]),
@([MDCTypography display3FontOpacity]),
@([MDCTypography display4FontOpacity])
];

[[NSNotificationCenter defaultCenter] addObserver:self
Expand Down