@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(); }
public void showCloseNotice() { closeNoticeLayout.setVisibility(View.VISIBLE); isCloseNoticeShown = true; if (videoPlayerInterface != null) { videoPlayerInterface.pauseVideo(); } }
public void reportVideoStartEvent() { if (videoPlayerInterface != null && videoPlayerInterface.isVideoPlaying() && !startAlreadyReported) { startAlreadyReported = true; videoComponentCallbacks.onVideoStartEvent(appOffer.getId()); } }
private void hideControlsVisibility() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { controlsLayout.setAlpha(0.75f); } ctaVisible = false; if (videoPlayerInterface != null) { videoPlayerInterface.hideMediaController(); } }
public boolean replayVideo() { watchedAlreadyReported = false; startAlreadyReported = false; if (videoPlayerInterface == null) { setup( appOffer, onOfferClickListener, onVideoRewardGeneratedListener, appOfferWithResult, videoComponentCallbacks, gameWallCallback, immersiveMode, false); } return videoPlayerInterface != null && videoPlayerInterface.replayVideo(); }
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); } }
public void remove() { if (videoPlayerInterface != null) { videoPlayerInterface.stopVideo(); } }
public void showVideo() { if (videoPlayerInterface != null) { videoPlayerInterface.showVideo(); } }
public boolean isVideoPlaying() { if (videoPlayerInterface != null) { return videoPlayerInterface.isVideoPlaying(); } return false; }
private int getProgress() { if (videoPlayerInterface != null) { return videoPlayerInterface.getProgress(); } return 0; }
public void onResume() { if (videoPlayerInterface != null) { videoPlayerInterface.resumeVideo(); } }
public void onPause() { if (videoPlayerInterface != null) { videoPlayerInterface.pauseVideo(); } }