Skip to content

Commit

Permalink
add getAdapterCalculator() and setAdapterCalculator to all supported …
Browse files Browse the repository at this point in the history
…adapter wrappers. It allows you to inject your implementation of ads' indices logic etc. You could simply inherit from class AdmobAdapterCalculator.java and inject the existance of your class to the Adapter Wrapper.
  • Loading branch information
kot331107 authored and kot331107 committed Jul 18, 2016
1 parent 0f4c973 commit f89fb62
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 16 deletions.
16 changes: 8 additions & 8 deletions admobadapter/admobadapter.iml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
Expand All @@ -81,6 +73,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

public class AdmobAdapterCalculator {

private AdmobAdapterWrapperInterface mAdmobAdapter;
protected AdmobAdapterWrapperInterface mAdmobAdapter;

public AdmobAdapterCalculator(AdmobAdapterWrapperInterface admobAdapter){
mAdmobAdapter = admobAdapter;
}

private int mNoOfDataBetweenAds;
protected int mNoOfDataBetweenAds;
/*
* Gets the number of your data items between ad blocks, by default it equals to 10.
* You should set it according to the Admob's policies and rules which says not to
Expand All @@ -48,7 +48,7 @@ public void setNoOfDataBetweenAds(int mNoOfDataBetweenAds) {
this.mNoOfDataBetweenAds = mNoOfDataBetweenAds;
}

private int firstAdIndex = 0;
protected int firstAdIndex = 0;

public int getFirstAdIndex() {
return firstAdIndex;
Expand All @@ -61,7 +61,7 @@ public void setFirstAdIndex(int firstAdIndex) {
this.firstAdIndex = firstAdIndex;
}

private int mLimitOfAds;
protected int mLimitOfAds;

/*
* Gets the max count of ad blocks per dataset, by default it equals to 3 (according to the Admob's policies and rules)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@ public void onInvalidated() {

AdmobFetcher adFetcher;
Context mContext;
private final AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
private AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
/*
* Gets an object which incapsulates transformation of the source and ad blocks indices
*/
public AdmobAdapterCalculator getAdapterCalculator(){return AdapterCalculator;}
/*
* Injects an object which incapsulates transformation of the source and ad blocks indices. You could override calculations
* by inheritance of AdmobAdapterCalculator class
*/
public void setAdapterCalculator(AdmobAdapterCalculator adapterCalculatordmob){AdapterCalculator = adapterCalculatordmob;}


private static final int VIEW_TYPE_COUNT = 2;
private static final int VIEW_TYPE_AD_CONTENT = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ public void onChanged() {

AdmobFetcher adFetcher;
Context mContext;
private final AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
private AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
/*
* Gets an object which incapsulates transformation of the source and ad blocks indices
*/
public AdmobAdapterCalculator getAdapterCalculator(){return AdapterCalculator;}
/*
* Injects an object which incapsulates transformation of the source and ad blocks indices. You could override calculations
* by inheritance of AdmobAdapterCalculator class
*/
public void setAdapterCalculator(AdmobAdapterCalculator adapterCalculatordmob){AdapterCalculator = adapterCalculatordmob;}


private static final int VIEW_TYPE_COUNT = 2;
private static final int VIEW_TYPE_AD_CONTENT = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ public void onInvalidated() {

AdmobFetcherExpress adFetcher;
Context mContext;
private final AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
private AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
/*
* Gets an object which incapsulates transformation of the source and ad blocks indices
*/
public AdmobAdapterCalculator getAdapterCalculator(){return AdapterCalculator;}
/*
* Injects an object which incapsulates transformation of the source and ad blocks indices. You could override calculations
* by inheritance of AdmobAdapterCalculator class
*/
public void setAdapterCalculator(AdmobAdapterCalculator adapterCalculatordmob){AdapterCalculator = adapterCalculatordmob;}

private static final int VIEW_TYPE_COUNT = 1;
private static final int VIEW_TYPE_AD_EXPRESS = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,17 @@ public void onChanged() {

AdmobFetcherExpress adFetcher;
Context mContext;
private final AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
private AdmobAdapterCalculator AdapterCalculator = new AdmobAdapterCalculator(this);
/*
* Gets an object which incapsulates transformation of the source and ad blocks indices
*/
public AdmobAdapterCalculator getAdapterCalculator(){return AdapterCalculator;}
/*
* Injects an object which incapsulates transformation of the source and ad blocks indices. You could override calculations
* by inheritance of AdmobAdapterCalculator class
*/
public void setAdapterCalculator(AdmobAdapterCalculator adapterCalculatordmob){AdapterCalculator = adapterCalculatordmob;}


private static final int VIEW_TYPE_AD_EXPRESS = 1;

Expand Down

0 comments on commit f89fb62

Please sign in to comment.