emi-indo-cordova-plugin-admob 1.5.9 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/www/js/bannerAd.js +1 -1
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/emiAdmobPlugin.kt +15 -11
@@ -20,7 +20,7 @@ function loadBanner() {
|
|
20
20
|
cordova.plugins.emiAdmobPlugin.loadBannerAd({
|
21
21
|
adUnitId: Banner_ID, //Banner_ID,
|
22
22
|
position: "bottom-center",
|
23
|
-
size: "
|
23
|
+
size: "banner", // autoResize: true (only responsive_adaptive)
|
24
24
|
collapsible: "bottom", // position: top | bottom (disable, empty string)
|
25
25
|
autoResize: true, // default false
|
26
26
|
autoShow: true, // default false
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
2
2
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
id="emi-indo-cordova-plugin-admob" version="1.
|
3
|
+
id="emi-indo-cordova-plugin-admob" version="1.6.0">
|
4
4
|
|
5
5
|
<name>emiAdmobPlugin</name>
|
6
6
|
<description>Cordova Plugin Admob Android IOS</description>
|
@@ -161,6 +161,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
161
161
|
if(mActivity != null) {
|
162
162
|
mActivity!!.runOnUiThread {
|
163
163
|
try {
|
164
|
+
bannerOverlappingToZero()
|
164
165
|
if (bannerViewLayout != null && bannerView != null) {
|
165
166
|
val parentView = bannerViewLayout!!.parent as ViewGroup
|
166
167
|
parentView.removeView(bannerViewLayout)
|
@@ -169,22 +170,17 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
169
170
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
170
171
|
FrameLayout.LayoutParams.WRAP_CONTENT
|
171
172
|
)
|
172
|
-
val
|
173
|
-
|
174
|
-
|
175
|
-
rootView.addView(bannerViewLayout, params)
|
176
|
-
} else {
|
177
|
-
mActivity!!.addContentView(bannerViewLayout, params)
|
178
|
-
}
|
179
|
-
bannerView = AdView(mContext!!)
|
173
|
+
val decorView = mActivity!!.window.decorView as ViewGroup
|
174
|
+
decorView.addView(bannerViewLayout, params)
|
175
|
+
bannerView = AdView(mActivity!!)
|
180
176
|
setBannerPosition(this.isPosition)
|
181
177
|
setBannerSiz(this.isSize)
|
182
178
|
bannerView!!.adUnitId = bannerAdUnitId!!
|
183
179
|
bannerView!!.adListener = bannerAdListener
|
184
180
|
bannerView!!.loadAd(buildAdRequest())
|
185
|
-
adjustWebViewForBanner(this.isPosition)
|
186
181
|
bannerViewLayout!!.addView(bannerView)
|
187
182
|
bannerViewLayout!!.bringToFront()
|
183
|
+
bannerOverlappingToZero()
|
188
184
|
}
|
189
185
|
} catch (e: Exception) {
|
190
186
|
PUBLIC_CALLBACKS!!.error("Error adjusting banner size: " + e.message)
|
@@ -195,9 +191,15 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
195
191
|
|
196
192
|
when (orientation) {
|
197
193
|
Configuration.ORIENTATION_PORTRAIT -> {
|
194
|
+
if (isOverlapping) {
|
195
|
+
bannerOverlapping()
|
196
|
+
}
|
198
197
|
cWebView!!.loadUrl("javascript:cordova.fireDocumentEvent('on.orientation.portrait');")
|
199
198
|
}
|
200
199
|
Configuration.ORIENTATION_LANDSCAPE -> {
|
200
|
+
if (isOverlapping) {
|
201
|
+
bannerOverlapping()
|
202
|
+
}
|
201
203
|
cWebView!!.loadUrl("javascript:cordova.fireDocumentEvent('on.orientation.landscape');")
|
202
204
|
}
|
203
205
|
Configuration.ORIENTATION_UNDEFINED -> {
|
@@ -1071,6 +1073,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1071
1073
|
try {
|
1072
1074
|
bannerView!!.visibility = View.VISIBLE
|
1073
1075
|
bannerView!!.resume()
|
1076
|
+
// bannerOverlappingToZero()
|
1074
1077
|
|
1075
1078
|
if (isOverlapping) {
|
1076
1079
|
bannerOverlapping()
|
@@ -1362,6 +1365,8 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1362
1365
|
put("cause", adError.cause?.toString() ?: "null")
|
1363
1366
|
}
|
1364
1367
|
|
1368
|
+
bannerOverlappingToZero()
|
1369
|
+
|
1365
1370
|
if (bannerViewLayout != null && bannerView != null) {
|
1366
1371
|
bannerViewLayout!!.removeView(bannerView)
|
1367
1372
|
bannerView!!.destroy()
|
@@ -1439,7 +1444,6 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1439
1444
|
|
1440
1445
|
|
1441
1446
|
|
1442
|
-
|
1443
1447
|
private fun bannerOverlappingToZero() {
|
1444
1448
|
if (bannerView != null && mActivity != null && cWebView != null) {
|
1445
1449
|
mActivity!!.runOnUiThread {
|
@@ -1485,7 +1489,7 @@ class emiAdmobPlugin : CordovaPlugin() {
|
|
1485
1489
|
val screenHeightInPx = displayMetrics.heightPixels
|
1486
1490
|
|
1487
1491
|
// Adjust the WebView height to account for the banner ad
|
1488
|
-
val webViewHeight = screenHeightInPx - (adSize.height+overlappingHeight)
|
1492
|
+
val webViewHeight = screenHeightInPx - (adSize.height + overlappingHeight)
|
1489
1493
|
val layoutParams = cWebView!!.view.layoutParams
|
1490
1494
|
layoutParams.height = webViewHeight
|
1491
1495
|
cWebView!!.view.layoutParams = layoutParams
|