public void addObserver(CFType observer, NotificationCallback callBack, String name, CFType object, CFNotificationSuspensionBehavior suspensionBehavior) { synchronized(callbacks) { long id = getCallbackIdForNotification(observer, name, object); callbacks.put(id, callBack); } addObserver(observer, new FunctionPtr(cbNotification), name, object, suspensionBehavior); }
@Callback private static void cbNotification(CFNotificationCenter center, CFType observer, String name, CFType object, NSDictionary<NSString, ?> userInfo) { NotificationCallback callback = null; synchronized (callbacks) { long id = getCallbackIdForNotification(observer, name, object); callback = callbacks.get(id); } // We don't store observer callbacks for every possible combination of observer, name and object. // Therefore a callback for the current combination is not registered and will be null. if (callback != null) { callback.invoke(center, observer, name, object, userInfo); } }
@Callback private static void cbNotification(CFNotificationCenter center, CFType observer, String name, CFType object, NSDictionary<NSString, ?> userInfo) { NotificationCallback callback = null; synchronized (callbacks) { long id = getCallbackIdForNotification(observer, name, object); callback = callbacks.get(id); } // We don't store observer callbacks for every possible combination of observer, name and object. // Therefore a callback for the current combination is not registered and will be null. if (callback != null) { callback.invoke(center, observer, name, object, userInfo); } }
public void addObserver(CFType observer, NotificationCallback callBack, String name, CFType object, CFNotificationSuspensionBehavior suspensionBehavior) { synchronized(callbacks) { long id = getCallbackIdForNotification(observer, name, object); callbacks.put(id, callBack); } addObserver(observer, new FunctionPtr(cbNotification), name, object, suspensionBehavior); }
@Callback private static void cbNotification(CFNotificationCenter center, CFType observer, String name, CFType object, NSDictionary<NSString, ?> userInfo) { NotificationCallback callback = null; synchronized (callbacks) { long id = getCallbackIdForNotification(observer, name, object); callback = callbacks.get(id); } // We don't store observer callbacks for every possible combination of observer, name and object. // Therefore a callback for the current combination is not registered and will be null. if (callback != null) { callback.invoke(center, observer, name, object, userInfo); } }
public void addObserver(CFType observer, NotificationCallback callBack, String name, CFType object, CFNotificationSuspensionBehavior suspensionBehavior) { synchronized(callbacks) { long id = getCallbackIdForNotification(observer, name, object); callbacks.put(id, callBack); } addObserver(observer, new FunctionPtr(cbNotification), name, object, suspensionBehavior); }