Add toolbar in Rom's list to accommodate refresh and new folder buttons.

This commit is contained in:
Marcelo Munhoz Pélos 2013-07-13 00:05:21 -03:00
parent acfa16089e
commit edc710d124
2 changed files with 19 additions and 5 deletions

View File

@ -212,7 +212,7 @@ int main(int argc, char *argv[])
{
UIWindow* _window;
bool _isGameTop;
bool _isGameTop, _isRomList;
uint32_t _settingMenusInBackStack;
uint32_t _enabledOrientations;
@ -272,11 +272,13 @@ int main(int argc, char *argv[])
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
_isGameTop = [viewController isKindOfClass:[RAGameView class]];
_isRomList = [viewController isKindOfClass:[RADirectoryList class]];
[[UIApplication sharedApplication] setStatusBarHidden:_isGameTop withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setIdleTimerDisabled:_isGameTop];
self.navigationBarHidden = _isGameTop;
[self setToolbarHidden:!_isRomList animated:YES];
self.topViewController.navigationItem.rightBarButtonItem = [self createSettingsButton];
}

View File

@ -35,11 +35,7 @@
{
NSString* rootPath = RetroArch_iOS.get.documentsDirectory;
NSString* ragPath = [rootPath stringByAppendingPathComponent:@"RetroArchGames"];
RADirectoryList* list = [RADirectoryList directoryListForPath:path_is_directory(ragPath.UTF8String) ? ragPath : rootPath];
list.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:list action:@selector(createNewFolder)];
return list;
}
@ -57,6 +53,22 @@
self = [super initWithStyle:UITableViewStylePlain];
self.title = path.lastPathComponent;
self.hidesHeaders = YES;
NSMutableArray *toolbarButtons = [[NSMutableArray alloc] initWithCapacity:3];
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];
refreshButton.style = UIBarButtonItemStyleBordered;
[toolbarButtons addObject:refreshButton];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[toolbarButtons addObject:flexibleSpace];
UIBarButtonItem *newFolderButton = [[UIBarButtonItem alloc] initWithTitle:@"New Folder" style:UIBarButtonItemStyleBordered target:self action:@selector(createNewFolder)];
[toolbarButtons addObject:newFolderButton];
[[[RetroArch_iOS get] toolbar] setItems:toolbarButtons];
[self setToolbarItems:toolbarButtons];
[self refresh];
return self;