-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow serving
Custom
ads in AdLoaderAd
Allow the `AdLoaderAd` instance to serve `Custom` ads, which are instances of: * `NativeCustomFormatAd` under Android, and * `GADCustomNativeAd` under iOS
- Loading branch information
Showing
21 changed files
with
670 additions
and
18 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
30 changes: 30 additions & 0 deletions
30
...ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterCustomParameters.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,30 @@ | ||
package io.flutter.plugins.googlemobileads; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import com.google.android.gms.ads.nativead.NativeCustomFormatAd.OnCustomFormatAdLoadedListener; | ||
import io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.CustomAdFactory; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
class FlutterCustomParameters { | ||
@NonNull final List<String> formatIds; | ||
@Nullable final Map<String, Object> viewOptions; | ||
|
||
FlutterCustomParameters( | ||
@NonNull List<String> formatIds, @Nullable Map<String, Object> viewOptions) { | ||
this.formatIds = formatIds; | ||
this.viewOptions = viewOptions; | ||
} | ||
|
||
FlutterAdLoaderAd.CustomParameters asCustomParameters( | ||
@NonNull OnCustomFormatAdLoadedListener listener, | ||
@NonNull Map<String, CustomAdFactory> availableFactories) { | ||
Map<String, CustomAdFactory> factories = new HashMap<>(); | ||
for (String formatId : formatIds) { | ||
factories.put(formatId, availableFactories.get(formatId)); | ||
} | ||
return new FlutterAdLoaderAd.CustomParameters(listener, factories, viewOptions); | ||
} | ||
} |
Oops, something went wrong.