Skip to content

Commit

Permalink
Release: version 4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Shayefar committed Dec 15, 2015
1 parent 7d7a04e commit 06bceb9
Show file tree
Hide file tree
Showing 22 changed files with 1,281 additions and 163 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version 4.3.0 (Deceber 15, 2015)

- Enhancements and bug fixes for VAST video ads.

## Version 4.2.0 (November 30, 2015)

- Support for mediating Facebook Native Video ads.
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ The MoPub SDK is available via:
## New in this Version
Please view the [changelog](https://github.com/mopub/mopub-android-sdk/blob/master/CHANGELOG.md) for a complete list of additions, fixes, and enhancements in the latest release.
- Support for mediating Facebook Native Video ads.
- Mediated Facebook Native Ads now display the AdChoices icon.
- Support for Facebook SDK 8.4.1
- Enhancements and bug fixes for VAST video ads.
## Requirements
Expand Down
4 changes: 2 additions & 2 deletions mopub-sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mopub.simpleadsdemo"
android:versionCode="33"
android:versionName="4.2.0">
android:versionCode="34"
android:versionName="4.3.0">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="23"/>

Expand Down
4 changes: 2 additions & 2 deletions mopub-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ apply plugin: 'com.android.application'

group = 'com.mopub'
description = '''MoPub Sample App'''
version = '4.2.0'
version = '4.3.0'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
lintOptions { abortOnError false }

defaultConfig {
versionCode 33
versionCode 34
versionName version
minSdkVersion 9
targetSdkVersion 23
Expand Down
6 changes: 3 additions & 3 deletions mopub-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ task wrapper(type: Wrapper) {

group = 'com.mopub'
description = '''MoPub Android SDK'''
version = '4.2.0'
version = '4.3.0'

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
lintOptions { abortOnError false }

defaultConfig {
versionCode 33
versionCode 34
versionName version
minSdkVersion 9
targetSdkVersion 22
Expand All @@ -56,7 +56,7 @@ android {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/resources']
aidl.srcDirs = ['src/main']
renderscript.srcDirs = ['src/main']
res.srcDirs = ['res']
Expand Down
2 changes: 1 addition & 1 deletion mopub-sdk/src/main/java/com/mopub/common/MoPub.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.mopub.mobileads.MoPubRewardedVideoManager;

public class MoPub {
public static final String SDK_VERSION = "4.2.0";
public static final String SDK_VERSION = "4.3.0";

public static enum LocationAwareness { NORMAL, TRUNCATED, DISABLED }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class VastCompanionAdXmlManager {
private static final String EVENT = "event";
private static final String WIDTH = "width";
private static final String HEIGHT = "height";
private static final String AD_SLOT_ID = "adSlotID";

// Attribute values
private static final String CREATIVE_VIEW = "creativeView";
Expand Down Expand Up @@ -63,6 +64,16 @@ Integer getHeight() {
return XmlUtils.getAttributeValueAsInt(mCompanionNode, HEIGHT);
}

/**
* Gets the adSlotID attribute from the companion ad or {@code null} if not present.
*
* @return String adSlotId attribute or {@code null}.
*/
@Nullable
String getAdSlotId() {
return XmlUtils.getAttributeValue(mCompanionNode, AD_SLOT_ID);
}

@NonNull
VastResourceXmlManager getResourceXmlManager() {
return mResourceXmlManager;
Expand Down
14 changes: 14 additions & 0 deletions mopub-sdk/src/main/java/com/mopub/mobileads/VastVideoConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.mopub.network.TrackingRequest.makeVastTrackingHttpRequest;

Expand All @@ -46,6 +48,7 @@ public class VastVideoConfig implements Serializable {
@Nullable private String mSkipOffset;
@Nullable private VastCompanionAdConfig mLandscapeVastCompanionAdConfig;
@Nullable private VastCompanionAdConfig mPortraitVastCompanionAdConfig;
@NonNull private Map<String, VastCompanionAdConfig> mSocialActionsCompanionAds;
@Nullable private VastIconConfig mVastIconConfig;

// Custom extensions
Expand All @@ -72,6 +75,7 @@ public VastVideoConfig() {
mSkipTrackers = new ArrayList<VastTracker>();
mClickTrackers = new ArrayList<VastTracker>();
mErrorTrackers = new ArrayList<VastTracker>();
mSocialActionsCompanionAds = new HashMap<String, VastCompanionAdConfig>();
}

/**
Expand Down Expand Up @@ -170,6 +174,11 @@ public void setVastCompanionAd(@Nullable final VastCompanionAdConfig landscapeVa
mPortraitVastCompanionAdConfig = portraitVastCompanionAdConfig;
}

public void setSocialActionsCompanionAds(
@NonNull final Map<String, VastCompanionAdConfig> socialActionsCompanionAds) {
this.mSocialActionsCompanionAds = socialActionsCompanionAds;
}

public void setVastIconConfig(@Nullable final VastIconConfig vastIconConfig) {
mVastIconConfig = vastIconConfig;
}
Expand Down Expand Up @@ -297,6 +306,11 @@ public VastCompanionAdConfig getVastCompanionAd(final int orientation) {
}
}

@NonNull
public Map<String, VastCompanionAdConfig> getSocialActionsCompanionAds() {
return mSocialActionsCompanionAds;
}

@Nullable
public VastIconConfig getVastIconConfig() {
return mVastIconConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public class VastVideoCtaButtonWidget extends ImageView {
private boolean mIsVideoComplete;
private boolean mHasCompanionAd;
private boolean mHasClickthroughUrl;
private boolean mHasSocialActions;

public VastVideoCtaButtonWidget(@NonNull final Context context, final int videoViewId,
final boolean hasCompanionAd, final boolean hasClickthroughUrl) {
super(context);

mHasCompanionAd = hasCompanionAd;
mHasClickthroughUrl = hasClickthroughUrl;
mHasSocialActions = false;

setId((int) Utils.generateUniqueId());

Expand All @@ -46,11 +48,11 @@ public VastVideoCtaButtonWidget(@NonNull final Context context, final int videoV
mLandscapeLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, videoViewId);
mLandscapeLayoutParams.addRule(RelativeLayout.ALIGN_RIGHT, videoViewId);

// portrait layout: placed center below video view
// portrait layout: placed bottom-right corner of screen
mPortraitLayoutParams = new RelativeLayout.LayoutParams(width, height);
mPortraitLayoutParams.setMargins(margin, margin, margin, margin);
mPortraitLayoutParams.addRule(RelativeLayout.BELOW, videoViewId);
mPortraitLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
mPortraitLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mPortraitLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

updateLayoutAndVisibility();
}
Expand All @@ -66,6 +68,14 @@ void updateCtaText(@NonNull final String customCtaText) {
mCtaButtonDrawable.setCtaText(customCtaText);
}

void setHasSocialActions(final boolean hasSocialActions) {
mHasSocialActions = hasSocialActions;
}

boolean getHasSocialActions() {
return mHasSocialActions;
}

void notifyVideoSkippable() {
mIsVideoSkippable = true;
updateLayoutAndVisibility();
Expand All @@ -91,7 +101,8 @@ private void updateLayoutAndVisibility() {
}

// If video has finished playing and there's a companion ad, do not show CTA button
if (mIsVideoComplete && mHasCompanionAd) {
// Unless the ad has social actions
if (mIsVideoComplete && mHasCompanionAd && !mHasSocialActions) {
setVisibility(View.GONE);
return;
}
Expand All @@ -100,29 +111,25 @@ private void updateLayoutAndVisibility() {

switch (currentOrientation) {
case Configuration.ORIENTATION_LANDSCAPE:
setVisibility(View.VISIBLE);
setLayoutParams(mLandscapeLayoutParams);
break;
case Configuration.ORIENTATION_PORTRAIT:
setVisibility(View.VISIBLE);
setLayoutParams(mPortraitLayoutParams);
break;
case Configuration.ORIENTATION_UNDEFINED:
MoPubLog.d("Screen orientation undefined: CTA button widget defaulting to portrait layout");
setVisibility(View.VISIBLE);
setLayoutParams(mPortraitLayoutParams);
break;
case Configuration.ORIENTATION_SQUARE:
MoPubLog.d("Screen orientation is deprecated ORIENTATION_SQUARE: CTA button widget defaulting to portrait layout");
setVisibility(View.VISIBLE);
setLayoutParams(mPortraitLayoutParams);
break;
default:
MoPubLog.d("Unrecognized screen orientation: CTA button widget defaulting to portrait layout");
setVisibility(View.VISIBLE);
setLayoutParams(mPortraitLayoutParams);
break;
}
setVisibility(View.VISIBLE);
}

// for testing
Expand Down
Loading

0 comments on commit 06bceb9

Please sign in to comment.