Beispiel #1
0
  @Override
  public void onDestroyView() {
    super.onDestroyView();
    mView = null;
    mPanelLayout = null;
    mPanelAuthLayout = null;

    mPanelAuthCache.setOnChangeListener(null);
    GeckoAppShell.unregisterEventListener("HomePanels:RefreshDataset", this);

    if (mAuthStateTask != null) {
      mAuthStateTask.cancel(true);
      mAuthStateTask = null;
    }
  }
Beispiel #2
0
  @Override
  protected void load() {
    Log.d(LOGTAG, "Loading layout");

    if (requiresAuth()) {
      mAuthStateTask =
          new UiAsyncTask<Void, Void, Boolean>(ThreadUtils.getBackgroundHandler()) {
            @Override
            public synchronized Boolean doInBackground(Void... params) {
              return mPanelAuthCache.isAuthenticated(mPanelConfig.getId());
            }

            @Override
            public void onPostExecute(Boolean isAuthenticated) {
              mAuthStateTask = null;
              setUIMode(isAuthenticated ? UIMode.PANEL : UIMode.AUTH);
            }
          };
      mAuthStateTask.execute();
    } else {
      setUIMode(UIMode.PANEL);
    }
  }