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