cordova-plugin-admob-nextgen 1.4.9 → 1.5.9
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/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -96,7 +96,9 @@ public class AdMobNextGen extends CordovaPlugin {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
if ("requestConsentInfo".equals(action)) {
|
|
99
|
-
|
|
99
|
+
cordova.getThreadPool().execute(() -> {
|
|
100
|
+
consentExecutor.requestConsentInfo(args, callbackContext);
|
|
101
|
+
});
|
|
100
102
|
return true;
|
|
101
103
|
}
|
|
102
104
|
if ("showPrivacyOptionsForm".equals(action)) {
|
|
@@ -113,7 +115,9 @@ public class AdMobNextGen extends CordovaPlugin {
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
if ("initialize".equals(action)) {
|
|
116
|
-
|
|
118
|
+
cordova.getThreadPool().execute(() -> {
|
|
119
|
+
this.initializeSDK(args, callbackContext);
|
|
120
|
+
});
|
|
117
121
|
return true;
|
|
118
122
|
}
|
|
119
123
|
|
|
@@ -313,7 +317,6 @@ public class AdMobNextGen extends CordovaPlugin {
|
|
|
313
317
|
return;
|
|
314
318
|
}
|
|
315
319
|
|
|
316
|
-
cordova.getThreadPool().execute(() -> {
|
|
317
320
|
try {
|
|
318
321
|
InitializationConfig.Builder initConfigBuilder = new InitializationConfig.Builder(appId);
|
|
319
322
|
|
|
@@ -345,7 +348,6 @@ public class AdMobNextGen extends CordovaPlugin {
|
|
|
345
348
|
} catch (Exception e) {
|
|
346
349
|
cordova.getActivity().runOnUiThread(() -> callbackContext.error(e.getMessage()));
|
|
347
350
|
}
|
|
348
|
-
});
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
private String getAppIdFromManifest() {
|
|
@@ -39,7 +39,6 @@ public class ConsentExecutor {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
public void requestConsentInfo(JSONArray args, CallbackContext callbackContext) {
|
|
42
|
-
cordova.getThreadPool().execute(() -> {
|
|
43
42
|
try {
|
|
44
43
|
JSONObject options = args.optJSONObject(0);
|
|
45
44
|
|
|
@@ -122,7 +121,6 @@ public class ConsentExecutor {
|
|
|
122
121
|
} catch (Exception e) {
|
|
123
122
|
callbackContext.error("Exception: " + e.getMessage());
|
|
124
123
|
}
|
|
125
|
-
});
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
public void getTCData(CallbackContext callbackContext) {
|
|
@@ -305,43 +305,59 @@ public class NativeExecutor {
|
|
|
305
305
|
|
|
306
306
|
newNativeAdView.setLayoutParams(params);
|
|
307
307
|
|
|
308
|
+
newNativeAdView.setBackgroundColor(Color.WHITE);
|
|
309
|
+
newNativeAdView.setElevation(8f);
|
|
310
|
+
|
|
311
|
+
newNativeAdView.setPadding((int)(10*density), (int)(10*density), (int)(10*density), (int)(10*density));
|
|
312
|
+
|
|
308
313
|
LinearLayout mainLayout = new LinearLayout(cordova.getActivity());
|
|
309
314
|
mainLayout.setOrientation(LinearLayout.VERTICAL);
|
|
310
|
-
mainLayout.setBackgroundColor(Color.WHITE);
|
|
311
|
-
mainLayout.setElevation(8f);
|
|
312
|
-
mainLayout.setPadding((int)(10*density), (int)(10*density), (int)(10*density), (int)(10*density));
|
|
313
315
|
|
|
314
316
|
LinearLayout headerLayout = new LinearLayout(cordova.getActivity());
|
|
315
317
|
headerLayout.setOrientation(LinearLayout.HORIZONTAL);
|
|
316
318
|
headerLayout.setGravity(Gravity.CENTER_VERTICAL);
|
|
317
319
|
|
|
320
|
+
headerLayout.setLayoutParams(new LinearLayout.LayoutParams(
|
|
321
|
+
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
322
|
+
|
|
318
323
|
ImageView iconView = new ImageView(cordova.getActivity());
|
|
319
324
|
if (nativeAd.getIcon() != null) {
|
|
320
325
|
iconView.setImageDrawable(nativeAd.getIcon().getDrawable());
|
|
321
|
-
|
|
326
|
+
|
|
327
|
+
LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(
|
|
328
|
+
(int)(40*density), (int)(40*density));
|
|
329
|
+
iconParams.setMargins(0, 0, (int)(8*density), 0);
|
|
330
|
+
headerLayout.addView(iconView, iconParams);
|
|
322
331
|
}
|
|
323
332
|
|
|
324
333
|
LinearLayout textContainer = new LinearLayout(cordova.getActivity());
|
|
325
334
|
textContainer.setOrientation(LinearLayout.VERTICAL);
|
|
326
|
-
|
|
335
|
+
|
|
336
|
+
LinearLayout.LayoutParams textContainerParams = new LinearLayout.LayoutParams(
|
|
337
|
+
0, ViewGroup.LayoutParams.WRAP_CONTENT, 1.0f);
|
|
327
338
|
|
|
328
339
|
TextView headlineView = new TextView(cordova.getActivity());
|
|
329
340
|
headlineView.setText(nativeAd.getHeadline());
|
|
330
341
|
headlineView.setTypeface(null, Typeface.BOLD);
|
|
331
342
|
headlineView.setTextColor(Color.BLACK);
|
|
332
343
|
headlineView.setMaxLines(1);
|
|
333
|
-
headlineView.setEllipsize(TextUtils.TruncateAt.END);
|
|
344
|
+
headlineView.setEllipsize(TextUtils.TruncateAt.END);
|
|
334
345
|
textContainer.addView(headlineView);
|
|
335
346
|
|
|
336
347
|
TextView adBadge = new TextView(cordova.getActivity());
|
|
337
348
|
adBadge.setText("Ad");
|
|
338
349
|
adBadge.setTextSize(10);
|
|
339
350
|
adBadge.setTextColor(Color.WHITE);
|
|
340
|
-
adBadge.setBackgroundColor(0xFFFCC133);
|
|
351
|
+
adBadge.setBackgroundColor(0xFFFCC133);
|
|
341
352
|
adBadge.setPadding(5, 0, 5, 0);
|
|
342
|
-
textContainer.addView(adBadge, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
343
353
|
|
|
344
|
-
|
|
354
|
+
LinearLayout.LayoutParams badgeParams = new LinearLayout.LayoutParams(
|
|
355
|
+
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
356
|
+
badgeParams.topMargin = (int)(2*density);
|
|
357
|
+
textContainer.addView(adBadge, badgeParams);
|
|
358
|
+
|
|
359
|
+
headerLayout.addView(textContainer, textContainerParams);
|
|
360
|
+
|
|
345
361
|
mainLayout.addView(headerLayout);
|
|
346
362
|
|
|
347
363
|
MediaView mediaView = new MediaView(cordova.getActivity());
|