File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed
src/main/java/com/lazygeniouz/acv Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ Make sure to add that to your repositories block.
15
15
16
16
** Gradle**
17
17
``` gradle
18
- implementation 'com.lazygeniouz:acv:0.2.0 '
18
+ implementation 'com.lazygeniouz:acv:0.2.1 '
19
19
```
20
20
** Maven**
21
21
``` xml
22
22
<dependency >
23
23
<groupId >com.lazygeniouz</groupId >
24
24
<artifactId >acv</artifactId >
25
- <version >0.2.0 </version >
25
+ <version >0.2.1 </version >
26
26
<type >pom</type >
27
27
</dependency >
28
28
```
@@ -66,6 +66,8 @@ parentLayout.addView(adContainerView)
66
66
67
67
* ` isLoading(): Boolean ` : Returns ` true ` if the Ad is currently loading, ` false ` otherwise.
68
68
69
+ * ` isAdLoaded(): Boolean ` : Returns ` true ` if the Ad is loaded, ` false ` otherwise.
70
+
69
71
* ` isVisible(): Boolean ` : Returns ` true ` if the Ad is not null & visible, ` false ` otherwise.
70
72
71
73
* ` getAdUnitId() ` : Returns current ` adUnitId ` .
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ android {
16
16
defaultConfig {
17
17
minSdkVersion 16
18
18
targetSdkVersion 31
19
- versionCode 20
20
- versionName " 0.2.0 "
19
+ versionCode 21
20
+ versionName " 0.2.1 "
21
21
}
22
22
23
23
buildTypes {
Original file line number Diff line number Diff line change @@ -83,12 +83,14 @@ class AdContainerView @JvmOverloads constructor(
83
83
}
84
84
85
85
override fun onAdLoaded () {
86
+ isAdLoaded = true
86
87
newAdView!! .visibility = View .VISIBLE
87
88
listener?.onAdLoaded()
88
89
}
89
90
90
91
override fun onAdFailedToLoad (error : LoadAdError ) {
91
92
listener?.onAdFailedToLoad(error)
93
+ isAdLoaded = false
92
94
}
93
95
}
94
96
@@ -124,6 +126,7 @@ class AdContainerView @JvmOverloads constructor(
124
126
fun destroyAd () {
125
127
newAdView?.destroy()
126
128
newAdView = null
129
+ isAdLoaded = false
127
130
removeAllViews()
128
131
}
129
132
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import android.util.AttributeSet
9
9
import android.util.DisplayMetrics
10
10
import android.view.View
11
11
import android.widget.RelativeLayout
12
+ import androidx.annotation.Keep
12
13
import androidx.fragment.app.FragmentActivity
13
14
import com.google.android.gms.ads.AdListener
14
15
import com.google.android.gms.ads.AdRequest
@@ -23,13 +24,15 @@ import com.lazygeniouz.acv.R
23
24
* @see com.google.android.gms.ads.AdView
24
25
*/
25
26
27
+ @Keep
26
28
open class BaseAd @JvmOverloads constructor(
27
29
context : Context , attrs : AttributeSet ? = null , defStyleAttr : Int = 0
28
30
) : RelativeLayout(context, attrs, defStyleAttr) {
29
31
30
32
internal val tag = javaClass.simpleName
31
33
32
34
protected var autoLoad = false
35
+ internal var isAdLoaded = false
33
36
internal var adSize: AdSize = AdSize .SMART_BANNER
34
37
internal var adUnitId = AdContainerView .TEST_AD_ID
35
38
@@ -68,6 +71,11 @@ open class BaseAd @JvmOverloads constructor(
68
71
this .listener = listener
69
72
}
70
73
74
+ /* *
75
+ * Return whether the Ad is loaded or not
76
+ */
77
+ fun isAdLoaded (): Boolean = isAdLoaded
78
+
71
79
/* *
72
80
* Return the Ad's Loading State.
73
81
*/
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ buildscript {
6
6
}
7
7
8
8
dependencies {
9
- classpath ' com.android.tools.build:gradle:7.0.2 '
9
+ classpath ' com.android.tools.build:gradle:7.0.3 '
10
10
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
11
11
12
12
classpath ' com.vanniktech:gradle-maven-publish-plugin:0.18.0'
You can’t perform that action at this time.
0 commit comments