Created
August 19, 2015 07:57
-
-
Save vipulyaara/b15b79d9624c39fa593b to your computer and use it in GitHub Desktop.
Avocarrot code
This file contains hidden or 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
private void displayNativeAd(List<CustomModel> ads) { | |
final CustomModel ad = ads.get(0); | |
adHeadlineView.setText(ad.getTitle()); | |
adBodyTextView.setText(ad.getDescription()); | |
adCallToAction.setText(ad.getCTAText()); | |
// Load the advertisement's creative into your ImageView | |
avocarrotCustom.loadImage(ad, adIcon); | |
if (!ad.getTitle().equals(previousAdHeadline)) { | |
previousAdHeadline = ad.getTitle().toString(); | |
avocarrotCustom.bindView(ad, adView); | |
// Set click listener | |
adCallToAction.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
avocarrotCustom.handleClick(ad); | |
} | |
}); | |
} | |
if (isActivityRunning) { | |
new CountDownTimer(5000, 1000) { | |
@Override | |
public void onTick(long millisUntilFinished) { | |
} | |
@Override | |
public void onFinish() { | |
avocarrotCustom.loadAd(); | |
} | |
}.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment