Ejemplo 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();
  }
Ejemplo n.º 2
0
 public void showCloseNotice() {
   closeNoticeLayout.setVisibility(View.VISIBLE);
   isCloseNoticeShown = true;
   if (videoPlayerInterface != null) {
     videoPlayerInterface.pauseVideo();
   }
 }
Ejemplo n.º 3
0
 public void reportVideoStartEvent() {
   if (videoPlayerInterface != null
       && videoPlayerInterface.isVideoPlaying()
       && !startAlreadyReported) {
     startAlreadyReported = true;
     videoComponentCallbacks.onVideoStartEvent(appOffer.getId());
   }
 }
Ejemplo 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();
   }
 }
Ejemplo 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();
 }
Ejemplo 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);
    }
  }
Ejemplo n.º 7
0
 public void remove() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.stopVideo();
   }
 }
Ejemplo n.º 8
0
 public void showVideo() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.showVideo();
   }
 }
Ejemplo n.º 9
0
 public boolean isVideoPlaying() {
   if (videoPlayerInterface != null) {
     return videoPlayerInterface.isVideoPlaying();
   }
   return false;
 }
Ejemplo n.º 10
0
 private int getProgress() {
   if (videoPlayerInterface != null) {
     return videoPlayerInterface.getProgress();
   }
   return 0;
 }
Ejemplo n.º 11
0
 public void onResume() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.resumeVideo();
   }
 }
Ejemplo n.º 12
0
 public void onPause() {
   if (videoPlayerInterface != null) {
     videoPlayerInterface.pauseVideo();
   }
 }