Skip to content

Commit

Permalink
update 2.1.7, add destroy method and banner view
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamplier committed Nov 8, 2017
1 parent cf6fbc3 commit e6408a6
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
Binary file not shown.
Binary file added libs/Android/appodeal-banner-view-2.3.0.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion plugin.xml
Expand Up @@ -225,11 +225,12 @@
</config-file>
<source-file src="src/android/AppodealPlugin.java" target-dir="src/com/appodeal/plugin" />
<framework src="src/android/dependency_fix.gradle" custom="true" type="gradleReference" />
<source-file src="libs/Android/appodeal-2.1.4.jar" target-dir="libs" />
<source-file src="libs/Android/appodeal-2.1.7.jar" target-dir="libs" />
<source-file src="libs/Android/inmobi-6.2.3.jar" target-dir="libs" />
<source-file src="libs/Android/picasso-2.5.2.jar" target-dir="libs" />
<source-file src="libs/Android/yandex-metrica-2.73.jar" target-dir="libs" />
<source-file src="libs/Android/startapp-3.6.2.jar" target-dir="libs" />
<source-file src="libs/Android/appodeal-banner-view-2.3.0.jar" target-dir="libs" />
<framework src="libs/Android/adcolony" custom="true" />
</platform>

Expand Down
32 changes: 30 additions & 2 deletions src/android/AppodealPlugin.java
Expand Up @@ -19,6 +19,7 @@
import com.appodeal.ads.UserSettings;
import com.appodeal.ads.BannerView;
import com.appodeal.ads.utils.Log;
import com.appodeal.unity.AppodealUnityBannerView;

import org.json.JSONObject;

Expand All @@ -30,9 +31,11 @@ public class AppodealPlugin extends CordovaPlugin {

private static final String ACTION_SHOW = "show";
private static final String ACTION_SHOW_WITH_PLACEMENT = "showWithPlacement";
private static final String ACTION_SHOW_BANNER_VIEW = "showBannerView";
private static final String ACTION_IS_LOADED = "isLoaded";
private static final String ACTION_CACHE = "cache";
private static final String ACTION_HIDE = "hide";
private static final String ACTION_DESTROY = "destroy";
private static final String ACTION_SET_AUTO_CACHE = "setAutoCache";
private static final String ACTION_IS_PRECACHE = "isPrecache";

Expand Down Expand Up @@ -152,6 +155,21 @@ public void run() {
}
});
return true;
} else if (action.equals(ACTION_SHOW_BANNER_VIEW)) {
final int xAxis = args.getInt(0);
final int yAxis = args.getInt(1);
final String placement = args.getString(2);
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if(placement != null) {
AppodealUnityBannerView.getInstance().showBannerView(cordova.getActivity(), xAxis, yAxis, placement);
} else {
AppodealUnityBannerView.getInstance().showBannerView(cordova.getActivity(), xAxis, yAxis, "");
}
}
});
return true;
} else if (action.equals(ACTION_IS_LOADED)) {
final int adType = args.getInt(0);
cordova.getActivity().runOnUiThread(new Runnable() {
Expand Down Expand Up @@ -180,10 +198,20 @@ public void run() {
@Override
public void run() {
Appodeal.hide(cordova.getActivity(), getAdType(adType));
AppodealUnityBannerView.getInstance().hideBannerView(cordova.getActivity());
}
});
return true;
} else if (action.equals(ACTION_SET_AUTO_CACHE)) {
} else if(action.equals(ACTION_DESTROY)){
final int adType = args.getInt(0);
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Appodeal.destroy(adType);
}
});
return true;
} else if (action.equals(ACTION_SET_AUTO_CACHE)) {
final int adType = args.getInt(0);
final boolean autoCache = args.getBoolean(1);
cordova.getActivity().runOnUiThread(new Runnable() {
Expand Down Expand Up @@ -358,7 +386,7 @@ public void run() {
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run(){
Appodeal.setFramework("cordova", pluginVersion);
Appodeal.setFramework("cordova", pluginVersion, false, false);
}
});
return true;
Expand Down
16 changes: 14 additions & 2 deletions www/appodeal.js
Expand Up @@ -7,10 +7,14 @@ Appodeal.INTERSTITIAL = 3;
Appodeal.BANNER = 4;
Appodeal.BANNER_BOTTOM = 8;
Appodeal.BANNER_TOP = 16;
Appodeal.BANNER_VIEW = 32;
Appodeal.REWARDED_VIDEO = 128;
Appodeal.NON_SKIPPABLE_VIDEO = 256;

Appodeal.BANNER_X_SMART = 0;
Appodeal.BANNER_X_CENTER = 1;
Appodeal.BANNER_X_LEFT = 2;
Appodeal.BANNER_X_RIGHT = 3;

Appodeal.LogLevel = {
NONE: 0,
DEBUG: 1,
Expand All @@ -23,7 +27,7 @@ Appodeal.Gender = {
FEMALE: 2
};

Appodeal.pluginVersion = '3.0.1';
Appodeal.pluginVersion = '3.0.4';

Appodeal.initialize = function(appKey, adType) {
exec(null, null, "AppodealPlugin", "setPluginVersion", [Appodeal.pluginVersion]);
Expand All @@ -38,6 +42,10 @@ Appodeal.showWithPlacement = function(adType, placement, callback) {
exec(callback, null, "AppodealPlugin", "showWithPlacement", [adType, placement]);
};

Appodeal.showBannerView = function(xAxis, yAxis, placement) {
exec(null, null, "AppodealPlugin", "showBannerView", [xAxis, yAxis, placement]);
};

Appodeal.isLoaded = function(adType, callback) {
exec(callback, null, "AppodealPlugin", "isLoaded", [adType]);
};
Expand All @@ -50,6 +58,10 @@ Appodeal.hide = function(adType) {
exec(null, null, "AppodealPlugin", "hide", [adType]);
};

Appodeal.destroy = function(adType) {
exec(null, null, "AppodealPlugin", "destroy", [adType]);
}

Appodeal.setAutoCache = function(adType, autoCache) {
exec(null, null, "AppodealPlugin", "setAutoCache", [adType, autoCache]);
};
Expand Down

0 comments on commit e6408a6

Please sign in to comment.