Search in sources :

Example 1 with Banner

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;
}
Also used : Configuration(android.content.res.Configuration) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Banner(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Example 2 with 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;
}
Also used : Configuration(android.content.res.Configuration) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) Banner(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner) AdSize(org.prebid.mobile.rendering.bidding.data.AdSize)

Example 3 with 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();
}
Also used : Pmp(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Pmp) JSONObject(org.json.JSONObject) Banner(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner) Video(org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video) Test(org.junit.Test)

Aggregations

Banner (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Banner)3 Configuration (android.content.res.Configuration)2 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)2 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)2 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1 Pmp (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Pmp)1 Video (org.prebid.mobile.rendering.models.openrtb.bidRequests.imps.Video)1