AdView now is shown only after the loading is done
This commit is contained in:
parent
a6577a70b7
commit
477e99eec6
@ -50,11 +50,10 @@ public class AdView extends FrameLayout {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisibility(VISIBLE);
|
|
||||||
|
|
||||||
LayoutInflater.from(getContext()).inflate(R.layout.admob, this);
|
LayoutInflater.from(getContext()).inflate(R.layout.admob, this);
|
||||||
admobView = (com.google.android.gms.ads.AdView) findViewById(R.id.admob);
|
admobView = (com.google.android.gms.ads.AdView) findViewById(R.id.admob);
|
||||||
admobView.setVisibility(View.VISIBLE);
|
if (admobView == null) throw new AssertionError();
|
||||||
|
|
||||||
admobView.setAdListener(new AdListener() {
|
admobView.setAdListener(new AdListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAdFailedToLoad(int errorCode) {
|
public void onAdFailedToLoad(int errorCode) {
|
||||||
@ -63,6 +62,10 @@ public class AdView extends FrameLayout {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAdLoaded() {
|
public void onAdLoaded() {
|
||||||
|
if (admobView != null) {
|
||||||
|
admobView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user