コード例 #1
0
 public void removeOnEventChangeListener(OnEventListenerChange listener) {
   for (WeakReference<OnEventListenerChange> ref : eventChangeListeners) {
     OnEventListenerChange l = ref.get();
     if (l != null) {
       if (l.equals(listener)) {
         eventChangeListeners.remove(ref);
         break;
       }
     }
   }
 }
コード例 #2
0
 protected void dispatchOnEventChange(
     boolean added, String eventName, int count, KrollProxy proxy) {
   for (WeakReference<OnEventListenerChange> ref : eventChangeListeners) {
     OnEventListenerChange l = ref.get();
     if (l != null) {
       try {
         if (added) {
           l.eventListenerAdded(eventName, count, proxy);
         } else {
           l.eventListenerRemoved(eventName, count, proxy);
         }
       } catch (Throwable t) {
         Log.e(TAG, "Error invoking OnEventChangeListener: " + t.getMessage(), t);
       }
     }
   }
 }