From f31f1dbfe152c07d88016a0beb59e887cb27095d Mon Sep 17 00:00:00 2001 From: mobile-ads-github Date: Fri, 2 Aug 2024 19:38:12 +0300 Subject: [PATCH] Release 7.3.0 --- README.md | 4 +- .../app/build.gradle.kts | 2 +- YandexMobileAdsExample/app/build.gradle.kts | 2 +- .../ads/sample/pageobjects/HomeScreen.kt | 6 +- .../ads/sample/shared_steps/GoToSection.kt | 6 +- .../app/src/main/AndroidManifest.xml | 2 +- .../com/yandex/ads/sample/HomeActivity.kt | 6 +- .../adfoxcarousel/AdfoxCarouselAdapter.kt | 58 +++++ .../adfoxcarousel/NativeAdViewBinderHolder.kt | 40 ++++ .../adfoxcarousel/ViewPagerAutoscroller.kt | 64 ++++++ .../ViewPagerIndicatorController.kt | 68 ++++++ .../sample/adunits/AdfoxCarouselAdActivity.kt | 202 ++++++++++++++++++ .../drawable/ic_adfox_carousel_arrow_left.xml | 18 ++ .../ic_adfox_carousel_arrow_right.xml | 18 ++ ...pe_adfox_carousel_indicator_background.xml | 16 ++ .../shape_adfox_carousel_indicator_dot.xml | 15 ++ .../res/layout/activity_adfox_carousel_ad.xml | 95 ++++++++ .../main/res/layout/adfox_carousel_item.xml | 21 ++ .../app/src/main/res/values/dimens.xml | 12 +- .../app/src/main/res/values/strings.xml | 2 +- changelogs/adapter/admob/CHANGELOG.md | 5 + changelogs/adapter/ironsource/CHANGELOG.md | 5 + changelogs/mediation/adcolony/CHANGELOG.md | 5 + changelogs/mediation/applovin/CHANGELOG.md | 6 + changelogs/mediation/appnext/CHANGELOG.md | 6 + changelogs/mediation/bigoads/CHANGELOG.md | 6 + changelogs/mediation/chartboost/CHANGELOG.md | 5 + changelogs/mediation/google/CHANGELOG.md | 5 + changelogs/mediation/inmobi/CHANGELOG.md | 5 + changelogs/mediation/ironsource/CHANGELOG.md | 6 + changelogs/mediation/mintegral/CHANGELOG.md | 6 + changelogs/mediation/mytarget/CHANGELOG.md | 6 + changelogs/mediation/pangle/CHANGELOG.md | 6 + changelogs/mediation/startapp/CHANGELOG.md | 6 + changelogs/mediation/tapjoy/CHANGELOG.md | 5 + changelogs/mediation/unityads/CHANGELOG.md | 6 + changelogs/mediation/vungle/CHANGELOG.md | 5 + changelogs/mobileads-mediation/CHANGELOG.md | 20 ++ changelogs/mobileads/CHANGELOG.md | 9 + 39 files changed, 759 insertions(+), 21 deletions(-) create mode 100644 YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/AdfoxCarouselAdapter.kt create mode 100644 YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/NativeAdViewBinderHolder.kt create mode 100644 YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerAutoscroller.kt create mode 100644 YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerIndicatorController.kt create mode 100644 YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adunits/AdfoxCarouselAdActivity.kt create mode 100644 YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_left.xml create mode 100644 YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_right.xml create mode 100644 YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_background.xml create mode 100644 YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_dot.xml create mode 100644 YandexMobileAdsExample/app/src/main/res/layout/activity_adfox_carousel_ad.xml create mode 100644 YandexMobileAdsExample/app/src/main/res/layout/adfox_carousel_item.xml diff --git a/README.md b/README.md index 57800df..c202a96 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ EULA is available at [EULA website] [LICENSE] ##### Add YandexMobileAds SDK: ```sh -implementation 'com.yandex.android:mobileads:7.2.0' +implementation 'com.yandex.android:mobileads:7.3.0' ``` ##### Or you can use our library with all available mediations: @@ -31,7 +31,7 @@ implementation 'com.yandex.android:mobileads:7.2.0' dependencies { ... - implementation 'com.yandex.android:mobileads-mediation:7.2.0.0' + implementation 'com.yandex.android:mobileads-mediation:7.3.0.0' } ``` diff --git a/ThirdPartyMediationAdapterTemplate/app/build.gradle.kts b/ThirdPartyMediationAdapterTemplate/app/build.gradle.kts index fbb38ae..dca8f73 100644 --- a/ThirdPartyMediationAdapterTemplate/app/build.gradle.kts +++ b/ThirdPartyMediationAdapterTemplate/app/build.gradle.kts @@ -24,5 +24,5 @@ android { } dependencies { - implementation("com.yandex.android:mobileads:7.2.0") + implementation("com.yandex.android:mobileads:7.3.0") } diff --git a/YandexMobileAdsExample/app/build.gradle.kts b/YandexMobileAdsExample/app/build.gradle.kts index c455d6c..cf73f01 100644 --- a/YandexMobileAdsExample/app/build.gradle.kts +++ b/YandexMobileAdsExample/app/build.gradle.kts @@ -59,7 +59,7 @@ android { dependencies { // Yandex Mobile Ads SDK with mediation adapters - implementation("com.yandex.android:mobileads-mediation:7.2.0.0") + implementation("com.yandex.android:mobileads-mediation:7.3.0.0") implementation("androidx.appcompat:appcompat:1.5.1") implementation("androidx.activity:activity-ktx:1.6.1") diff --git a/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/pageobjects/HomeScreen.kt b/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/pageobjects/HomeScreen.kt index f8e18b3..50254b5 100644 --- a/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/pageobjects/HomeScreen.kt +++ b/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/pageobjects/HomeScreen.kt @@ -29,7 +29,7 @@ internal class HomeScreen( NavigationItem.Rewarded::class.java -> 3 NavigationItem.NativeTemplate::class.java -> 4 NavigationItem.CustomNative::class.java -> 5 - NavigationItem.AdfoxSlider::class.java -> 6 + NavigationItem.AdfoxCarousel::class.java -> 6 NavigationItem.InstreamBinder::class.java -> 8 NavigationItem.InstreamInRoll::class.java -> 9 NavigationItem.Policies::class.java -> 10 @@ -44,7 +44,7 @@ internal class HomeScreen( { itemType { NavigationItem.NativeTemplate(it) } itemType { NavigationItem.CustomNative(it) } - itemType { NavigationItem.AdfoxSlider(it) } + itemType { NavigationItem.AdfoxCarousel(it) } itemType { NavigationItem.Policies(it) } itemType { NavigationItem.AppOpenAd(it) } itemType { NavigationItem.Rewarded(it) } @@ -87,7 +87,7 @@ internal class HomeScreen( class CustomNative(matcher: Matcher) : NavigationItem(matcher) - class AdfoxSlider(matcher: Matcher) : NavigationItem(matcher) + class AdfoxCarousel(matcher: Matcher) : NavigationItem(matcher) class Policies(matcher: Matcher) : NavigationItem(matcher) diff --git a/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/shared_steps/GoToSection.kt b/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/shared_steps/GoToSection.kt index c90c6a1..ad74c19 100644 --- a/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/shared_steps/GoToSection.kt +++ b/YandexMobileAdsExample/app/src/androidTest/java/com/yandex/ads/sample/shared_steps/GoToSection.kt @@ -22,7 +22,7 @@ internal class GoToSection( enum class NavigationItem { NATIVE_TEMPLATE, CUSTOM_NATIVE, - ADFOX_SLIDER, + ADFOX_CAROUSEL, POLICIES, APP_OPEN_AD, REWARDED, @@ -40,7 +40,7 @@ internal class GoToSection( get() = when (this) { NavigationItem.NATIVE_TEMPLATE -> R.string.native_template_title NavigationItem.CUSTOM_NATIVE -> R.string.native_custom_title - NavigationItem.ADFOX_SLIDER -> R.string.adfox_slider_title + NavigationItem.ADFOX_CAROUSEL -> R.string.adfox_carousel_title NavigationItem.POLICIES -> R.string.policies NavigationItem.APP_OPEN_AD -> R.string.appopenad_title NavigationItem.REWARDED -> R.string.rewarded_title @@ -55,7 +55,7 @@ internal class GoToSection( get() = when (this) { NavigationItem.NATIVE_TEMPLATE -> HomeScreen.NavigationItem.NativeTemplate::class.java NavigationItem.CUSTOM_NATIVE -> HomeScreen.NavigationItem.CustomNative::class.java - NavigationItem.ADFOX_SLIDER -> HomeScreen.NavigationItem.AdfoxSlider::class.java + NavigationItem.ADFOX_CAROUSEL -> HomeScreen.NavigationItem.AdfoxCarousel::class.java NavigationItem.POLICIES -> HomeScreen.NavigationItem.Policies::class.java NavigationItem.APP_OPEN_AD -> HomeScreen.NavigationItem.AppOpenAd::class.java NavigationItem.REWARDED -> HomeScreen.NavigationItem.Rewarded::class.java diff --git a/YandexMobileAdsExample/app/src/main/AndroidManifest.xml b/YandexMobileAdsExample/app/src/main/AndroidManifest.xml index 8b00dc4..d75f454 100644 --- a/YandexMobileAdsExample/app/src/main/AndroidManifest.xml +++ b/YandexMobileAdsExample/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ android:name="com.yandex.ads.sample.adunits.CustomNativeAdActivity" android:exported="false" /> () { + + private var nativeAds: List = listOf() + + fun setData(nativeAds: List) { + this.nativeAds = nativeAds + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NativeAdViewBinderHolder { + val binding = AdfoxCarouselItemBinding.inflate( + LayoutInflater.from(parent.context), parent, false + ) + return NativeAdViewBinderHolder(binding) + } + + override fun onBindViewHolder(holder: NativeAdViewBinderHolder, position: Int) { + val nativeAd = nativeAds[position] + bindNativeAd(nativeAd, holder.nativeAdViewBinder) + } + + override fun getItemCount(): Int { + return nativeAds.size + } + + private fun bindNativeAd(nativeAd: NativeAd, viewBinder: NativeAdViewBinder) { + try { + nativeAd.bindNativeAd(viewBinder) + } catch (exception: NativeAdException) { + Log.d(VIEW_PAGER_TAG, "${exception.message}") + } + } + + companion object { + + private const val VIEW_PAGER_TAG = "ViewPagerAdapter" + } +} diff --git a/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/NativeAdViewBinderHolder.kt b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/NativeAdViewBinderHolder.kt new file mode 100644 index 0000000..8e03a3d --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/NativeAdViewBinderHolder.kt @@ -0,0 +1,40 @@ +/* + * This file is a part of the Yandex Advertising Network + * + * Version for Android (C) 2022 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://legal.yandex.com/partner_ch/ + */ + +package com.yandex.ads.sample.adfoxcarousel + +import androidx.recyclerview.widget.RecyclerView +import com.yandex.ads.sample.databinding.AdfoxCarouselItemBinding +import com.yandex.mobile.ads.nativeads.NativeAdViewBinder + +class NativeAdViewBinderHolder(binding: AdfoxCarouselItemBinding) : RecyclerView.ViewHolder(binding.root) { + + val nativeAdViewBinder: NativeAdViewBinder = createNativeAdViewBinder(binding) + + private fun createNativeAdViewBinder(binding: AdfoxCarouselItemBinding): NativeAdViewBinder { + return binding.nativeAd.run { + NativeAdViewBinder.Builder(root) + .setAgeView(age) + .setBodyView(body) + .setCallToActionView(callToAction) + .setDomainView(domain) + .setFaviconView(favicon) + .setFeedbackView(feedback) + .setIconView(icon) + .setMediaView(media) + .setPriceView(price) + .setRatingView(rating) + .setReviewCountView(reviewCount) + .setSponsoredView(sponsored) + .setTitleView(title) + .setWarningView(warning) + .build() + } + } +} diff --git a/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerAutoscroller.kt b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerAutoscroller.kt new file mode 100644 index 0000000..f563914 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerAutoscroller.kt @@ -0,0 +1,64 @@ +/* + * This file is a part of the Yandex Advertising Network + * + * Version for Android (C) 2022 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://legal.yandex.com/partner_ch/ + */ + +package com.yandex.ads.sample.adfoxcarousel + +import androidx.viewpager2.widget.ViewPager2 +import kotlinx.coroutines.Job +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch + +class ViewPagerAutoscroller(private val viewPager2: ViewPager2) { + + private val itemCount get() = viewPager2.adapter!!.itemCount + private val currentItem get() = viewPager2.currentItem + + private val scope = MainScope() + private var job: Job? = null + private var lastScroll = 0L + + fun startScrolling() { + stopScrolling() + updateLastScroll() + job = scope.launch { + while (true) { + delay(CHECK_INTERVAL_MILLIS) + if (System.currentTimeMillis() - lastScroll > SCROLL_INTERVAL_MILLIS) { + scroll() + } + } + } + } + + fun updateLastScroll() { + lastScroll = System.currentTimeMillis() + } + + fun stopScrolling() { + job?.cancel() + job = null + } + + private fun scroll() { + openNextPage() + updateLastScroll() + } + + private fun openNextPage() { + val nextItem = (currentItem + 1) % itemCount + viewPager2.setCurrentItem(nextItem, true) + } + + companion object { + + private const val SCROLL_INTERVAL_MILLIS = 5000L + private const val CHECK_INTERVAL_MILLIS = 1000L + } +} diff --git a/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerIndicatorController.kt b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerIndicatorController.kt new file mode 100644 index 0000000..b953697 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adfoxcarousel/ViewPagerIndicatorController.kt @@ -0,0 +1,68 @@ +/* + * This file is a part of the Yandex Advertising Network + * + * Version for Android (C) 2022 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://legal.yandex.com/partner_ch/ + */ + +package com.yandex.ads.sample.adfoxcarousel + +import android.widget.ImageView +import android.widget.LinearLayout +import androidx.annotation.DimenRes +import androidx.core.content.ContextCompat +import androidx.core.view.isVisible +import androidx.core.view.setMargins +import com.yandex.ads.sample.R +import kotlin.math.absoluteValue + +class ViewPagerIndicatorController(private val indicatorLayout: LinearLayout) { + private val dotsImageViews = arrayListOf() + + fun setupIndicator(pagesCount: Int, selectedPage: Int) { + indicatorLayout.removeAllViews() + dotsImageViews.clear() + + for (i in 0 until pagesCount) { + val dotView = ImageView(indicatorLayout.context).apply { + setImageDrawable(ContextCompat.getDrawable(indicatorLayout.context, R.drawable.shape_adfox_carousel_indicator_dot)) + } + dotsImageViews.add(dotView) + indicatorLayout.addView(dotsImageViews[i]) + } + changeSelectedPage(selectedPage) + } + + fun changeSelectedPage(selectedPage: Int) { + dotsImageViews.forEachIndexed { page, view -> + val distance = (selectedPage - page).absoluteValue + val size = when { + dotsImageViews.size <= 4 || distance < 2 -> R.dimen.adfox_carousel_indicator_dot_size_large + distance == 2 -> R.dimen.adfox_carousel_indicator_dot_size_medium + else -> R.dimen.adfox_carousel_indicator_dot_size_small + } + view.layoutParams = getLayoutParams(getResource(size)) + view.isVisible = dotsImageViews.size <= 4 || distance <= 3 + view.alpha = if (page == selectedPage) DOT_ALPHA_SELECTED + else DOT_ALPHA_NOT_SELECTED + } + } + + private fun getLayoutParams(dotSize: Int): LinearLayout.LayoutParams { + val layoutParams = LinearLayout.LayoutParams(dotSize, dotSize) + layoutParams.setMargins(getResource(R.dimen.adfox_carousel_indicator_dot_margin)) + return layoutParams + } + + private fun getResource(@DimenRes id: Int): Int { + return indicatorLayout.resources.getDimension(id).toInt() + } + + companion object { + + private const val DOT_ALPHA_SELECTED = 1f + private const val DOT_ALPHA_NOT_SELECTED = 0.6f + } +} diff --git a/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adunits/AdfoxCarouselAdActivity.kt b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adunits/AdfoxCarouselAdActivity.kt new file mode 100644 index 0000000..8db07b0 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/java/com/yandex/ads/sample/adunits/AdfoxCarouselAdActivity.kt @@ -0,0 +1,202 @@ +/* + * This file is a part of the Yandex Advertising Network + * + * Version for Android (C) 2022 YANDEX + * + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://legal.yandex.com/partner_ch/ + */ + +package com.yandex.ads.sample.adunits + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.isVisible +import androidx.fragment.app.commit +import androidx.recyclerview.widget.RecyclerView +import androidx.viewpager2.widget.ViewPager2 +import com.yandex.ads.sample.R +import com.yandex.ads.sample.adfoxcarousel.AdfoxCarouselAdapter +import com.yandex.ads.sample.adfoxcarousel.ViewPagerAutoscroller +import com.yandex.ads.sample.adfoxcarousel.ViewPagerIndicatorController +import com.yandex.ads.sample.databinding.ActivityAdfoxCarouselAdBinding +import com.yandex.ads.sample.network.Network +import com.yandex.mobile.ads.common.AdRequestError +import com.yandex.mobile.ads.common.ImpressionData +import com.yandex.mobile.ads.nativeads.NativeAd +import com.yandex.mobile.ads.nativeads.NativeAdEventListener +import com.yandex.mobile.ads.nativeads.NativeAdRequestConfiguration +import com.yandex.mobile.ads.nativeads.NativeAdViewBinder +import com.yandex.mobile.ads.nativeads.SliderAd +import com.yandex.mobile.ads.nativeads.SliderAdLoadListener +import com.yandex.mobile.ads.nativeads.SliderAdLoader + +class AdfoxCarouselAdActivity : AppCompatActivity(R.layout.activity_adfox_carousel_ad) { + + private val nativeAdView get() = binding.carouselNativeAdView + private val viewPager2 get() = binding.carouselViewPager2 + private val carouselAdapter get() = viewPager2.adapter as AdfoxCarouselAdapter + private val leftButton get() = binding.carouselAdLeftButton + private val rightButton get() = binding.carouselAdRightButton + private val indicatorLayout get() = binding.carouselAdIndicatorLayout + private val adInfoFragment get() = requireNotNull(_adInfoFragment) + private val eventLogger = AdfoxCarouselEventLogger() + + private var autoscroller: ViewPagerAutoscroller? = null + private var viewPagerIndicatorController: ViewPagerIndicatorController? = null + private var sliderAdLoader: SliderAdLoader? = null + private var _adInfoFragment: AdInfoFragment? = null + + private lateinit var binding: ActivityAdfoxCarouselAdBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityAdfoxCarouselAdBinding.inflate(layoutInflater) + binding.toolbar.setNavigationOnClickListener { onBackPressedDispatcher.onBackPressed() } + setContentView(binding.root) + + _adInfoFragment = AdInfoFragment.newInstance(networks) + adInfoFragment.onLoadClickListener = ::loadAds + supportFragmentManager.commit { + setReorderingAllowed(true) + replace(R.id.ad_info, adInfoFragment) + } + autoscroller = ViewPagerAutoscroller(viewPager2) + viewPagerIndicatorController = ViewPagerIndicatorController(indicatorLayout) + + configureAdLoader() + configureViewPager() + } + + override fun onDestroy() { + autoscroller?.stopScrolling() + autoscroller = null + viewPagerIndicatorController = null + sliderAdLoader = null + _adInfoFragment = null + super.onDestroy() + } + + private fun loadAds() { + sliderAdLoader?.loadSlider(buildAdRequestConfiguration()) + } + + private fun configureAdLoader() { + sliderAdLoader = SliderAdLoader(this) + sliderAdLoader?.setSliderAdLoadListener(eventLogger) + } + + private fun configureViewPager() { + viewPager2.adapter = AdfoxCarouselAdapter() + viewPager2.registerOnPageChangeCallback(ViewPagerCallback()) + configureViewPagerPadding() + configureViewPagerControls() + } + + private fun buildAdRequestConfiguration(): NativeAdRequestConfiguration { + val adUnitId = adInfoFragment.selectedNetwork.adUnitId + return NativeAdRequestConfiguration + .Builder(adUnitId) + .setShouldLoadImagesAutomatically(true) + .setParameters(adFoxParameters) + .build() + } + + private fun bindSliderAd(sliderAd: SliderAd) { + val viewBinder = NativeAdViewBinder.Builder(nativeAdView).build() + sliderAd.bindSliderAd(viewBinder) + bindNativeAds(sliderAd.nativeAds) + } + + private fun bindNativeAds(nativeAds: List) { + nativeAds.forEach { it.setNativeAdEventListener(eventLogger) } + carouselAdapter.setData(nativeAds) + viewPagerIndicatorController?.setupIndicator(nativeAds.size, viewPager2.currentItem) + autoscroller?.startScrolling() + setViewPagerControlsVisibility() + } + + private fun configureViewPagerPadding() { + val padding = resources.getDimension(R.dimen.adfox_carousel_ad_padding).toInt() + val recyclerView = viewPager2.getChildAt(0) as RecyclerView + recyclerView.apply { + setPadding(padding, 0, padding, 0) + clipToPadding = false + } + } + + private fun configureViewPagerControls() { + leftButton.setOnClickListener { + val previousItem = (viewPager2.currentItem + carouselAdapter.itemCount - 1) % carouselAdapter.itemCount + viewPager2.setCurrentItem(previousItem, true) + } + rightButton.setOnClickListener { + val nextItem = (viewPager2.currentItem + 1) % carouselAdapter.itemCount + viewPager2.setCurrentItem(nextItem, true) + } + } + + private fun setViewPagerControlsVisibility() { + val shouldShow = carouselAdapter.itemCount > 1 + leftButton.isVisible = shouldShow + rightButton.isVisible = shouldShow + indicatorLayout.isVisible = shouldShow + } + + private inner class AdfoxCarouselEventLogger : SliderAdLoadListener, NativeAdEventListener { + + override fun onSliderAdLoaded(sliderAd: SliderAd) { + adInfoFragment.log("Ads loaded") + adInfoFragment.hideLoading() + bindSliderAd(sliderAd) + } + + override fun onSliderAdFailedToLoad(error: AdRequestError) { + adInfoFragment.log( + "Ads failed to load with code ${error.code}: ${error.description}" + ) + adInfoFragment.hideLoading() + } + + override fun onAdClicked() { + adInfoFragment.log("Ad clicked") + } + + override fun onLeftApplication() { + adInfoFragment.log("Left application") + } + + override fun onReturnedToApplication() { + adInfoFragment.log("Returned to application") + } + + override fun onImpression(data: ImpressionData?) { + adInfoFragment.log("Impression: ${data?.rawData}") + } + } + + private inner class ViewPagerCallback : ViewPager2.OnPageChangeCallback() { + + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + setViewPagerControlsVisibility() + viewPagerIndicatorController?.changeSelectedPage(position) + autoscroller?.updateLastScroll() + } + } + + companion object { + + private const val AD_FOX_AD_UNIT_ID = "R-M-243655-8" + + private val networks = arrayListOf( + Network(R.drawable.ic_adfox_icon, R.string.adfox_title, AD_FOX_AD_UNIT_ID), + ) + + private val adFoxParameters = mapOf( + "adf_ownerid" to "270901", + "adf_p1" to "ddflb", + "adf_p2" to "fksh" + ) + } +} diff --git a/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_left.xml b/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_left.xml new file mode 100644 index 0000000..f299915 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_left.xml @@ -0,0 +1,18 @@ + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_right.xml b/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_right.xml new file mode 100644 index 0000000..b8cc0a5 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/drawable/ic_adfox_carousel_arrow_right.xml @@ -0,0 +1,18 @@ + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_background.xml b/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_background.xml new file mode 100644 index 0000000..a8f9954 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_background.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_dot.xml b/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_dot.xml new file mode 100644 index 0000000..a379084 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/drawable/shape_adfox_carousel_indicator_dot.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/layout/activity_adfox_carousel_ad.xml b/YandexMobileAdsExample/app/src/main/res/layout/activity_adfox_carousel_ad.xml new file mode 100644 index 0000000..a0c9c53 --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/layout/activity_adfox_carousel_ad.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/layout/adfox_carousel_item.xml b/YandexMobileAdsExample/app/src/main/res/layout/adfox_carousel_item.xml new file mode 100644 index 0000000..c77caca --- /dev/null +++ b/YandexMobileAdsExample/app/src/main/res/layout/adfox_carousel_item.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/YandexMobileAdsExample/app/src/main/res/values/dimens.xml b/YandexMobileAdsExample/app/src/main/res/values/dimens.xml index fecd77b..3b77698 100644 --- a/YandexMobileAdsExample/app/src/main/res/values/dimens.xml +++ b/YandexMobileAdsExample/app/src/main/res/values/dimens.xml @@ -34,10 +34,10 @@ 8dp 24dp - 6dp - 4dp - 2dp - 2dp - 48dp - 32dp + 6dp + 4dp + 2dp + 2dp + 48dp + 32dp diff --git a/YandexMobileAdsExample/app/src/main/res/values/strings.xml b/YandexMobileAdsExample/app/src/main/res/values/strings.xml index 41f37ee..f074f26 100644 --- a/YandexMobileAdsExample/app/src/main/res/values/strings.xml +++ b/YandexMobileAdsExample/app/src/main/res/values/strings.xml @@ -21,7 +21,7 @@ AppOpenAd Native template Custom native - Adfox slider + Adfox Carousel Simple instream Instream: Pre / Mid / Post-Roll Instream: In-Roll diff --git a/changelogs/adapter/admob/CHANGELOG.md b/changelogs/adapter/admob/CHANGELOG.md index 0d38701..8a37377 100644 --- a/changelogs/adapter/admob/CHANGELOG.md +++ b/changelogs/adapter/admob/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to Yandex Adapter for AdMob Mediation will be documented in this file. +## Version 7.3.0.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 7.2.0.0 #### Updated diff --git a/changelogs/adapter/ironsource/CHANGELOG.md b/changelogs/adapter/ironsource/CHANGELOG.md index e7fc4b9..006d434 100644 --- a/changelogs/adapter/ironsource/CHANGELOG.md +++ b/changelogs/adapter/ironsource/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to Yandex Adapter for IronSource Mediation will be documented in this file. +## Version 7.3.0.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 7.2.0.0 #### Updated diff --git a/changelogs/mediation/adcolony/CHANGELOG.md b/changelogs/mediation/adcolony/CHANGELOG.md index cc0c44d..5e760e0 100644 --- a/changelogs/mediation/adcolony/CHANGELOG.md +++ b/changelogs/mediation/adcolony/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to AdColony Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 4.8.0.14 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 4.8.0.13 #### Updated diff --git a/changelogs/mediation/applovin/CHANGELOG.md b/changelogs/mediation/applovin/CHANGELOG.md index 016706a..33fe744 100644 --- a/changelogs/mediation/applovin/CHANGELOG.md +++ b/changelogs/mediation/applovin/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to AppLovin Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 12.6.0.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Applovin SDK version 12.6.0 + ## Version 12.5.0.1 #### Updated diff --git a/changelogs/mediation/appnext/CHANGELOG.md b/changelogs/mediation/appnext/CHANGELOG.md index 53839e0..826a376 100644 --- a/changelogs/mediation/appnext/CHANGELOG.md +++ b/changelogs/mediation/appnext/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to AppNext Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 2.7.6.473.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Appnext SDK version 2.7.6.473 + ## Version 2.7.5.473.2 #### Updated diff --git a/changelogs/mediation/bigoads/CHANGELOG.md b/changelogs/mediation/bigoads/CHANGELOG.md index 942c1cf..d9160be 100644 --- a/changelogs/mediation/bigoads/CHANGELOG.md +++ b/changelogs/mediation/bigoads/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to Bigo Ads Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 4.8.2.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Bigoads SDK version 4.8.2 + ## Version 4.8.0.0 #### Updated diff --git a/changelogs/mediation/chartboost/CHANGELOG.md b/changelogs/mediation/chartboost/CHANGELOG.md index b7ae687..8096bb7 100644 --- a/changelogs/mediation/chartboost/CHANGELOG.md +++ b/changelogs/mediation/chartboost/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to ChartBoost Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 9.3.1.8 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 9.3.1.7 #### Updated diff --git a/changelogs/mediation/google/CHANGELOG.md b/changelogs/mediation/google/CHANGELOG.md index a4ea54c..2d1ae51 100644 --- a/changelogs/mediation/google/CHANGELOG.md +++ b/changelogs/mediation/google/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to AdMob Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 23.0.0.3 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 23.0.0.2 #### Updated diff --git a/changelogs/mediation/inmobi/CHANGELOG.md b/changelogs/mediation/inmobi/CHANGELOG.md index bcfedf0..1623cbd 100644 --- a/changelogs/mediation/inmobi/CHANGELOG.md +++ b/changelogs/mediation/inmobi/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to InMobi Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 10.7.4.1 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 10.7.4.0 #### Updated diff --git a/changelogs/mediation/ironsource/CHANGELOG.md b/changelogs/mediation/ironsource/CHANGELOG.md index cf0ab19..f0ff2ba 100644 --- a/changelogs/mediation/ironsource/CHANGELOG.md +++ b/changelogs/mediation/ironsource/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to IronSource Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 8.2.1.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Ironsource SDK version 8.2.1 + ## Version 8.1.0.1 #### Updated diff --git a/changelogs/mediation/mintegral/CHANGELOG.md b/changelogs/mediation/mintegral/CHANGELOG.md index 957e625..ca12925 100644 --- a/changelogs/mediation/mintegral/CHANGELOG.md +++ b/changelogs/mediation/mintegral/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to Yandex Adapter for Mintegral Mediation will be documented in this file. +## Version 16.7.81.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Mintegral SDK version 16.7.81 + ## Version 16.7.61.0 #### Updated diff --git a/changelogs/mediation/mytarget/CHANGELOG.md b/changelogs/mediation/mytarget/CHANGELOG.md index bb3c927..96f2747 100644 --- a/changelogs/mediation/mytarget/CHANGELOG.md +++ b/changelogs/mediation/mytarget/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to MyTarget Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 5.21.1.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Mytarget SDK version 5.21.1 + ## Version 5.21.0.0 #### Updated diff --git a/changelogs/mediation/pangle/CHANGELOG.md b/changelogs/mediation/pangle/CHANGELOG.md index c47069e..e08f1a2 100644 --- a/changelogs/mediation/pangle/CHANGELOG.md +++ b/changelogs/mediation/pangle/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to Pangle Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 6.1.0.6.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Pangle SDK version 6.1.0.6 + ## Version 6.0.0.7.0 #### Updated diff --git a/changelogs/mediation/startapp/CHANGELOG.md b/changelogs/mediation/startapp/CHANGELOG.md index 84bc6fd..b8212c0 100644 --- a/changelogs/mediation/startapp/CHANGELOG.md +++ b/changelogs/mediation/startapp/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to StartApp Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 5.0.2.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Startapp SDK version 5.0.2 + ## Version 5.0.1.0 #### Updated diff --git a/changelogs/mediation/tapjoy/CHANGELOG.md b/changelogs/mediation/tapjoy/CHANGELOG.md index ce6b26c..a38785c 100644 --- a/changelogs/mediation/tapjoy/CHANGELOG.md +++ b/changelogs/mediation/tapjoy/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to TapJoy Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 13.4.1.3 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 13.4.1.2 #### Updated diff --git a/changelogs/mediation/unityads/CHANGELOG.md b/changelogs/mediation/unityads/CHANGELOG.md index 6715c22..3c8e744 100644 --- a/changelogs/mediation/unityads/CHANGELOG.md +++ b/changelogs/mediation/unityads/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to UnityAds Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 4.12.1.0 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 +* Unityads SDK version 4.12.1 + ## Version 4.12.0.0 #### Updated diff --git a/changelogs/mediation/vungle/CHANGELOG.md b/changelogs/mediation/vungle/CHANGELOG.md index 26d04bf..8931d61 100644 --- a/changelogs/mediation/vungle/CHANGELOG.md +++ b/changelogs/mediation/vungle/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log All notable changes to Vungle Adapter for Yandex Mobile Ads Mediation will be documented in this file. +## Version 7.1.0.4 + +#### Updated +* Yandex Mobile Ads SDK version 7.3.0 + ## Version 7.1.0.3 #### Updated diff --git a/changelogs/mobileads-mediation/CHANGELOG.md b/changelogs/mobileads-mediation/CHANGELOG.md index 2c4d51e..d426ce7 100644 --- a/changelogs/mobileads-mediation/CHANGELOG.md +++ b/changelogs/mobileads-mediation/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to Yandex Full Mediation will be documented in this file. +## Version 7.3.0.0 + +#### Updated + +* Yandex Mobile Ads SDK 7.3.0 +* Applovin Adapter version 12.6.0.0 +* Appnext Adapter version 2.7.6.473.0 +* Bigoads Adapter version 4.8.2.0 +* Chartboost Adapter version 9.3.1.8 +* Google Adapter version 23.0.0.3 +* Inmobi Adapter version 10.7.4.1 +* Ironsource Adapter version 8.2.1.0 +* Mintegral Adapter version 16.7.81.0 +* Mytarget Adapter version 5.21.1.0 +* Pangle Adapter version 6.1.0.6.0 +* Startapp Adapter version 5.0.2.0 +* Tapjoy Adapter version 13.4.1.3 +* Unityads Adapter version 4.12.1.0 +* Vungle Adapter version 7.1.0.4 + ## Version 7.2.0.0 #### Updated diff --git a/changelogs/mobileads/CHANGELOG.md b/changelogs/mobileads/CHANGELOG.md index e817562..99fe980 100644 --- a/changelogs/mobileads/CHANGELOG.md +++ b/changelogs/mobileads/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log All notable changes to Yandex Mobile Ads SDK will be documented in this file. +## Version 7.3.0 + +### Updated +* DivKit version updated to 30.5.0 + +### Fixed +* Fixed the size of the banner while displaying mediation +* Improvements and optimizations + ## Version 7.2.0 ### Fixed