Skip to content

Commit

Permalink
Make sure no ads are displayed when the donation app is installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiaraujo committed May 15, 2015
1 parent 05203cb commit 7fd2d34
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions android/src/org/exobel/routerkeygen/AdsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ private AdsUtils() {
private static final String STARTUP_LAST_SHOWN_COUNT = "STARTUP_LAST_SHOWN_COUNT";

public static MMAdView loadAdIfNeeded(Activity activity) {
boolean app_installed = checkDonation(activity);
// Create the adView
MMAdView adView = new MMAdView(activity);
// Set your apid
adView.setApid(BANNER_APID);
if (app_installed) {
if (checkDonation(activity)) {
final View vg = activity.findViewById(R.id.adBannerRelativeLayout);
((ViewGroup) vg.getParent()).removeView(adView);
return null;
}
// Set your apid
adView.setApid(BANNER_APID);
adView.setMMRequest(getAdRequest(activity));
// (Highly Recommended) Set the id to preserve your ad on
// configuration changes. Save Battery!
Expand Down Expand Up @@ -129,9 +128,11 @@ public static void displayConnectInterstitial(Activity activity) {

private static final int COUNTER_LIMIT = 5;

private static void displayInterstitial(Activity activity, final String apid,
final String countKey, final String timeKey) {

private static void displayInterstitial(Activity activity,
final String apid, final String countKey, final String timeKey) {
if (checkDonation(activity)) {
return; // NO ADS!
}
final SharedPreferences mPrefs = PreferenceManager
.getDefaultSharedPreferences(activity);
final SharedPreferences.Editor editor = mPrefs.edit();
Expand Down

0 comments on commit 7fd2d34

Please sign in to comment.