Exemplo n.º 1
0
  @Override
  protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    if (videoPlayerInterface != null) {
      videoPlayerInterface.onDestroy();
    }
    videoPlayerInterface = null;
    if (controlsHandler != null) {
      controlsHandler.removeCallbacksAndMessages(null);
    }
    controlsHandler = null;
    appOffer = null;

    Drawable drawable = ctaImage.getDrawable();
    if (drawable instanceof BitmapDrawable) {
      BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
      Bitmap bitmap = bitmapDrawable.getBitmap();
      bitmap.recycle();
    }
    ctaImage.setImageDrawable(null);
    ctaImage.destroyDrawingCache();
    ctaImage = null;
    ingamewallVideoLayout.removeAllViews();
    ingamewallVideoLayout = null;
    System.gc();
  }
Exemplo n.º 2
0
 public void showCloseNotice() {
   closeNoticeLayout.setVisibility(View.VISIBLE);
   isCloseNoticeShown = true;
   if (videoPlayerInterface != null) {
     videoPlayerInterface.pauseVideo();
   }
 }
Exemplo n.º 3
0
 public void reportVideoStartEvent() {
   if (videoPlayerInterface != null
       && videoPlayerInterface.isVideoPlaying()
       && !startAlreadyReported) {
     startAlreadyReported = true;
     videoComponentCallbacks.onVideoStartEvent(appOffer.getId());
   }
 }
Exemplo n.º 4
0
 private void hideControlsVisibility() {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     controlsLayout.setAlpha(0.75f);
   }
   ctaVisible = false;
   if (videoPlayerInterface != null) {
     videoPlayerInterface.hideMediaController();
   }
 }
Exemplo n.º 5
0
 public boolean replayVideo() {
   watchedAlreadyReported = false;
   startAlreadyReported = false;
   if (videoPlayerInterface == null) {
     setup(
         appOffer,
         onOfferClickListener,
         onVideoRewardGeneratedListener,
         appOfferWithResult,
         videoComponentCallbacks,
         gameWallCallback,
         immersiveMode,
         false);
   }
   return videoPlayerInterface != null && videoPlayerInterface.replayVideo();
 }
Exemplo n.º 6
0
  private void showTimedControlsVisibility() {
    controlsLayout.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      controlsLayout.setAlpha(1f);
    }
    ctaVisible = false;
    if (videoPlayerInterface != null) {
      videoPlayerInterface.showMediaController();
    }

    if (controlsHandler != null) {
      controlsHandler.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              hideControlsVisibility();
            }
          },
          DemoUtil.TOGGLE_CONTROLS_TIME);
    }
  }
Exemplo n.º 7
0
 public void remove() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.stopVideo();
   }
 }
Exemplo n.º 8
0
 public void showVideo() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.showVideo();
   }
 }
Exemplo n.º 9
0
 public boolean isVideoPlaying() {
   if (videoPlayerInterface != null) {
     return videoPlayerInterface.isVideoPlaying();
   }
   return false;
 }
Exemplo n.º 10
0
 private int getProgress() {
   if (videoPlayerInterface != null) {
     return videoPlayerInterface.getProgress();
   }
   return 0;
 }
Exemplo n.º 11
0
 public void onResume() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.resumeVideo();
   }
 }
Exemplo n.º 12
0
 public void onPause() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.pauseVideo();
   }
 }