Skip to content

Commit

Permalink
Version 3.13.1 of the Google Mobile Ads Unity plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rampara committed Apr 13, 2018
1 parent d9196de commit 08602b2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
Google Mobile Ads Unity Plugin Change Log

**************
Version 3.13.1
**************

Plugin:
- Fixed issue where banner ads reposition to top of screen after a full
screen ad is displayed.

Built and tested with:
- Google Play services 12.0.1
- Google Mobile Ads iOS SDK 7.30.0
- Unity Jar Resolver 1.2.64.0

**************
Version 3.13.0
**************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Point;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.PopupWindow;

Expand Down Expand Up @@ -90,6 +92,12 @@ public class Banner {
*/
private View.OnLayoutChangeListener mLayoutChangeListener;

/**
* A {@code ViewTreeObserver.OnGlobalLayoutListener} used to detect if a full screen ad was
* shown while a banner ad was on screen.
*/
private ViewTreeObserver.OnGlobalLayoutListener mViewTreeLayoutChangeListener;


/**
* Creates an instance of {@code Banner}.
Expand Down Expand Up @@ -204,6 +212,16 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom,
};
mUnityPlayerActivity.getWindow().getDecorView().getRootView()
.addOnLayoutChangeListener(mLayoutChangeListener);

// Workaround for issue where ad view will be repositioned to the top of the screen after
// a full screen ad is shown on some devices.
mViewTreeLayoutChangeListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
updatePosition();
}
};
mAdView.getViewTreeObserver().addOnGlobalLayoutListener(mViewTreeLayoutChangeListener);
}

private void createPopupWindow() {
Expand Down Expand Up @@ -305,6 +323,13 @@ public void run() {

mUnityPlayerActivity.getWindow().getDecorView().getRootView()
.removeOnLayoutChangeListener(mLayoutChangeListener);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mAdView.getViewTreeObserver()
.removeOnGlobalLayoutListener(mViewTreeLayoutChangeListener);
} else {
mAdView.getViewTreeObserver().removeGlobalOnLayoutListener(mViewTreeLayoutChangeListener);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace GoogleMobileAds.Api
{
public class AdRequest
{
public const string Version = "3.13.0";
public const string Version = "3.13.1";
public const string TestDeviceSimulator = "SIMULATOR";

private AdRequest(Builder builder)
Expand Down

0 comments on commit 08602b2

Please sign in to comment.