Skip to content

Commit

Permalink
HUP-619-639 phase1 of banner ads test
Browse files Browse the repository at this point in the history
  • Loading branch information
bunyamineymen committed Apr 17, 2023
1 parent 41b154f commit 342f042
Showing 1 changed file with 6 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public BannerAdProxy(Activity activity, IAdStatusListener listener) {

if(width>height)
{
bannerViewWidth = (int) (width*0.55);
bannerViewHeight= (int) (height*0.20);
bannerViewWidth = (int) (width*0.605);
bannerViewHeight= (int) (height*0.18);
}
else
{
Expand All @@ -78,14 +78,6 @@ public void setAdSizeType(String adSizeType) {
mAdSizeType = adSizeType;
}

/*
public void setBannerRefresh(long interval) {
bannerRefresh = interval;
if (bannerView != null)
bannerView.setBannerRefresh(interval);
}
*/

public void loadAd(final AdParam adRequest) {
mMainThreadHandler.post(new Runnable() {
@Override
Expand Down Expand Up @@ -234,7 +226,6 @@ public void onAdLoaded() {
@Override
public void run() {
if (!mIsHide && mBannerView != null) {
//show();
}
if (mAdListener != null) {
mAdListener.onAdLoaded();
Expand Down Expand Up @@ -322,11 +313,6 @@ private BannerAdSize getUserDefinedBannerSize() {

private FrameLayout.LayoutParams getBannerViewLayoutParams(int width,int height) {

/*
final FrameLayout.LayoutParams adParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
*/

final FrameLayout.LayoutParams adParams = new FrameLayout.LayoutParams(width, height);

adParams.gravity = Const.BannerAdPositionCode.getLayoutGravityForPositionCode(mPositionCode);
Expand All @@ -342,53 +328,23 @@ private FrameLayout.LayoutParams getBannerViewLayoutParams(int width,int height)
topOffset = safeInsetTop;
}

//adParams.leftMargin = leftOffset;
adParams.leftMargin = 0;
//adParams.topMargin = topOffset;
adParams.topMargin = (int)(mActivity.getWindow().getDecorView().getHeight()*0.06);//topOffset;

} else {
adParams.leftMargin = safeInsetLeft;
if (mPositionCode == Const.BannerAdPositionCode.POSITION_TOP
|| mPositionCode == Const.BannerAdPositionCode.POSITION_TOP_LEFT
|| mPositionCode == Const.BannerAdPositionCode.POSITION_TOP_RIGHT) {
adParams.topMargin = safeInsetTop;
}
else
{
adParams.bottomMargin = 0;
}
}
return adParams;
}

/*
private FrameLayout.LayoutParams getBannerViewLayoutParams(int width,int height) {
Log.d(TAG,"getBannerViewLayoutParams Width:"+width+" Height:"+height);
final FrameLayout.LayoutParams adParams =
new FrameLayout.LayoutParams(width, height);
adParams.gravity = UnityBannerAdPositionCode.getLayoutGravityForPositionCode(positionCode);
int safeInsetLeft = 0;
int safeInsetTop = 0;//(int)(height*0.35);
if (positionCode == UnityBannerAdPositionCode.POSITION_CUSTOM) {
int leftOffset = (int) convertDpToPx(horizontalOffset);
if (leftOffset < safeInsetLeft) {
leftOffset = safeInsetLeft;
}
int topOffset = (int) convertDpToPx(verticalOffset);
if (topOffset < safeInsetTop) {
topOffset = safeInsetTop;
}
adParams.leftMargin = 0;//leftOffset;
adParams.topMargin = (int)(activity.getWindow().getDecorView().getHeight()*0.06);//topOffset;
} else {
adParams.leftMargin = safeInsetLeft;
if (positionCode == UnityBannerAdPositionCode.POSITION_TOP
|| positionCode == UnityBannerAdPositionCode.POSITION_TOP_LEFT
|| positionCode == UnityBannerAdPositionCode.POSITION_TOP_RIGHT) {
adParams.topMargin = safeInsetTop;
}
}
return adParams;
}
*/

private void updatePosition() {
mMainThreadHandler.post(new Runnable() {
@Override
Expand Down

0 comments on commit 342f042

Please sign in to comment.