Exemplo n.º 1
0
  private void replayMousePressed(GaudiEvent e, Component c) {

    AWTEvent newe =
        new MouseEvent(
            c,
            MouseEvent.MOUSE_PRESSED,
            e.when,
            e.modifiers,
            0,
            0,
            e.clickcount,
            false,
            e.buttonclick);

    System.err.println("[GUIMIN][" + currentEventId + "]-->mouse Pressed event at " + e.widgetid);
    c.dispatchEvent(newe);
    try {
      EventDispatcher ed = new EventDispatcher(c, newe);
      ed.start();

      Thread.sleep(250);

      if (ed.isAlive()) ed.interrupt();

    } catch (InterruptedException e1) {
      System.err.println("interrompida");
    }
  }
Exemplo n.º 2
0
 public static void destroy() {
   if (instance != null) {
     EventDispatcher.getInstance()
         .unregisterGeckoThreadListener((GeckoEventListener) instance, EVENTS);
     EventDispatcher.getInstance()
         .unregisterGeckoThreadListener((NativeEventListener) instance, NATIVE_EVENTS);
     instance = null;
   }
 }
Exemplo n.º 3
0
 final EventDispatcher getEventDispatcher() {
   // create and start the global event thread
   // TODO  need a way to stop this thread when the engine is done
   final ThreadGroup tg = Thread.currentThread().getThreadGroup();
   synchronized (dispatchers) {
     EventDispatcher eventDispatcher = dispatchers.get(tg);
     if (eventDispatcher == null) {
       eventDispatcher = new EventDispatcher();
       dispatchers.put(tg, eventDispatcher);
       eventDispatcher.start();
     }
     return eventDispatcher;
   }
 }
Exemplo n.º 4
0
 public ZoomedView(Context context, AttributeSet attrs, int defStyle) {
   super(context, attrs, defStyle);
   isSimplifiedUI = true;
   isBlockedFromAppearing = false;
   getPrefs();
   currentZoomFactorIndex = 0;
   returnValue = new PointF();
   animationStart = new PointF();
   requestRenderRunnable =
       new Runnable() {
         @Override
         public void run() {
           requestZoomedViewRender();
         }
       };
   touchListener = new ZoomedViewTouchListener();
   EventDispatcher.getInstance()
       .registerGeckoThreadListener(
           this,
           "Gesture:clusteredLinksClicked",
           "Window:Resize",
           "Content:LocationChange",
           "Gesture:CloseZoomedView",
           "Browser:ZoomToPageWidth",
           "Browser:ZoomToRect",
           "FormAssist:AutoComplete",
           "FormAssist:Hide");
 }
  private void connectImpl() throws IOException, ClientProtocolException, ConnectException {
    LOGGER.info("connecting to slack");
    lastPingSent = 0;
    lastPingAck = 0;
    HttpClient httpClient = getHttpClient();
    HttpGet request = new HttpGet(SLACK_HTTPS_AUTH_URL + authToken);
    HttpResponse response;
    response = httpClient.execute(request);
    LOGGER.debug(response.getStatusLine().toString());
    String jsonResponse =
        CharStreams.toString(new InputStreamReader(response.getEntity().getContent()));
    SlackJSONSessionStatusParser sessionParser = new SlackJSONSessionStatusParser(jsonResponse);
    try {
      sessionParser.parse();
    } catch (ParseException e1) {
      LOGGER.error(e1.toString());
    }
    if (sessionParser.getError() != null) {
      LOGGER.error("Error during authentication : " + sessionParser.getError());
      throw new ConnectException(sessionParser.getError());
    }
    users = sessionParser.getUsers();
    channels = sessionParser.getChannels();
    sessionPersona = sessionParser.getSessionPersona();
    team = sessionParser.getTeam();
    LOGGER.info("Team " + team.getId() + " : " + team.getName());
    LOGGER.info("Self " + sessionPersona.getId() + " : " + sessionPersona.getUserName());
    LOGGER.info(users.size() + " users found on this session");
    LOGGER.info(channels.size() + " channels found on this session");
    String wssurl = sessionParser.getWebSocketURL();

    LOGGER.debug("retrieved websocket URL : " + wssurl);
    ClientManager client = ClientManager.createClient();
    if (proxyAddress != null) {
      client
          .getProperties()
          .put(ClientProperties.PROXY_URI, "http://" + proxyAddress + ":" + proxyPort);
    }
    final MessageHandler handler = this;
    LOGGER.debug("initiating connection to websocket");
    try {
      websocketSession =
          client.connectToServer(
              new Endpoint() {
                @Override
                public void onOpen(Session session, EndpointConfig config) {
                  session.addMessageHandler(handler);
                }
              },
              URI.create(wssurl));
    } catch (DeploymentException e) {
      LOGGER.error(e.toString());
    }
    if (websocketSession != null) {
      SlackConnectedImpl slackConnectedImpl = new SlackConnectedImpl(sessionPersona);
      dispatcher.dispatch(slackConnectedImpl);
      LOGGER.debug("websocket connection established");
      LOGGER.info("slack session ready");
    }
  }
 /**
  * Simple event to be raised after the an element has been chosen in the list. The selected
  * element is available in the Selection property.
  */
 @SimpleEvent(
     description =
         "Simple event to be raised after the an element has been chosen in the"
             + " list. The selected element is available in the Selection property.")
 public void AfterPicking() {
   EventDispatcher.dispatchEvent(this, "AfterPicking");
 }
 @Override
 public void onMessage(String message) {
   LOGGER.debug("receiving from websocket " + message);
   if (message.contains("{\"type\":\"pong\",\"reply_to\"")) {
     int rightBracketIdx = message.indexOf('}');
     String toParse = message.substring(26, rightBracketIdx);
     lastPingAck = Integer.parseInt(toParse);
     LOGGER.debug("pong received " + lastPingAck);
   } else {
     JSONObject object = parseObject(message);
     SlackEvent slackEvent = SlackJSONMessageParser.decode(this, object);
     if (slackEvent instanceof SlackChannelCreated) {
       SlackChannelCreated slackChannelCreated = (SlackChannelCreated) slackEvent;
       channels.put(
           slackChannelCreated.getSlackChannel().getId(), slackChannelCreated.getSlackChannel());
     }
     if (slackEvent instanceof SlackGroupJoined) {
       SlackGroupJoined slackGroupJoined = (SlackGroupJoined) slackEvent;
       channels.put(
           slackGroupJoined.getSlackChannel().getId(), slackGroupJoined.getSlackChannel());
     }
     if (slackEvent instanceof SlackUserChange) {
       SlackUserChange slackUserChange = (SlackUserChange) slackEvent;
       users.put(slackUserChange.getUser().getId(), slackUserChange.getUser());
     }
     dispatcher.dispatch(slackEvent);
   }
 }
Exemplo n.º 8
0
 /** ErrorOccurred event handler. */
 @SimpleEvent(
     description =
         "Event raised when an error occurs. Only some errors will "
             + "raise this condition.  For those errors, the system will show a notification "
             + "by default.  You can use this event handler to prescribe an error "
             + "behavior different than the default.")
 public void ErrorOccurred(
     Component component, String functionName, int errorNumber, String message) {
   String componentType = component.getClass().getName();
   componentType = componentType.substring(componentType.lastIndexOf(".") + 1);
   Log.e(
       LOG_TAG,
       "Form "
           + formName
           + " ErrorOccurred, errorNumber = "
           + errorNumber
           + ", componentType = "
           + componentType
           + ", functionName = "
           + functionName
           + ", messages = "
           + message);
   if ((!(EventDispatcher.dispatchEvent(
           this, "ErrorOccurred", component, functionName, errorNumber, message)))
       && screenInitialized) {
     // If dispatchEvent returned false, then no user-supplied error handler was run.
     // If in addition, the screen initializer was run, then we assume that the
     // user did not provide an error handler.   In this case, we run a default
     // error handler, namely, showing a notification to the end user of the app.
     // The app writer can override this by providing an error handler.
     new Notifier(this).ShowAlert("Error " + errorNumber + ": " + message);
   }
 }
Exemplo n.º 9
0
 public static void unregister() {
   if (DEBUG) {
     Log.d(LOGTAG, "Unregistered listener");
   }
   EventDispatcher.getInstance()
       .unregisterGeckoThreadListener(EVENT_LISTENER, "Gecko:ScheduleRun");
 }
Exemplo n.º 10
0
  DoorHangerPopup(GeckoApp activity) {
    super(activity);

    mDoorHangers = new HashSet<DoorHanger>();

    EventDispatcher.getInstance()
        .registerGeckoThreadListener(this, "Doorhanger:Add", "Doorhanger:Remove");
    Tabs.registerOnTabsChangedListener(this);
  }
Exemplo n.º 11
0
 public String ac_driver_properties(Args args) {
   Map<String, String> map = new HashMap<>();
   for (int i = 0, n = args.optc(); i < n; i++) {
     String key = args.optv(i);
     String value = args.getOpt(key);
     map.put(key, value);
   }
   _eventDispatcher.propertiesUpdated(map);
   return "Properties sent to driver, check with 'info'";
 }
Exemplo n.º 12
0
  public Object ac_ls_pool_$_0_1(Args args) {
    String poolName = args.argc() == 0 ? null : args.argv(0);
    boolean detail = args.hasOption("l");
    boolean binary = args.hasOption("binary");

    StringBuffer sb = new StringBuffer();
    if (poolName == null) {
      if (binary) {
        Collection<HsmFlushControlCore.PoolDetails> list = new ArrayList<>();
        for (Object pool : _eventDispatcher.getConfiguredPools()) {
          list.add(((HFCPool) pool).getDetails());
        }
        return list;
      } else {
        Set<String> set = new TreeSet<>(_poolCollector.getConfiguredPoolNames());
        for (Object configuredPoolName : set) {
          String name = configuredPoolName.toString();
          if (!detail) {
            sb.append(name).append("\n");
          } else {
            HFCPool pool = _poolCollector.getPoolByName(name);
            printPoolDetails2(pool, sb);
          }
        }
      }
    } else {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        throw new NoSuchElementException("Pool not found : " + poolName);
      }

      if (binary) {
        return pool.getDetails();
        /*
        HsmFlushControlCore.PoolDetails details = pool.getDetails() ;
        sb.append("PoolDetails\n").
           append("   Name ").append(details.getName()).append("\n").
           append("   CellInfo ").append(details.getCellInfo()).append("\n").
           append("   isActive ").append(details.isActive()).append("\n") ;
        for( Iterator i = details.getFlushInfos().iterator() ; i.hasNext() ; ){
           HsmFlushControlCore.FlushInfoDetails flush = (HsmFlushControlCore.FlushInfoDetails)i.next() ;
           sb.append("   StorageClass ").append(flush.getName()).append("\n").
              append("     isFlushing   ").append(flush.isFlushing()).append("\n").
              append("     FlushInfo    ").append(flush.getStorageClassFlushInfo()).append("\n");
        }
        */
      } else {
        printPoolDetails2(pool, sb);
      }
    }
    return sb.toString();
  }
Exemplo n.º 13
0
  @Override
  protected void onDestroy() {
    super.onDestroy();
    // for debugging and future growth
    Log.d(LOG_TAG, "Form " + formName + " got onDestroy");

    // Unregister events for components in this form.
    EventDispatcher.removeDispatchDelegate(this);

    for (OnDestroyListener onDestroyListener : onDestroyListeners) {
      onDestroyListener.onDestroy();
    }
  }
Exemplo n.º 14
0
  @Override
  protected void startUp() throws Exception {
    _poolManager = new CellStub(this, new CellPath("PoolManager"), 30, SECONDS);
    Args args = getArgs();
    checkArgument(args.argc() >= 1, "Usage : ... <pgroup0> [<pgroup1>[...]]");

    for (int i = 0, n = args.argc(); i < n; i++) {
      _poolGroupList.add(args.argv(0));
      args.shift();
    }
    String tmp = args.getOpt("scheduler");
    if ((tmp != null) && (!tmp.equals(""))) {
      _eventDispatcher.loadHandler(tmp, false, args);
    }

    _queueWatch = new QueueWatch();

    tmp = args.getOpt("poolCollectionUpdate");
    if ((tmp != null) && (!tmp.equals(""))) {
      try {
        _getPoolCollectionTicker = Long.parseLong(tmp) * 60L * 1000L;
      } catch (Exception ee) {
        _log.warn(
            "Illegal value for poolCollectionUpdate : {} (choosing {} millis)",
            tmp,
            _getPoolCollectionTicker);
      }
    }
    tmp = args.getOpt("gainControlUpdate");
    if ((tmp != null) && (!tmp.equals(""))) {
      long gainControlTicker = 0L;
      try {
        _queueWatch.setGainControlTicker(gainControlTicker = Long.parseLong(tmp) * 60L * 1000L);
      } catch (Exception ee) {
        _log.warn(
            "Illegal value for gainControlUpdate : {} (choosing {} millis)",
            tmp,
            gainControlTicker);
      }
    }
    tmp = args.getOpt("timer");
    if ((tmp != null) && (!tmp.equals(""))) {
      try {
        _timerInterval = Long.parseLong(tmp) * 1000L;
      } catch (Exception ee) {
        _log.warn("Illegal value for timer : {} (choosing {} millis)", tmp, _timerInterval);
      }
    }
    useInterpreter(true);
  }
Exemplo n.º 15
0
  /////////////////////////////////////////////////////////////////////////////////////////
  //
  //      message arrived handler
  //
  private void poolFlushDoFlushMessageArrived(PoolFlushDoFlushMessage msg) {
    if (LOG_ENABLED) {
      _log.info("poolFlushDoFlushMessageArrived : " + msg);
    }
    String poolName = msg.getPoolName();
    synchronized (_poolCollector) {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        _log.warn(
            "poolFlushDoFlushMessageArrived : message arrived for non configured pool : "
                + poolName);
        return;
      }
      String storageClass = msg.getStorageClassName() + "@" + msg.getHsmName();
      HFCFlushInfo info = pool.flushInfos.get(storageClass);
      if (info == null) {
        _log.warn(
            "poolFlushDoFlushMessageArrived : message arrived for non existing storage class : "
                + storageClass);
        //
        // the real one doesn't exists anymore, so we simulate one.
        //
        info =
            new HFCFlushInfo(
                pool, new StorageClassFlushInfo(msg.getHsmName(), msg.getStorageClassName()));
      }
      if (msg.getReturnCode() != 0) {
        if (LOG_ENABLED) {
          _log.info("Flush failed (msg=" + (msg.isFinished() ? "Finished" : "Ack") + ") : " + msg);
        }

        info.setFlushingFailed(msg.getReturnCode(), msg.getErrorObject());
        //
        // maybe we have to call flushingDone here as well.
        //
        return;
      }
      if (msg.isFinished()) {
        if (LOG_ENABLED) {
          _log.info("Flush finished : " + msg);
        }

        updateFlushCellAndFlushInfos(msg, pool);
        info.setFlushingDone();
        _eventDispatcher.flushingDone(info);
      } else {
        info.setFlushingAck(msg.getFlushId());
      }
    }
  }
Exemplo n.º 16
0
  private void getHandlers(JSONObject message) throws JSONException {
    final Intent intent =
        GeckoAppShell.getOpenURIIntent(
            activity,
            message.optString("url"),
            message.optString("mime"),
            message.optString("action"),
            message.optString("title"));
    final List<String> appList = Arrays.asList(GeckoAppShell.getHandlersForIntent(intent));

    final JSONObject response = new JSONObject();
    response.put("apps", new JSONArray(appList));
    EventDispatcher.sendResponse(message, response);
  }
Exemplo n.º 17
0
 /**
  * Event that's raised when a text message is received by the phone.
  *
  * @param number the phone number that the text message was sent from.
  * @param messageText the text of the message.
  */
 @SimpleEvent
 public static void MessageReceived(String number, String messageText) {
   if (receivingEnabled > ComponentConstants.TEXT_RECEIVING_OFF) {
     Log.i(TAG, "MessageReceived from " + number + ":" + messageText);
     if (EventDispatcher.dispatchEvent(component, "MessageReceived", number, messageText)) {
       Log.i(TAG, "Dispatch successful");
     } else {
       Log.i(TAG, "Dispatch failed, caching");
       synchronized (cacheLock) {
         addMessageToCache(activity, number, messageText);
       }
     }
   }
 }
Exemplo n.º 18
0
 @SimpleEvent(
     description =
         "Event raised when another screen has closed and control has "
             + "returned to this screen.")
 public void OtherScreenClosed(String otherScreenName, String result) {
   Log.i(
       LOG_TAG,
       "Form "
           + formName
           + " OtherScreenClosed, otherScreenName = "
           + otherScreenName
           + ", result = "
           + result);
   EventDispatcher.dispatchEvent(this, "OtherScreenClosed", otherScreenName, result);
 }
Exemplo n.º 19
0
  private void poolModeInfoArrived(PoolManagerPoolModeMessage msg) {
    if (LOG_ENABLED) {
      _log.info("PoolManagerPoolModeMessage : " + msg);
    }
    String poolName = msg.getPoolName();
    synchronized (_poolCollector) {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        _log.warn("poolModeInfoArrived : message arrived for non configured pool : " + poolName);
        return;
      }
      pool.mode = msg.getPoolMode();

      _eventDispatcher.poolIoModeUpdated(pool);
    }
  }
Exemplo n.º 20
0
  /**
   * Actual entry point.
   *
   * @param args application parameters.
   */
  public static void go(String[] args) {
    FileHandler file = new LocalFileHandler();
    IRCConfiguration ircConfiguration;
    StartupConfiguration startupConfiguration;

    try {

      if ((args.length == 0) || ((args.length >= 2) && (args[0].equals("-f")))) {
        String f = "pjirc.cfg";
        if (args.length >= 2) f = args[1];
        StreamParameterProvider provider = new StreamParameterProvider(file.getInputStream(f));
        ConfigurationLoader loader =
            new ConfigurationLoader(
                provider, new NullURLHandler(), new AWTImageLoader(), new NullSoundHandler(), file);
        ircConfiguration = loader.loadIRCConfiguration();
        startupConfiguration = loader.loadStartupConfiguration();
      } else if ((args.length >= 5) && (args[0].equals("-p"))) {
        StreamParameterProvider provider = new StreamParameterProvider(null);
        ConfigurationLoader loader =
            new ConfigurationLoader(
                provider, new NullURLHandler(), new AWTImageLoader(), new NullSoundHandler(), file);
        ircConfiguration = loader.loadIRCConfiguration();
        ircConfiguration.set("gui", args[4]);
        startupConfiguration =
            new StartupConfiguration(
                args[1],
                "",
                args[2],
                new String[] {""},
                new String[] {args[3]},
                new int[] {6667},
                "",
                new String[] {},
                new String[] {},
                true); // last value "true" set smileys to true by default
      } else {
        usage();
        return;
      }

      IRCApplication application = new IRCApplication(ircConfiguration, startupConfiguration, null);
      EventDispatcher.dispatchEventAsyncAndWaitEx(application, "init", new Object[0]);
    } catch (Throwable ex) {
      System.out.println("Error : " + ex.getMessage());
      ex.printStackTrace();
    }
  }
Exemplo n.º 21
0
    @Override
    public void onActivityResult(int resultCode, Intent data) {
      JSONObject response = new JSONObject();

      try {
        if (data != null) {
          response.put("extras", JSONUtils.bundleToJSON(data.getExtras()));
          response.put("uri", data.getData().toString());
        }

        response.put("resultCode", resultCode);
      } catch (JSONException e) {
        Log.w(LOGTAG, "Error building JSON response.", e);
      }

      EventDispatcher.sendResponse(message, response);
    }
Exemplo n.º 22
0
  private void poolFlushGainControlMessageDidntArrive(String poolName) {
    if (LOG_ENABLED) {
      _log.info("poolFlushGainControlMessageDidntArrive : " + poolName);
    }
    synchronized (_poolCollector) {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        _log.warn(
            "PoolFlushGainControlMessage : message arrived for non configured pool : " + poolName);
        return;
      }
      pool.isActive = false;
      pool.lastUpdated = System.currentTimeMillis();
      pool.answerCount++;

      _eventDispatcher.poolFlushInfoUpdated(pool);
    }
  }
Exemplo n.º 23
0
 void destroy() {
   if (prefObserver != null) {
     PrefsHelper.removeObserver(prefObserver);
     prefObserver = null;
   }
   ThreadUtils.removeCallbacksFromUiThread(requestRenderRunnable);
   EventDispatcher.getInstance()
       .unregisterGeckoThreadListener(
           this,
           "Gesture:clusteredLinksClicked",
           "Window:Resize",
           "Content:LocationChange",
           "Gesture:CloseZoomedView",
           "Browser:ZoomToPageWidth",
           "Browser:ZoomToRect",
           "FormAssist:AutoComplete",
           "FormAssist:Hide");
 }
Exemplo n.º 24
0
  private void poolFlushGainControlMessageArrived(PoolFlushGainControlMessage msg) {
    if (LOG_ENABLED) {
      _log.info("PoolFlushGainControlMessage : " + msg);
    }
    String poolName = msg.getPoolName();
    synchronized (_poolCollector) {
      HFCPool pool = _poolCollector.getPoolByName(poolName);
      if (pool == null) {
        _log.warn(
            "PoolFlushGainControlMessage : message arrived for non configured pool : " + poolName);
        return;
      }

      updateFlushCellAndFlushInfos(msg, pool);

      _eventDispatcher.poolFlushInfoUpdated(pool);
    }
  }
Exemplo n.º 25
0
 @SimpleEvent
 public static void MessageReceived(String paramString1, String paramString2)
 {
   if (receivingEnabled > 1)
   {
     Log.i("Texting Component", "MessageReceived from " + paramString1 + ":" + paramString2);
     if (EventDispatcher.dispatchEvent(component, "MessageReceived", new Object[] { paramString1, paramString2 })) {
       Log.i("Texting Component", "Dispatch successful");
     }
   }
   else
   {
     return;
   }
   Log.i("Texting Component", "Dispatch failed, caching");
   synchronized (cacheLock)
   {
     addMessageToCache(activity, paramString1, paramString2);
     return;
   }
 }
Exemplo n.º 26
0
  /** Uninit the application. */
  public synchronized void uninit() {
    Enumeration<Server> en = _servers.keys();
    while (en.hasMoreElements()) {
      Server s = (Server) en.nextElement();
      s.leave();
    }

    if (_ident != null) _ident.stop();
    _interface.removeIRCInterfaceListener(this);

    if (_frame != null) _frame.removeWindowListener(this);
    _frame = null;

    while (_plugins.size() > 0) {
      unloadPlugin((Plugin) _plugins.elementAt(_plugins.size() - 1));
    }
    _pluginsTable = new Hashtable<String, Plugin>();

    if (_container != null) _container.removeAll();

    EventDispatcher.clearCache();
  }
Exemplo n.º 27
0
  private void init(Context context, String url, boolean doInit) {
    // TODO: Fennec currently takes care of its own initialization, so this
    // flag is a hack used in Fennec to prevent GeckoView initialization.
    // This should go away once Fennec also uses GeckoView for
    // initialization.
    if (!doInit) return;

    // If running outside of a GeckoActivity (eg, from a library project),
    // load the native code and disable content providers
    boolean isGeckoActivity = false;
    try {
      isGeckoActivity = context instanceof GeckoActivity;
    } catch (NoClassDefFoundError ex) {
    }

    if (!isGeckoActivity) {
      // Set the GeckoInterface if the context is an activity and the GeckoInterface
      // has not already been set
      if (context instanceof Activity && getGeckoInterface() == null) {
        setGeckoInterface(new BaseGeckoInterface(context));
      }

      Clipboard.init(context);
      HardwareUtils.init(context);

      // If you want to use GeckoNetworkManager, start it.

      GeckoLoader.loadMozGlue();
      BrowserDB.setEnableContentProviders(false);
    }

    if (url != null) {
      GeckoThread.setUri(url);
      GeckoThread.setAction(Intent.ACTION_VIEW);
      GeckoAppShell.sendEventToGecko(GeckoEvent.createURILoadEvent(url));
    }
    GeckoAppShell.setContextGetter(this);
    if (context instanceof Activity) {
      Tabs tabs = Tabs.getInstance();
      tabs.attachToContext(context);
    }

    EventDispatcher.getInstance()
        .registerGeckoThreadListener(
            this,
            "Gecko:Ready",
            "Content:StateChange",
            "Content:LoadError",
            "Content:PageShow",
            "DOMTitleChanged",
            "Link:Favicon",
            "Prompt:Show",
            "Prompt:ShowTop");

    ThreadUtils.setUiThread(Thread.currentThread(), new Handler());
    initializeView(EventDispatcher.getInstance());

    if (GeckoThread.checkAndSetLaunchState(
        GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
      // This is the first launch, so finish initialization and go.
      GeckoProfile profile = GeckoProfile.get(context).forceCreate();
      BrowserDB.initialize(profile.getName());

      GeckoAppShell.setLayerView(this);
      GeckoThread.createAndStart();
    } else if (GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning)) {
      // If Gecko is already running, that means the Activity was
      // destroyed, so we need to re-attach Gecko to this GeckoView.
      connectToGecko();
    }
  }
Exemplo n.º 28
0
 private void onDestroy() {
   handleManagerEvent(ManagerEvent.stop);
   EventDispatcher.getInstance()
       .unregisterGeckoThreadListener(this, "Wifi:Enable", "Wifi:GetIPAddress");
 }
Exemplo n.º 29
0
 private GeckoNetworkManager() {
   EventDispatcher.getInstance()
       .registerGeckoThreadListener(this, "Wifi:Enable", "Wifi:GetIPAddress");
 }
Exemplo n.º 30
0
 /** Default Timer event handler. */
 @SimpleEvent(description = "Timer has gone off.")
 public void Timer() {
   if (timerAlwaysFires || onScreen) {
     EventDispatcher.dispatchEvent(this, "Timer");
   }
 }