use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner in project prebid-mobile-android by prebid.
the class BasicParameterBuilderTest method getExpectedBannerImpValues.
private Banner getExpectedBannerImpValues(Imp imp, AdConfiguration adConfiguration) {
Banner banner = new Banner();
banner.api = new int[] { 3, 5, 6, 7 };
if (adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.BANNER)) {
for (AdSize size : adConfiguration.getAdSizes()) {
banner.addFormat(size.width, size.height);
}
} else if (adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.INTERSTITIAL)) {
Configuration deviceConfiguration = mContext.getResources().getConfiguration();
banner.addFormat(deviceConfiguration.screenWidthDp, deviceConfiguration.screenHeightDp);
}
if (adConfiguration.isAdPositionValid()) {
banner.pos = adConfiguration.getAdPositionValue();
}
return banner;
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner in project prebid-mobile-android by prebid.
the class BasicParameterBuilder method setBannerImpValues.
private void setBannerImpValues(Imp imp) {
Banner banner = new Banner();
banner.api = getApiFrameworks();
if (mAdConfiguration.isAdType(AdUnitIdentifierType.BANNER)) {
for (AdSize size : mAdConfiguration.getAdSizes()) {
banner.addFormat(size.width, size.height);
}
} else if (mAdConfiguration.isAdType(AdUnitIdentifierType.INTERSTITIAL) && mResources != null) {
Configuration deviceConfiguration = mResources.getConfiguration();
banner.addFormat(deviceConfiguration.screenWidthDp, deviceConfiguration.screenHeightDp);
}
if (mAdConfiguration.isAdPositionValid()) {
banner.pos = mAdConfiguration.getAdPositionValue();
}
imp.banner = banner;
}
use of org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner in project prebid-mobile-android by prebid.
the class ImpTest method getJsonObject.
@Test
public void getJsonObject() throws Exception {
Imp imp = new Imp();
imp.displaymanager = "prebid";
imp.displaymanagerver = "1.0";
imp.instl = 1;
imp.tagid = "tagid";
imp.secure = 0;
imp.banner = new Banner();
imp.video = new Video();
imp.pmp = new Pmp();
imp.clickBrowser = 0;
JSONObject actualObj = imp.getJsonObject();
String expectedString = "{\"clickbrowser\":0,\"pmp\":{},\"tagid\":\"tagid\",\"displaymanager\":\"prebid\",\"displaymanagerver\":\"1.0\",\"banner\":{},\"video\":{},\"secure\":0,\"instl\":1}";
assertEquals("got: " + actualObj.toString(), expectedString, actualObj.toString());
imp.getJsonObject();
}
Aggregations