private synchronized void waitForEntry(long interval) throws InterruptedException {
    if (LOCAL_LOGV) {
      Log.v(TAG, "Waiting for " + interval + "ms.");
    }

    long overhead = 0;

    while (interval > 0) {
      long startAt = System.currentTimeMillis();
      long sleep = Math.min(interval, TIMESLICE);
      if (overhead < sleep) {
        wait(sleep - overhead);
        mCurrentTime += sleep;
      } else {
        sleep = 0;
        mCurrentTime += overhead;
      }

      if (isStopAction() || isReloadAction() || isPauseAction()) {
        return;
      }

      ((EventTarget) mRoot).dispatchEvent(mMediaTimeUpdatedEvent);

      interval -= TIMESLICE;
      overhead = System.currentTimeMillis() - startAt - sleep;
    }
  }
Exemplo n.º 2
0
  protected void dispatchSVGDocEvent(String eventType) {
    SVGSVGElement root = (SVGSVGElement) document.getDocumentElement();
    // Event is dispatched on outermost SVG element.
    EventTarget t = root;

    DocumentEvent de = (DocumentEvent) document;
    AbstractEvent ev = (AbstractEvent) de.createEvent("SVGEvents");
    ev.initEventNS(XMLConstants.XML_EVENTS_NAMESPACE_URI, eventType, false, false);
    t.dispatchEvent(ev);
  }
Exemplo n.º 3
0
 /**
  * Fires a 'DOMActivate' event to the specified target.
  *
  * @param target the event target
  * @param detailArg the detailArg parameter of the event
  */
 protected void fireDOMActivateEvent(EventTarget target, int detailArg) {
   DocumentEvent docEvt = (DocumentEvent) ((Element) target).getOwnerDocument();
   UIEvent uiEvt = (UIEvent) docEvt.createEvent("UIEvents");
   uiEvt.initUIEvent("DOMActivate", true, true, null, detailArg);
   target.dispatchEvent(uiEvt);
 }
Exemplo n.º 4
0
 /**
  * Fires a 'DOMFocusOut' event to the specified target.
  *
  * @param target the event target
  */
 protected void fireDOMFocusOutEvent(EventTarget target) {
   DocumentEvent docEvt = (DocumentEvent) ((Element) target).getOwnerDocument();
   UIEvent uiEvt = (UIEvent) docEvt.createEvent("UIEvents");
   uiEvt.initUIEvent("DOMFocusOut", true, false, null, 0);
   target.dispatchEvent(uiEvt);
 }