Skip to content

Commit 844ee23

Browse files
committed
Dependencies & ReadMe update, added support for isAdLoaded: Boolean
1 parent 61e2f63 commit 844ee23

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Readme.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ Make sure to add that to your repositories block.
1515

1616
**Gradle**
1717
```gradle
18-
implementation 'com.lazygeniouz:acv:0.2.0'
18+
implementation 'com.lazygeniouz:acv:0.2.1'
1919
```
2020
**Maven**
2121
```xml
2222
<dependency>
2323
<groupId>com.lazygeniouz</groupId>
2424
<artifactId>acv</artifactId>
25-
<version>0.2.0</version>
25+
<version>0.2.1</version>
2626
<type>pom</type>
2727
</dependency>
2828
```
@@ -66,6 +66,8 @@ parentLayout.addView(adContainerView)
6666

6767
* `isLoading(): Boolean`: Returns `true` if the Ad is currently loading, `false` otherwise.
6868

69+
* `isAdLoaded(): Boolean`: Returns `true` if the Ad is loaded, `false` otherwise.
70+
6971
* `isVisible(): Boolean`: Returns `true` if the Ad is not null & visible, `false` otherwise.
7072

7173
* `getAdUnitId()`: Returns current `adUnitId`.

acv/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
defaultConfig {
1717
minSdkVersion 16
1818
targetSdkVersion 31
19-
versionCode 20
20-
versionName "0.2.0"
19+
versionCode 21
20+
versionName "0.2.1"
2121
}
2222

2323
buildTypes {

acv/src/main/java/com/lazygeniouz/acv/AdContainerView.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ class AdContainerView @JvmOverloads constructor(
8383
}
8484

8585
override fun onAdLoaded() {
86+
isAdLoaded = true
8687
newAdView!!.visibility = View.VISIBLE
8788
listener?.onAdLoaded()
8889
}
8990

9091
override fun onAdFailedToLoad(error: LoadAdError) {
9192
listener?.onAdFailedToLoad(error)
93+
isAdLoaded = false
9294
}
9395
}
9496

@@ -124,6 +126,7 @@ class AdContainerView @JvmOverloads constructor(
124126
fun destroyAd() {
125127
newAdView?.destroy()
126128
newAdView = null
129+
isAdLoaded = false
127130
removeAllViews()
128131
}
129132

acv/src/main/java/com/lazygeniouz/acv/base/BaseAd.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import android.util.AttributeSet
99
import android.util.DisplayMetrics
1010
import android.view.View
1111
import android.widget.RelativeLayout
12+
import androidx.annotation.Keep
1213
import androidx.fragment.app.FragmentActivity
1314
import com.google.android.gms.ads.AdListener
1415
import com.google.android.gms.ads.AdRequest
@@ -23,13 +24,15 @@ import com.lazygeniouz.acv.R
2324
* @see com.google.android.gms.ads.AdView
2425
*/
2526

27+
@Keep
2628
open class BaseAd @JvmOverloads constructor(
2729
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
2830
) : RelativeLayout(context, attrs, defStyleAttr) {
2931

3032
internal val tag = javaClass.simpleName
3133

3234
protected var autoLoad = false
35+
internal var isAdLoaded = false
3336
internal var adSize: AdSize = AdSize.SMART_BANNER
3437
internal var adUnitId = AdContainerView.TEST_AD_ID
3538

@@ -68,6 +71,11 @@ open class BaseAd @JvmOverloads constructor(
6871
this.listener = listener
6972
}
7073

74+
/**
75+
* Return whether the Ad is loaded or not
76+
*/
77+
fun isAdLoaded(): Boolean = isAdLoaded
78+
7179
/**
7280
* Return the Ad's Loading State.
7381
*/

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.0.2'
9+
classpath 'com.android.tools.build:gradle:7.0.3'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111

1212
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'

0 commit comments

Comments
 (0)