AdView now is shown only after the loading is done
This commit is contained in:
		@@ -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);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user