Beispiel #1
0
  @Override
  public void onDestroy() {
    if (adManager != null) {
      adManager.destroy();
      adManager = null;
    }

    loadingView = null;

    super.onDestroy();
  }
Beispiel #2
0
  /**
   * Manage the ads visibility in the layout
   *
   * @param ad The view container where ads will be displayed
   * @param enabled true to enable ads, false to remove from layout.
   */
  protected void manageAdView(ViewGroup adContainer, boolean enabled) {
    if (adContainer != null) {
      if (adManager != null) {
        adManager.destroy();
      }

      if (enabled) {
        adManager = new BannerAdManager(this, adContainer);
      } else {
        ((ViewGroup) adContainer.getParent()).removeView(adContainer);
      }
    }
  }