瀏覽代碼

Generalize 'Play All' button creation

(cherry picked from commit e9044f4186285a51198ff203e9e2c0c645c01a6c)
Felix Paul Kühne 9 年之前
父節點
當前提交
1636383043

+ 1 - 4
Sources/LocalNetworkConnectivity/VLCNetworkListViewController.m

@@ -77,11 +77,8 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
     _tapTwiceGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self  action:@selector(tapTwiceGestureAction:)];
     [_tapTwiceGestureRecognizer setNumberOfTapsRequired:2];
 
-    UIBarButtonItem *playAllButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(playAllAction:)];
-    playAllButton.accessibilityLabel = NSLocalizedString(@"PLAY_ALL_BUTTON", nil);
-    playAllButton.isAccessibilityElement = YES;
     self.navigationItem.rightBarButtonItems = @[[UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(menuButtonAction:)],
-                                                playAllButton];
+                                                [UIBarButtonItem themedPlayAllButtonWithTarget:self andSelector:@selector(playAllAction:)]];
 
     _searchData = [[NSMutableArray alloc] init];
     [_searchData removeAllObjects];

+ 2 - 1
Sources/UIBarButtonItem+Theme.h

@@ -13,4 +13,5 @@
 + (UIBarButtonItem *)themedBackButtonWithTarget:(id)target andSelector:(SEL)selector;
 + (UIBarButtonItem *)themedRevealMenuButtonWithTarget:(id)target andSelector:(SEL)selector;
 + (UIBarButtonItem *)themedDarkToolbarButtonWithTitle: (NSString*) title target:(id)target andSelector:(SEL)selector;
-@end
++ (UIBarButtonItem *)themedPlayAllButtonWithTarget:(id)target andSelector:(SEL)selector;
+@end

+ 11 - 1
Sources/UIBarButtonItem+Theme.m

@@ -57,4 +57,14 @@
 
     return button;
 }
-@end
+
++ (UIBarButtonItem *)themedPlayAllButtonWithTarget:(id)target andSelector:(SEL)selector
+{
+    UIBarButtonItem *playAllButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:target action:selector];
+    playAllButton.accessibilityLabel = NSLocalizedString(@"PLAY_ALL_BUTTON", nil);
+    playAllButton.isAccessibilityElement = YES;
+
+    return playAllButton;
+}
+
+@end