@Override
 public void onWindowFocusChanged(boolean hasFocus) {
   super.onWindowFocusChanged(hasFocus);
   if (hasFocus && !isContentStarted) {
     adActivityContentWrapper.startContent();
     isContentStarted = true;
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    //        TapItLog.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);

    // defaults, override in AdActivityContentWrapper.getContentView(...)
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

    Bundle extras = getIntent().getExtras();
    Sharable<AdActivityContentWrapper> wrapperSharable =
        extras.getParcelable(CONTENT_WRAPPER_EXTRA);
    adActivityContentWrapper = wrapperSharable.obj();

    contentView = new InterstitialBaseView(this);
    contentView.setCloseButtonOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (adActivityContentWrapper.shouldClose()) {
              close();
            }
          }
        });

    View wrapperView = adActivityContentWrapper.getContentView(this);
    ViewGroup.LayoutParams lp = adActivityContentWrapper.getContentLayoutParams();
    contentView.addView(wrapperView, lp);

    setContentView(contentView);
  }
 @Override
 public void onBackPressed() {
   // don't call super, we'll handle in close(), if allowed
   //        TapItLog.d(TAG, "TapItAdActivity.onBackPressed");
   if (adActivityContentWrapper.shouldClose()) {
     close();
   }
 }
 /**
  * Used to programmatically close TapItAdActivity... example usage includes a close button, or
  * when a video ad finishes playing.
  */
 public void close() {
   adActivityContentWrapper.stopContent();
   finish();
   adActivityContentWrapper.done();
 }