-
-
Save jontelang/8a50a27bc06a250c9af7 to your computer and use it in GitHub Desktop.
asd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // InstaTogglesWindow interface | |
| // | |
| @interface InstaTogglesWindow : UIWindow <LAListener> | |
| ... | |
| @end | |
| // | |
| // InstaTogglesWindow implementation | |
| // | |
| @implementation InstaTogglesWindow | |
| - (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event | |
| { | |
| NSLog(@"activator %@",activator); | |
| NSLog(@"receiveEvent %@",event); | |
| if( self.hidden ) | |
| { | |
| labelReferences = [[NSMutableDictionary alloc] init]; | |
| [self makeKeyAndVisible]; | |
| [self setAlpha:0]; | |
| [self buildToggles]; // Contains animations | |
| ANIMATE(0.35f,0.0f) [self setAlpha:1]; AND STOP | |
| [event setHandled:YES]; | |
| } | |
| // else | |
| // { // TODO | |
| // // I'm adding this because apparently without it | |
| // // the view wont dimiss if opened on the lockscreen | |
| // [self removeToggles]; | |
| // [event setHandled:YES]; | |
| // } | |
| } | |
| - (void)activator:(LAActivator *)activator receiveDeactivateEvent:(LAEvent *)event | |
| { | |
| NSLog(@"activator %@",activator); | |
| NSLog(@"receiveDeactivateEvent %@",event); | |
| // if( !self.hidden ) | |
| // { | |
| [self removeToggles]; | |
| [event setHandled:YES]; | |
| // } | |
| } | |
| ... | |
| ... | |
| ... | |
| @end | |
| // | |
| // Creates the actual Activator listener object | |
| // | |
| static void createListener() | |
| { | |
| IT = [[InstaTogglesWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
| ... | |
| ... | |
| [[LAActivator sharedInstance] registerListener:IT forName:@"com.jontelang.instatoggles"]; | |
| ... | |
| } | |
| // | |
| // Constructor | |
| // | |
| %ctor | |
| { | |
| CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), NULL, (CFNotificationCallback)createListener, (CFStringRef)UIApplicationDidFinishLaunchingNotification, NULL, CFNotificationSuspensionBehaviorCoalesce); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment