mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-01 09:12:35 +00:00
Merge pull request #2152 from jeapostrophe/master
animate moving menus better
This commit is contained in:
commit
4d8b3c4c48
@ -41,6 +41,7 @@
|
|||||||
@interface RAMenuBase : UITableViewController
|
@interface RAMenuBase : UITableViewController
|
||||||
@property (nonatomic) NSMutableArray* sections;
|
@property (nonatomic) NSMutableArray* sections;
|
||||||
@property (nonatomic) BOOL hidesHeaders;
|
@property (nonatomic) BOOL hidesHeaders;
|
||||||
|
@property (nonatomic) RAMenuBase* last_menu;
|
||||||
|
|
||||||
- (id)initWithStyle:(UITableViewStyle)style;
|
- (id)initWithStyle:(UITableViewStyle)style;
|
||||||
- (id)itemForIndexPath:(NSIndexPath*)indexPath;
|
- (id)itemForIndexPath:(NSIndexPath*)indexPath;
|
||||||
@ -64,6 +65,7 @@ extern apple_frontend_settings_t apple_frontend_settings;
|
|||||||
@property (nonatomic) UIWindow* window;
|
@property (nonatomic) UIWindow* window;
|
||||||
@property (nonatomic) NSString* documentsDirectory;
|
@property (nonatomic) NSString* documentsDirectory;
|
||||||
@property (nonatomic) RAMenuBase* mainmenu;
|
@property (nonatomic) RAMenuBase* mainmenu;
|
||||||
|
@property (nonatomic) int menu_count;
|
||||||
|
|
||||||
+ (RetroArch_iOS*)get;
|
+ (RetroArch_iOS*)get;
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ extern apple_frontend_settings_t apple_frontend_settings;
|
|||||||
- (void)toggleUI;
|
- (void)toggleUI;
|
||||||
|
|
||||||
- (void)refreshSystemConfig;
|
- (void)refreshSystemConfig;
|
||||||
|
- (void)mainMenuPushPop: (bool)pushp;
|
||||||
- (void)mainMenuRefresh;
|
- (void)mainMenuRefresh;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -588,31 +588,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|||||||
- (void)reloadData
|
- (void)reloadData
|
||||||
{
|
{
|
||||||
[self willReloadData];
|
[self willReloadData];
|
||||||
|
[self.tableView reloadData];
|
||||||
// Here are two options:
|
|
||||||
|
|
||||||
// Option 1. This is like how setting app works, but not exactly.
|
|
||||||
// There is a typedef for the 'withRowAnimation' that has lots of
|
|
||||||
// options, just Google UITableViewRowAnimation
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
|
|
||||||
withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
||||||
#else
|
|
||||||
|
|
||||||
// Option 2. This is a "bigger" transition, but doesn't look as
|
|
||||||
// much like Settings. It has more options. Just Google
|
|
||||||
// UIViewAnimationOptionTransition
|
|
||||||
|
|
||||||
[UIView transitionWithView:self.tableView
|
|
||||||
duration:0.40f
|
|
||||||
options:UIViewAnimationOptionTransitionCrossDissolve
|
|
||||||
animations:^(void)
|
|
||||||
{
|
|
||||||
[self.tableView reloadData];
|
|
||||||
}
|
|
||||||
completion: nil];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)renderMessageBox:(NSString *)msg
|
-(void)renderMessageBox:(NSString *)msg
|
||||||
@ -673,7 +649,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|||||||
end = menu_entries_get_end();
|
end = menu_entries_get_end();
|
||||||
for (i = menu_entries_get_start(); i < end; i++)
|
for (i = menu_entries_get_start(); i < end; i++)
|
||||||
[everything addObject:[self make_menu_item_for_entry: i]];
|
[everything addObject:[self make_menu_item_for_entry: i]];
|
||||||
|
|
||||||
self.sections = [NSMutableArray array];
|
self.sections = [NSMutableArray array];
|
||||||
[self.sections addObject:everything];
|
[self.sections addObject:everything];
|
||||||
|
|
||||||
@ -756,9 +732,6 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|||||||
- (void)menuSelect: (uint32_t) i
|
- (void)menuSelect: (uint32_t) i
|
||||||
{
|
{
|
||||||
menu_entry_select(i);
|
menu_entry_select(i);
|
||||||
#if 0
|
|
||||||
[self willReloadData];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)menuBack
|
- (void)menuBack
|
||||||
|
@ -265,8 +265,8 @@ enum
|
|||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
|
|
||||||
self.mainmenu = [RAMainMenu new];
|
self.mainmenu = [RAMainMenu new];
|
||||||
|
self.mainmenu.last_menu = self.mainmenu;
|
||||||
[self pushViewController:self.mainmenu animated:YES];
|
[self pushViewController:self.mainmenu animated:NO];
|
||||||
|
|
||||||
btpad_set_inquiry_state(false);
|
btpad_set_inquiry_state(false);
|
||||||
|
|
||||||
@ -400,11 +400,31 @@ static void ui_companion_cocoatouch_event_command(void *data,
|
|||||||
btstack_set_poweron(is_btstack);
|
btstack_set_poweron(is_btstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mainMenuRefresh
|
- (void)mainMenuRefresh
|
||||||
{
|
{
|
||||||
[self.mainmenu reloadData];
|
[self.mainmenu reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)mainMenuPushPop: (bool)pushp
|
||||||
|
{
|
||||||
|
if ( pushp ) {
|
||||||
|
self.menu_count++;
|
||||||
|
RAMenuBase* next_menu = [RAMainMenu new];
|
||||||
|
next_menu.last_menu = self.mainmenu;
|
||||||
|
self.mainmenu = next_menu;
|
||||||
|
[self pushViewController:self.mainmenu animated:YES];
|
||||||
|
} else {
|
||||||
|
if ( self.menu_count == 0 ) {
|
||||||
|
[self.mainmenu reloadData];
|
||||||
|
} else {
|
||||||
|
self.menu_count--;
|
||||||
|
|
||||||
|
[self popViewControllerAnimated:YES];
|
||||||
|
self.mainmenu = self.mainmenu.last_menu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)mainMenuRenderMessageBox:(NSString *)msg
|
- (void)mainMenuRenderMessageBox:(NSString *)msg
|
||||||
{
|
{
|
||||||
[self.mainmenu renderMessageBox:msg];
|
[self.mainmenu renderMessageBox:msg];
|
||||||
@ -499,13 +519,25 @@ static void *ui_companion_cocoatouch_init(void)
|
|||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t old_size = 0;
|
||||||
static void ui_companion_cocoatouch_notify_list_pushed(void *data,
|
static void ui_companion_cocoatouch_notify_list_pushed(void *data,
|
||||||
file_list_t *list, file_list_t *menu_list)
|
file_list_t *list, file_list_t *menu_list)
|
||||||
{
|
{
|
||||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||||
|
bool pushp = false;
|
||||||
|
|
||||||
|
size_t new_size = file_list_get_size( menu_list );
|
||||||
|
if ( old_size == new_size ) {
|
||||||
|
pushp = false;
|
||||||
|
} else if ( old_size < new_size ) {
|
||||||
|
pushp = true;
|
||||||
|
} else if ( old_size > new_size ) {
|
||||||
|
printf( "notify_list_pushed: old size should not be larger\n" );
|
||||||
|
}
|
||||||
|
old_size = new_size;
|
||||||
|
|
||||||
if (ap)
|
if (ap)
|
||||||
[ap mainMenuRefresh];
|
[ap mainMenuPushPop: pushp];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_companion_cocoatouch_notify_refresh(void *data)
|
static void ui_companion_cocoatouch_notify_refresh(void *data)
|
||||||
@ -513,7 +545,7 @@ static void ui_companion_cocoatouch_notify_refresh(void *data)
|
|||||||
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
RetroArch_iOS *ap = (RetroArch_iOS *)apple_platform;
|
||||||
|
|
||||||
if (ap)
|
if (ap)
|
||||||
[ap mainMenuRefresh];
|
[ap mainMenuRefresh];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_companion_cocoatouch_render_messagebox(const char *msg)
|
static void ui_companion_cocoatouch_render_messagebox(const char *msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user