Created
February 15, 2013 16:42
-
-
Save erwan/4961610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mopub.mobileads; | |
import android.content.Context; | |
import android.util.Log; | |
import com.appbrain.AppBrainBanner; | |
import com.appbrain.BannerListener; | |
import java.util.Map; | |
public class AppbrainAppliftAdapter extends CustomEventBanner implements BannerListener { | |
private AppBrainBanner mBanner; | |
private Listener mListener; | |
@Override | |
public void loadAd(Context context, Listener customEventBannerListener, Map<String, Object> localExtras, Map<String, String> serverExtras) { | |
Log.d("mopub", "Load AppBrain Ad."); | |
mListener = customEventBannerListener; | |
mBanner = new AppBrainBanner(context); | |
mBanner.setBannerListener(this); | |
mBanner.requestAd(); | |
} | |
@Override | |
public void onInvalidate() { | |
if (mBanner != null) { | |
mBanner.invalidate(); | |
} | |
} | |
//////////////////////////////////////////////////////////////////////////////////////////////// | |
@Override | |
public void onClick() { | |
Log.d("mopub", "Register click for AppBrain AppLift."); | |
mListener.onClick(); | |
} | |
@Override | |
public void onAdRequestDone(boolean adAvailable) { | |
if (adAvailable) { | |
Log.d("mopub", "AppBrain AppLift loaded."); | |
mListener.setAdContentView(mBanner); | |
mListener.onAdLoaded(); | |
} else { | |
Log.d("mopub", "AppBrain AppLift failed. Trying an other."); | |
mListener.onAdFailed(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment