فهرست منبع

local network: pull dow to refresh with background VLCDarkBackgroundColor

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Pierre SAGASPE 10 سال پیش
والد
کامیت
0527a941a2
2فایلهای تغییر یافته به همراه16 افزوده شده و 10 حذف شده
  1. 12 9
      Sources/VLCLocalPlexFolderListViewController.m
  2. 4 1
      Sources/VLCLocalServerListViewController.m

+ 12 - 9
Sources/VLCLocalPlexFolderListViewController.m

@@ -36,7 +36,7 @@
     NSMutableArray *_searchData;
     UISearchBar *_searchBar;
     UISearchDisplayController *_searchDisplayController;
-    UIRefreshControl *refreshControl;
+    UIRefreshControl *_refreshControl;
 }
 @end
 
@@ -109,10 +109,12 @@
     self.tableView.tableHeaderView = _searchBar;
 
     // Active le Pull down to refresh
-    refreshControl = [[UIRefreshControl alloc] init];
+    _refreshControl = [[UIRefreshControl alloc] init];
+    _refreshControl.backgroundColor = [UIColor VLCDarkBackgroundColor];
+    _refreshControl.tintColor = [UIColor whiteColor];
     // Call the refresh function
-    [refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
-    [self.tableView addSubview:refreshControl];
+    [_refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
+    [self.tableView addSubview:_refreshControl];
 
     _searchData = [[NSMutableArray alloc] init];
     [_searchData removeAllObjects];
@@ -385,14 +387,15 @@
 -(void)handleRefresh
 {
     //set the title while refreshing
-    refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Refresh"];
+    _refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:NSLocalizedString(@"LOCAL_SERVER_REFRESH",nil)];
     //set the date and time of refreshing
-    NSDateFormatter *formattedDate = [[NSDateFormatter alloc] init];
+    NSDateFormatter *formattedDate = [[NSDateFormatter alloc]init];
     [formattedDate setDateFormat:@"MMM d, h:mm a"];
-    NSString *lastupdated = [NSString stringWithFormat:@"Last Updated on %@", [formattedDate stringFromDate:[NSDate date]]];
-    refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastupdated];
+    NSString *lastupdated = [NSString stringWithFormat:NSLocalizedString(@"LOCAL_SERVER_LAST_UPDATE",nil),[formattedDate stringFromDate:[NSDate date]]];
+    NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
+    _refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastupdated attributes:attrsDictionary];
     //end the refreshing
-    [refreshControl endRefreshing];
+    [_refreshControl endRefreshing];
     [self performSelector:@selector(reloadTableViewPlex) withObject:nil];
 }
 

+ 4 - 1
Sources/VLCLocalServerListViewController.m

@@ -146,6 +146,8 @@
     _PlexNetServiceBrowser.delegate = self;
 
     _refreshControl = [[UIRefreshControl alloc] init];
+    _refreshControl.backgroundColor = [UIColor VLCDarkBackgroundColor];
+    _refreshControl.tintColor = [UIColor whiteColor];
     [_refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
     [self.tableView addSubview:_refreshControl];
 
@@ -390,7 +392,8 @@
     NSDateFormatter *formattedDate = [[NSDateFormatter alloc]init];
     [formattedDate setDateFormat:@"MMM d, h:mm a"];
     NSString *lastupdated = [NSString stringWithFormat:NSLocalizedString(@"LOCAL_SERVER_LAST_UPDATE",nil),[formattedDate stringFromDate:[NSDate date]]];
-    _refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:lastupdated];
+    NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
+    _refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastupdated attributes:attrsDictionary];
     //end the refreshing
     [_refreshControl endRefreshing];