-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow serving
Banner
ads in AdLoaderAd
Allow the `AdLoaderAd` instance to serve `Banner` ads, which are instances of: * `AdManagerAdView` under Android, and * `GAMBannerView` under iOS
- Loading branch information
Showing
22 changed files
with
1,094 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...droid/src/main/java/io/flutter/plugins/googlemobileads/FlutterAdManagerAdViewOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2022 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License.c language governing permissions and | ||
// limitations under the License. | ||
|
||
package io.flutter.plugins.googlemobileads; | ||
|
||
import androidx.annotation.Nullable; | ||
import com.google.android.gms.ads.formats.AdManagerAdViewOptions; | ||
|
||
/** A wrapper for {@link com.google.android.gms.ads.formats.AdManagerAdViewOptions}. */ | ||
class FlutterAdManagerAdViewOptions { | ||
|
||
@Nullable final Boolean manualImpressionsEnabled; | ||
|
||
FlutterAdManagerAdViewOptions(@Nullable Boolean manualImpressionsEnabled) { | ||
this.manualImpressionsEnabled = manualImpressionsEnabled; | ||
} | ||
|
||
AdManagerAdViewOptions asAdManagerAdViewOptions() { | ||
AdManagerAdViewOptions.Builder builder = new AdManagerAdViewOptions.Builder(); | ||
if (manualImpressionsEnabled != null) { | ||
builder.setManualImpressionsEnabled(manualImpressionsEnabled); | ||
} | ||
return builder.build(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterBannerParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 20222 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package io.flutter.plugins.googlemobileads; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import com.google.android.gms.ads.AdSize; | ||
import com.google.android.gms.ads.formats.OnAdManagerAdViewLoadedListener; | ||
import java.util.List; | ||
|
||
class FlutterBannerParameters { | ||
@NonNull final List<FlutterAdSize> sizes; | ||
@Nullable final FlutterAdManagerAdViewOptions adManagerAdViewOptions; | ||
|
||
FlutterBannerParameters( | ||
@NonNull List<FlutterAdSize> sizes, | ||
@Nullable FlutterAdManagerAdViewOptions adManagerAdViewOptions) { | ||
this.sizes = sizes; | ||
this.adManagerAdViewOptions = adManagerAdViewOptions; | ||
} | ||
|
||
FlutterAdLoaderAd.BannerParameters asBannerParameters( | ||
@NonNull OnAdManagerAdViewLoadedListener listener) { | ||
AdSize[] adSizes = new AdSize[sizes.size()]; | ||
int i = 0; | ||
for (FlutterAdSize size : sizes) { | ||
adSizes[i++] = size.getAdSize(); | ||
} | ||
return new FlutterAdLoaderAd.BannerParameters( | ||
listener, | ||
adSizes, | ||
adManagerAdViewOptions != null ? adManagerAdViewOptions.asAdManagerAdViewOptions() : null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.