Skip to content

Instantly share code, notes, and snippets.

@erwan
Created February 15, 2013 16:42
Show Gist options
  • Save erwan/4961610 to your computer and use it in GitHub Desktop.
Save erwan/4961610 to your computer and use it in GitHub Desktop.
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