Skip to content

Instantly share code, notes, and snippets.

@jontelang
Created July 13, 2014 07:08
Show Gist options
  • Save jontelang/c8a6590d90bee81594f9 to your computer and use it in GitHub Desktop.
Save jontelang/c8a6590d90bee81594f9 to your computer and use it in GitHub Desktop.
asd
//
// Includes
//
#import "/Users/jontelang/Files/Development/Flipswitch/FSSwitchPanel.h"
#import "Activator/libactivator.h"
//
// InstaTogglesWindow interface
//
@interface InstaTogglesWindow : UIWindow <LAListener>
{
BOOL hasBeenBuiltOnce;
}
@end
//
// InstaTogglesWindow implementation
//
@implementation InstaTogglesWindow
-(id)init
{
if( self == [super init] )
{
hasBeenBuiltOnce = NO;
}
return self;
}
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
{
NSLog(@"InstaToggles event received");
if( hasBeenBuiltOnce == NO )
{
[self setFrame:[UIScreen mainScreen].bounds];
[self setBackgroundColor:[UIColor redColor]];
[self setWindowLevel:UIWindowLevelStatusBar+55];
[self makeKeyAndVisible];
hasBeenBuiltOnce = YES;
}
else
{
[self setHidden:!self.hidden];
}
NSLog(@"InstaToggles: %@",self);
}
@end
//
// Static instances
//
static InstaTogglesWindow* IT;
//
// Constructor
//
%ctor
{
IT = [[InstaTogglesWindow alloc] init];
[[LAActivator sharedInstance] registerListener:IT forName:@"com.jontelang.instatoggles"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment