Exemplo n.º 1
0
 public static NSObject observeDidBecomeInvalid(NSPort object, final VoidBlock1<NSPort> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           DidBecomeInvalidNotification(),
           object,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke((NSPort) a.getObject());
             }
           });
 }
Exemplo n.º 2
0
 public static NSObject observeWillExit(NSThread object, final VoidBlock1<NSThread> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           WillExitNotification(),
           object,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke((NSThread) a.getObject());
             }
           });
 }
Exemplo n.º 3
0
 public static NSObject observeDidBecomeSingleThreaded(final Runnable block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           DidBecomeSingleThreadedNotification(),
           null,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.run();
             }
           });
 }
Exemplo n.º 4
0
 public static NSObject observeDidResignKey(final VoidBlock1<UIWindow> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           DidResignKeyNotification(),
           null,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke((UIWindow) a.getObject());
             }
           });
 }
Exemplo n.º 5
0
 public static NSObject observeKeyboardDidHide(final VoidBlock1<UIKeyboardAnimation> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           KeyboardDidHideNotification(),
           null,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke(new UIKeyboardAnimation(a.getUserInfo()));
             }
           });
 }
Exemplo n.º 6
0
 public static NSObject observeChanged(
     NSURLCredentialStorage object, final VoidBlock1<NSURLCredentialStorage> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           ChangedNotification(),
           object,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke((NSURLCredentialStorage) a.getObject());
             }
           });
 }