{"id":15471761,"url":"https://github.com/itznotabug/adcontainerview","last_synced_at":"2025-04-22T13:21:36.841Z","repository":{"id":48175103,"uuid":"298749153","full_name":"ItzNotABug/AdContainerView","owner":"ItzNotABug","description":"AdContainerView is a simple, lifecycle aware wrapper over Google AdMob's AdView (Banner Ad) which handles most of the stuff by itself.","archived":false,"fork":false,"pushed_at":"2024-03-24T06:51:05.000Z","size":261,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T01:16:05.662Z","etag":null,"topics":["android-adcontainerview","android-admob","android-ads","android-adview","android-banner-ads","android-google-admob"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ItzNotABug.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-26T06:05:53.000Z","updated_at":"2022-10-14T06:15:56.000Z","dependencies_parsed_at":"2024-12-14T15:55:46.828Z","dependency_job_id":"3c64e81c-3c45-4ae5-8fc6-5de05f901455","html_url":"https://github.com/ItzNotABug/AdContainerView","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.015625,"last_synced_commit":"2760b9b9e5547b1a76678700f30327bc06602e26"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FAdContainerView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FAdContainerView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FAdContainerView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItzNotABug%2FAdContainerView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItzNotABug","download_url":"https://codeload.github.com/ItzNotABug/AdContainerView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250246746,"owners_count":21398919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-adcontainerview","android-admob","android-ads","android-adview","android-banner-ads","android-google-admob"],"created_at":"2024-10-02T02:21:40.115Z","updated_at":"2025-04-22T13:21:36.815Z","avatar_url":"https://github.com/ItzNotABug.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AdContainerView\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/685458c0953f4dd0b84956383b491f29)](https://app.codacy.com/gh/ItzNotABug/AdContainerView?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=ItzNotABug/AdContainerView\u0026utm_campaign=Badge_Grade_Settings)\n\nAdContainerView is a simple, lifecycle aware wrapper over Google AdMob's AdView (Banner Ad) for a plug \u0026 play use-case.\n\nFor the simplest use:\\\nYou just need to add `AdContainerView` in your layout, define `adUnitId`, `adSize` \u0026 **that's it!**\\\n`AdContainerView` hooks to your Activity's lifecycle process \u0026 handles AdView's lifecycle (Resume, Pause, Destroy Ad).\\\nThis is most helpful when you just want to add a simple Banner Ad without any boilerplate.\n\n## Adding in your project\n`AdContainerView` is now on `mavenCentral()`,\\\nMake sure to add that to your repositories block.\n\n**Gradle**\n```gradle\nimplementation 'com.lazygeniouz:acv:$latest_version'\n```\n**Maven**\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.lazygeniouz\u003c/groupId\u003e\n    \u003cartifactId\u003eacv\u003c/artifactId\u003e\n    \u003cversion\u003e$latest_version\u003c/version\u003e\n    \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Using `AdContainerView`\n### The same old XML Way\n```xml\n\u003ccom.lazygeniouz.acv.AdContainerView \n    android:id=\"@+id/adContainerView\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:acv_autoLoad=\"true\"\n    app:acv_adSize=\"ADAPTIVE\"\n    app:acv_adUnitId=\"@string/test_ad\"/\u003e\n```\nThe attributes are as follows:\n*   `acv_autoLoad`: Default Value is `false`\\\n    If `true`, the AdView will be loaded as soon as the Activity is created.\n\n*   `acv_adSize`: Default Value is `ADAPTIVE` which equals to `AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize()`.\\\n    Define an AdSize for the the AdView, check [AdSize](https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize#field-summary).\n\n*   `acv_adUnitId`: Define an `adUnitId` for the Banner AdView from your AdMob dashboard.\n\n### Programmatically\n```kotlin\nval adContainerView = AdContainerView(this@MainActivity)\nadContainerView.loadAdView(adUnitId, adSize, adRequest)\nparentLayout.addView(adContainerView)\n```\n**Loading the Ad:**\n```kotlin\nfun loadAdView(\n    adUnitId: String,\n    adSize: AdSize,\n    adRequest: AdRequest,\n    parentHasListView: Boolean,\n    showOnCondition: (() -\u003e Boolean)? = null\n)\n```\n1. The arguments `adSize` \u0026 `adRequest` are optional\\\n2. The default value of parameter `adSize` is `ADAPTIVE`.\\\n3. Pass your `AdRequest` if you have a customized request.\\\n4. Pass `true` if AdContainerView is added inside a list (RecyclerView, List / GridView).\\\n   If you don't do this \u0026 the parent view group is a List, it will be **destroyed**.\n6. Pass you condition to evaluate whether to show the Ad or not (Default is Null).\n\n---\n**All other methods:**\n\n* `@Nullable getAdView()`: Returns the underlying `AdView`, can be `@null` if called before `loadAdView()`.\n\n* `isLoading(): Boolean`: Returns `true` if the Ad is currently loading, `false` otherwise.\n\n* `isAdLoaded(): Boolean`: Returns `true` if the Ad is loaded, `false` otherwise.\n\n* `isVisible(): Boolean`: Returns `true` if the Ad is loaded, not null \u0026 visible, `false` otherwise.\n\n* `getAdSize()`: Returns current `adSize`.\n\n* `getAdUnitId()`: Returns current `adUnitId`.\n\n* `setAdListener(listener: AdListener)`: Use the AdView's [`AdListener`](https://developers.google.com/android/reference/com/google/android/gms/ads/AdListener).\n\n* `@Nullable getAdListener()`: Returns the Listener if set, null otherwise.\n\n* `removeAd()`: Removes the AdView. Make sure to call `loadAdView()` to re-add `AdView`.\n\n* `resumeAd()`: Resumes AdView **(Handled automatically)**\n\n* `pauseAd()`: Pauses AdView **(Handled automatically)**\n\n* `destroyAd()`: Destroys AdView **(Handled automatically)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitznotabug%2Fadcontainerview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitznotabug%2Fadcontainerview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitznotabug%2Fadcontainerview/lists"}