Skip to content

Commit a7e2a4f

Browse files
Syncing changes from private repository
1 parent e92b0f3 commit a7e2a4f

32 files changed

+718
-17
lines changed
-26.8 KB
Binary file not shown.
Binary file not shown.
346 KB
Binary file not shown.

com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Chartboost.CSharp.Core.Unity" version="1.0.2" manuallyInstalled="true" />
4-
<package id="Chartboost.CSharp.Mediation.Unity" version="5.1.0" manuallyInstalled="true" />
4+
<package id="Chartboost.CSharp.Mediation.Unity" version="5.2.0" manuallyInstalled="true" />
55
<package id="Chartboost.CSharp.Threading.Unity" version="1.0.2" manuallyInstalled="true"/>
66
<package id="Chartboost.CSharp.Utilities.Unity" version="1.0.2" manuallyInstalled="true"/>
77
<package id="Chartboost.CSharp.Logging.Unity" version="1.1.0" manuallyInstalled="true"/>

com.chartboost.mediation.demo.upm/Packages/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
33
"com.chartboost.core": "1.0.2",
4-
"com.chartboost.mediation": "5.1.0",
4+
"com.chartboost.mediation": "5.2.0",
55
"com.chartboost.mediation.demo": "file:../../com.chartboost.mediation.demo",
66
"com.chartboost.unity.logging": "1.1.0",
77
"com.chartboost.unity.threading": "1.0.2",

com.chartboost.mediation/Android~/src/banner/BannerAdWrapper.kt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package com.chartboost.mediation.unity.banner
33

44
import android.app.Activity
55
import android.graphics.Color
6+
import android.graphics.Point
67
import android.graphics.PointF
8+
import android.os.Build
79
import android.util.DisplayMetrics
810
import android.util.Log
911
import android.util.Size
@@ -12,6 +14,7 @@ import android.view.View
1214
import android.view.ViewGroup
1315
import android.widget.FrameLayout
1416
import android.widget.RelativeLayout
17+
import androidx.annotation.RequiresApi
1518
import com.chartboost.chartboostmediationsdk.ad.ChartboostMediationBannerAdLoadListener
1619
import com.chartboost.chartboostmediationsdk.ad.ChartboostMediationBannerAdLoadRequest
1720
import com.chartboost.chartboostmediationsdk.ad.ChartboostMediationBannerAdView
@@ -263,6 +266,57 @@ class BannerAdWrapper(private val ad: ChartboostMediationBannerAdView) {
263266
}
264267
}
265268

269+
@RequiresApi(Build.VERSION_CODES.O)
270+
fun setContainerBackgroundColor(colorArray: FloatArray)
271+
{
272+
if (colorArray.size == 4) {
273+
val r = colorArray[0]
274+
val g = colorArray[1]
275+
val b = colorArray[2]
276+
val a = colorArray[3]
277+
278+
UnityLoggingBridge.log(TAG, "Setting container background color to - R: $r, G: $g, B: $b, A: $a", LogLevel.DEBUG)
279+
runTaskOnUiThread { ad.setBackgroundColor(Color.argb(a, r, g, b)) }
280+
}
281+
else {
282+
UnityLoggingBridge.log(TAG, "Invalid Color Array Length", LogLevel.DEBUG)
283+
}
284+
}
285+
286+
@RequiresApi(Build.VERSION_CODES.O)
287+
fun setAdBackgroundColor(colorArray: FloatArray) {
288+
if (colorArray.size == 4) {
289+
val r = colorArray[0]
290+
val g = colorArray[1]
291+
val b = colorArray[2]
292+
val a = colorArray[3]
293+
294+
UnityLoggingBridge.log(TAG, "Setting ad background color to - R: $r, G: $g, B: $b, A: $a", LogLevel.DEBUG)
295+
if(partnerAd == null){
296+
partnerAd = View(activity)
297+
ad.addView(partnerAd)
298+
}
299+
runTaskOnUiThread { partnerAd?.setBackgroundColor(Color.argb(a, r, g, b)) }
300+
}
301+
else {
302+
UnityLoggingBridge.log(TAG, "Invalid Color Array Length", LogLevel.DEBUG)
303+
}
304+
}
305+
306+
fun setAdRelativePosition(x: Float, y: Float){
307+
runTaskOnUiThread {
308+
partnerAd?.let {
309+
it.x = x * displayDensity
310+
it.y = y * displayDensity
311+
}
312+
}
313+
}
314+
315+
fun getAdRelativePosition(): PointF {
316+
partnerAd?.let { return PointF(it.x, it.y) }
317+
return PointF(0F,0F)
318+
}
319+
266320
private fun createBannerLayout() {
267321
if (activity == null) {
268322
UnityLoggingBridge.log(TAG, "Activity not found to create banner layout", LogLevel.WARNING)

com.chartboost.mediation/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file using the standards as defined at [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0).
33

4+
### Version 5.2.0 *(2024-11-14)*
5+
6+
Improvements:
7+
- Added a new `BannerVisualElement` API which allows creating and loading of banner ads using Unity UI Toolkit.
8+
49
### Version 5.1.0 *(2024-10-03)*
510

611
Improvements:

com.chartboost.mediation/Chartboost.CSharp.Mediation.Unity.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>Chartboost.CSharp.Mediation.Unity</id>
5-
<version>5.1.0</version>
5+
<version>5.2.0</version>
66
<title>Chartboost Mediation</title>
77
<icon>icon.png</icon>
88
<description>The Chartboost Mediation Unity SDK. Better monetization powered by bidding</description>
32.9 KB
Loading

com.chartboost.mediation/Documentation/images/create-banner-visual-element.png.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)