@Override public void onDismissScreen() { Log.d("PunchBoxAd", "AdHandler.onDismissScreen"); if (adType.compareToIgnoreCase("banner") != 0) { remove(); listener.onDismissScreen(); } }
private void removeBannerAd() { if (bannerAd != null) { bannerAd.setAdListener(null); ViewGroup bannerAdParent = (ViewGroup) bannerAd.getParent(); ViewGroup group = (ViewGroup) bannerAdParent.getParent(); group.removeView(bannerAdParent); bannerAd = null; listener.onDismissScreen(); } }
@Override public void onPresentScreen() { Log.d("PunchBoxAd", "AdHandler.onPresentScreen"); if (adType.compareToIgnoreCase("banner") == 0) { ViewGroup group = (ViewGroup) bannerAd.getParent().getParent(); group.findViewById(Cocos2dxActivity.GLVIEW_ID).requestFocus(); } listener.onPresentScreen(); }
@Override public void onReceiveAd() { Log.d("PunchBoxAd", "AdHandler.onReceiveAd"); if (adType.compareToIgnoreCase("moregame") == 0 && moreGameAd != null) { try { moreGameAd.showFloatView(context, 1.0, adId); } catch (PBException e) { e.printStackTrace(); } } else if (adType.compareToIgnoreCase("interstitial") == 0 && interstitialAd != null) { try { interstitialAd.showFloatView(context, 1.0, adId); } catch (PBException e) { e.printStackTrace(); } } listener.onReceiveAd(); }
@Override public void onFailedToReceiveAd(PBException arg0) { Log.d("PunchBoxAd", "AdHandler.onFailedToReceiveAd"); listener.onFailedToReceiveAd(arg0); }