@@ -7,6 +7,7 @@ import android.util.Log
77import  android.view.Gravity 
88import  android.view.View 
99import  android.view.ViewGroup 
10+ import  android.widget.Button 
1011import  android.widget.TextView 
1112import  androidx.annotation.AnyThread 
1213import  com.cleversolutions.ads.* 
@@ -33,12 +34,12 @@ class SampleActivity : Activity(), AdLoadCallback {
3334            AdType .Rewarded  to rewardedStatusText
3435        )
3536
36-         //  Try get last initialized MediationManager
37-         val  manager =  CAS .manager!! 
38- 
3937        //  Check ad available
40-         statusAdViews.forEach {
41-             it.value.text =  if  (manager.isAdReady(it.key)) " Ready" else  " Loading" 
38+         SampleApplication .manager?.let  {
39+             statusAdViews.forEach { it1 -> 
40+                 it1.value.text = 
41+                     if  ((it.isAdReady(it1.key))) " Ready" else  " Loading" 
42+             }
4243        }
4344
4445        //  Validate Integration
@@ -48,12 +49,13 @@ class SampleActivity : Activity(), AdLoadCallback {
4849        casVersionText.text =  " version: " +  CAS .getSDKVersion()
4950
5051        //  Subscribe loading ad event
51-         manager.onAdLoadEvent.add(this )
52+         SampleApplication . manager? .onAdLoadEvent? .add(this )
5253
5354        //  Create Banner View
5455        val  bannerView =  CASBannerView (this )
55-         bannerView.listener  =  AdContentListener (this , AdType .Banner )
56+         bannerView.contentCallback  =  AdContentListener (this , AdType .Banner )
5657        bannerView.gravity =  Gravity .BOTTOM  or  Gravity .CENTER_HORIZONTAL 
58+         bannerView.size =  AdSize .BANNER 
5759
5860        //  Attach banner View
5961        addContentView(
@@ -89,11 +91,11 @@ class SampleActivity : Activity(), AdLoadCallback {
8991        }
9092
9193        showInterBtn.setOnClickListener {
92-             CAS .manager!! .showInterstitial(this , AdContentListener (this , AdType .Interstitial ))
94+             SampleApplication .manager? .showInterstitial(this , AdContentListener (this , AdType .Interstitial ))
9395        }
9496
9597        showRewardedBtn.setOnClickListener {
96-             CAS .manager!! .showRewardedAd(this , AdContentListener (this , AdType .Rewarded ))
98+             SampleApplication .manager? .showRewardedAd(this , AdContentListener (this , AdType .Rewarded ))
9799        }
98100
99101        enableAppReturn.setOnClickListener {
@@ -122,12 +124,12 @@ class SampleActivity : Activity(), AdLoadCallback {
122124        if  (isActiveAppReturn) {
123125            appReturnStatusText.text =  " Disabled" 
124126            enableAppReturn.text =  " Enable" 
125-             CAS .manager!! .disableAppReturnAds()
127+             SampleApplication .manager? .disableAppReturnAds()
126128            isActiveAppReturn =  false 
127129        } else  {
128130            appReturnStatusText.text =  " Enabled" 
129131            enableAppReturn.text =  " Disable" 
130-             CAS .manager!! .enableAppReturnAds(AdContentListener (this , AdType .Interstitial ))
132+             SampleApplication .manager? .enableAppReturnAds(AdContentListener (this , AdType .Interstitial ))
131133            isActiveAppReturn =  true 
132134        }
133135    }
0 commit comments