@Override protected void onPostExecute(Void aVoid) { Log.i(TAG, "Web GUI has come online at " + mApi.getUrl()); mIsWebGuiAvailable = true; for (OnWebGuiAvailableListener listener : mOnWebGuiAvailableListeners) { listener.onWebGuiAvailable(); } mOnWebGuiAvailableListeners.clear(); }
/** * Register a listener for the web gui becoming available.. * * <p>If the web gui is already available, listener will be called immediately. Listeners are * unregistered automatically after being called. */ public void registerOnWebGuiAvailableListener(OnWebGuiAvailableListener listener) { if (mIsWebGuiAvailable) { listener.onWebGuiAvailable(); } else { mOnWebGuiAvailableListeners.add(listener); } }
/** * Register a listener for the web gui becoming available.. * * <p>If the web gui is already available, listener will be called immediately. Listeners are * unregistered automatically after being called. */ public void registerOnWebGuiAvailableListener(OnWebGuiAvailableListener listener) { if (mCurrentState == State.ACTIVE) { listener.onWebGuiAvailable(); } else { mOnWebGuiAvailableListeners.add(listener); } }
/** * Wait for the web-gui of the native syncthing binary to come online. * * <p>In case the binary is to be stopped, also be aware that another thread could request to * stop the binary in the time while waiting for the GUI to become active. See the comment for * SyncthingService.onDestroy for details. */ @Override protected void onPostExecute(Void aVoid) { synchronized (stateLock) { if (mStopScheduled) { mCurrentState = State.DISABLED; onApiChange(); shutdown(); mStopScheduled = false; stopSelf(); return; } } Log.i(TAG, "Web GUI has come online at " + mConfig.getWebGuiUrl()); mCurrentState = State.STARTING; onApiChange(); for (OnWebGuiAvailableListener listener : mOnWebGuiAvailableListeners) { listener.onWebGuiAvailable(); } mOnWebGuiAvailableListeners.clear(); }