Created
March 15, 2016 15:12
-
-
Save tsiougkosn/5c0aed278c0735c9d60e 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
avocarrotCustom = new AvocarrotCustom(this, BuildConfig.AvocarrotApiKey, BuildConfig.PLACEMENT_CUSTOM); | |
avocarrotCustom.setSandbox(BuildConfig.SANDBOX); | |
avocarrotCustom.setLogger(true, "ALL"); | |
avocarrotCustom.setListener(new AvocarrotCustomListener() { | |
@Override | |
public void onAdLoaded(List<CustomModel> ads) { | |
super.onAdLoaded(ads); | |
if ((ads==null)||(ads.size()==0)) | |
return; | |
adview.setVisibility(View.VISIBLE); | |
final CustomModel ad = ads.get(0); | |
VideoView videoView = (VideoView) adview.findViewById(R.id.avo_native_video); | |
ImageView imageView = (ImageView) adview.findViewById(R.id.avo_native_image); | |
ImageView adIcon = (ImageView) adview.findViewById(R.id.avo_native_icon); | |
TextView adDescription = (TextView) adview.findViewById(R.id.avo_native_description); | |
TextView headline = (TextView) adview.findViewById(R.id.avo_native_headline); | |
Button adButton = (Button) adview.findViewById(R.id.avo_cta_button); | |
headline.setText(ad.getTitle()); | |
adDescription.setText(ad.getDescription()); | |
adButton.setText(ad.getCTAText()); | |
avocarrotCustom.loadMedia(ad, imageView, videoView); | |
avocarrotCustom.loadIcon(ad, adIcon); | |
// Show ad on click | |
adButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
avocarrotCustom.handleClick(ad); | |
} | |
}); | |
avocarrotCustom.bindView(ad, adview); | |
} | |
}); | |
avocarrotCustom.loadAd(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment