Skip to content

Commit

Permalink
fix : collpase banner and api model changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FenilInfyom committed Mar 18, 2024
1 parent 71b2e87 commit c2cc764
Show file tree
Hide file tree
Showing 24 changed files with 269 additions and 30 deletions.
Binary file modified .gradle/8.4/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/8.4/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.4/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/8.4/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/8.4/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/8.4/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle/config.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Fri Mar 15 12:35:47 IST 2024
java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
#Mon Mar 18 14:30:39 IST 2024
java.home=/Users/mac/Documents/Android Studio.app/Contents/jbr/Contents/Home
Binary file modified .gradle/file-system.probe
Binary file not shown.
9 changes: 9 additions & 0 deletions .idea/ads-sdk.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Step 1. Add the JitPack repository to your build file
==> FOR SIMPLE ADS

implementation 'com.github.InfyOmLabs:ads-sdk:1.6.5'
implementation 'com.github.InfyOmLabs:ads-sdk:1.6.6'
==> Pre Interstitital Ads

Expand Down
27 changes: 27 additions & 0 deletions adsSdk/src/main/java/com/infyom/adssdk/AdsAccountProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class AdsAccountProvider {
static final String KEY_BANNER_ADS1 = "key_banner_ads1";
static final String KEY_BANNER_ADS2 = "key_banner_ads2";
static final String KEY_BANNER_ADS3 = "key_banner_ads3";
static final String KEY_COLLAPSE_BANNER_ADS1 = "key_collapse_banner_ads1";
static final String KEY_COLLAPSE_BANNER_ADS2 = "key_collapse_banner_ads2";
static final String KEY_COLLAPSE_BANNER_ADS3 = "key_collapse_banner_ads3";
static final String KEY_INTERSTITIAL_ADS1 = "key_inter_ads1";
static final String KEY_INTERSTITIAL_ADS2 = "key_inter_ads2";
static final String KEY_INTERSTITIAL_ADS3 = "key_inter_ads3";
Expand Down Expand Up @@ -296,4 +299,28 @@ public int getNativeAdsTime() {
return sharedPreferences.getInt(KEY_NATIVE_ADS_TIME, 0);
}

public void setCollapseBanner1(String bannerId) {
sharedPreferences.edit().putString(KEY_COLLAPSE_BANNER_ADS1, bannerId ).apply();
}

public String getCollapseBanner1() {
return sharedPreferences.getString(KEY_COLLAPSE_BANNER_ADS1, "0Ab" );
}


public void setCollapseBanner2(String bannerId) {
sharedPreferences.edit().putString(KEY_COLLAPSE_BANNER_ADS2, bannerId ).apply();
}

public String getCollapseBanner2() {
return sharedPreferences.getString(KEY_COLLAPSE_BANNER_ADS2, "0Ab" );
}

public void setCollapseBanner3(String bannerId) {
sharedPreferences.edit().putString(KEY_COLLAPSE_BANNER_ADS3, bannerId ).apply();
}

public String getCollapseBanner3() {
return sharedPreferences.getString(KEY_COLLAPSE_BANNER_ADS3, "0Ab" );
}
}
45 changes: 40 additions & 5 deletions adsSdk/src/main/java/com/infyom/adssdk/InfyOmAds.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.google.android.gms.ads.MobileAds;
import com.infyom.adssdk.adUtils.banner.AdBanner;
import com.infyom.adssdk.adUtils.banner.BannerUtilsFb;
import com.infyom.adssdk.adUtils.banner.CollapseAdBanner;
import com.infyom.adssdk.adUtils.inter.InterstitialUtils;
import com.infyom.adssdk.adUtils.inter.InterstitialUtilsFb;
import com.infyom.adssdk.adUtils.nativeAd.NativeUtils;
Expand Down Expand Up @@ -41,6 +42,11 @@ public enum AdTemplate {
NATIVE_40
}

public enum BannerAdTemplate {
COLLAPSE_TOP,
COLLAPSE_BOTTOM
}

public static boolean isClicked = false;
static AdsAccountProvider myPref;

Expand Down Expand Up @@ -126,7 +132,33 @@ public static void showInterstitial(int admob, Context context, Interstitial lis
}
}

public static void showBanner(Context context, RelativeLayout bannerContainer,View space, int admob,boolean isCollaps) {
public static void showBanner(Context context, RelativeLayout bannerContainer,View space, int admob) {


if (Constants.isBannerClicked) {
return;
}

AdsAccountProvider myPref = new AdsAccountProvider(context);

String adsType;

if (admob == 1) {
adsType = myPref.getFirstAdsType();
} else if (admob == 2) {
adsType = myPref.getSecondAdsType();
} else {
adsType = myPref.getThirdAdsType();
}

if ((myPref.getAdsType().equals(ADMOB) && !adsType.equals(FB)) || adsType.equals(ADMOB)) {
AdBanner.showBanner(context, bannerContainer, space,admob);
} else if (myPref.getAdsType().equals(FB) || adsType.equals(FB)) {
BannerUtilsFb.loadFbBanner(context, bannerContainer,space);
}
}

public static void showCollapseBanner(Context context, RelativeLayout bannerContainer,View space, int admob,BannerAdTemplate bannerAdTemplate) {


if (Constants.isBannerClicked) {
Expand All @@ -146,7 +178,7 @@ public static void showBanner(Context context, RelativeLayout bannerContainer,Vi
}

if ((myPref.getAdsType().equals(ADMOB) && !adsType.equals(FB)) || adsType.equals(ADMOB)) {
AdBanner.showBanner(context, bannerContainer, space,admob,isCollaps);
CollapseAdBanner.showBanner(context, bannerContainer, space,admob,bannerAdTemplate);
} else if (myPref.getAdsType().equals(FB) || adsType.equals(FB)) {
BannerUtilsFb.loadFbBanner(context, bannerContainer,space);
}
Expand Down Expand Up @@ -207,9 +239,12 @@ public static void enableTestMode(Context context) {
myPref = new AdsAccountProvider(context);

myPref.setOpenAds("/6499/example/app-open");
myPref.setBannerAds1("ca-app-pub-3940256099942544/2014213617");
myPref.setBannerAds2("ca-app-pub-3940256099942544/2014213617");
myPref.setBannerAds3("ca-app-pub-3940256099942544/2014213617");
myPref.setBannerAds1("/6499/example/banner");
myPref.setBannerAds2("/6499/example/banner");
myPref.setBannerAds3("/6499/example/banner");
myPref.setCollapseBanner1("ca-app-pub-3940256099942544/2014213617");
myPref.setCollapseBanner2("ca-app-pub-3940256099942544/2014213617");
myPref.setCollapseBanner3("ca-app-pub-3940256099942544/2014213617");
myPref.setInterAds1("/6499/example/interstitial");
myPref.setInterAds2("/6499/example/interstitial");
myPref.setInterAds3("/6499/example/interstitial");
Expand Down
40 changes: 40 additions & 0 deletions adsSdk/src/main/java/com/infyom/adssdk/adModel/Google.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class Google {
@SerializedName("banner")
@Expose
private String banner;
@SerializedName("google_collapsible_banner")
@Expose
private String collapsibleBanner;
@SerializedName("rewarded")
@Expose
private String rewarded;
Expand All @@ -35,6 +38,9 @@ public class Google {
@SerializedName("banner_second")
@Expose
private String bannerSecond;
@SerializedName("google_collapsible_banner_second")
@Expose
private String collapsibleBannerSecond;
@SerializedName("rewarded_second")
@Expose
private String rewardedSecond;
Expand All @@ -53,6 +59,9 @@ public class Google {
@SerializedName("banner_third")
@Expose
private String bannerThird;
@SerializedName("google_collapsible_banner_third")
@Expose
private String collapsibleBannerThird;
@SerializedName("rewarded_third")
@Expose
private String rewardedThird;
Expand Down Expand Up @@ -227,4 +236,35 @@ public void setPlaceAdd(Integer placeAdd) {
this.placeAdd = placeAdd;
}

public String getCollapsibleBanner() {
return collapsibleBanner;
}

public void setCollapsibleBanner(String collapsibleBanner) {
this.collapsibleBanner = collapsibleBanner;
}

public String getCollapsibleBannerSecond() {
return collapsibleBannerSecond;
}

public void setCollapsibleBannerSecond(String collapsibleBannerSecond) {
this.collapsibleBannerSecond = collapsibleBannerSecond;
}

public String getCollapsibleBannerThird() {
return collapsibleBannerThird;
}

public void setCollapsibleBannerThird(String collapsibleBannerThird) {
this.collapsibleBannerThird = collapsibleBannerThird;
}

public String get_native() {
return _native;
}

public void set_native(String _native) {
this._native = _native;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AdBanner {
static boolean isInitBanner = false;
static AdRequest adRequest;

public static void showBanner(Context mContext, RelativeLayout mRlBanner, View space, int mAdMobId,boolean isCollaps) {
public static void showBanner(Context mContext, RelativeLayout mRlBanner, View space, int mAdMobId) {

context = mContext;
mSpace = space;
Expand All @@ -41,11 +41,11 @@ public static void showBanner(Context mContext, RelativeLayout mRlBanner, View s
accountProvider = new AdsAccountProvider(context);
isInitBanner = true;

loadBannerAd(isCollaps);
loadBannerAd();
}


public static void loadBannerAd(boolean isCollaps) {
public static void loadBannerAd() {

if (adMobId == 1) {
mUnitId = accountProvider.getBannerAds1();
Expand Down Expand Up @@ -101,19 +101,8 @@ public void run() {
});


if(!isCollaps){
adRequest = getAdRequest();
adView.setAdSize(AdSize.BANNER);
}else {
AdSize adSize = getAdSize(context,rlBanner);
adView.setAdSize(adSize);
Bundle extras = new Bundle();
extras.putString("collapsible", "bottom");
adRequest = new AdRequest.Builder()
.addNetworkExtrasBundle( AdMobAdapter.class, extras)
.build();

}
adRequest = getAdRequest();
adView.setAdSize(AdSize.BANNER);
adView.loadAd(adRequest);
}

Expand Down
Loading

0 comments on commit c2cc764

Please sign in to comment.