Java Code Examples for com.google.android.gms.ads.AdView#setVisibility()
The following examples show how to use
com.google.android.gms.ads.AdView#setVisibility() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From snippets-android with Apache License 2.0 | 6 votes |
public void executeAdsPolicy() { // [START pred_ads_policy] FirebaseRemoteConfig config = FirebaseRemoteConfig.getInstance(); String adPolicy = config.getString("ads_policy"); boolean will_not_spend = config.getBoolean("will_not_spend"); AdView mAdView = findViewById(R.id.adView); if (adPolicy.equals("ads_always") || (adPolicy.equals("ads_nonspenders") && will_not_spend)) { AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); mAdView.setVisibility(View.VISIBLE); } else { mAdView.setVisibility(View.GONE); } FirebaseAnalytics.getInstance(this).logEvent("ads_policy_set", new Bundle()); // [END pred_ads_policy] }
Example 2
Source File: AdmobBannerRecyclerAdapterWrapper.java From admobadapter with Apache License 2.0 | 6 votes |
@Override public void onAdFailed(int adIdx, int errorCode, Object adPayload) { AdView adView = (AdView) adPayload; if (adView != null) { ViewParent parent = adView.getParent(); if(parent == null || parent instanceof RecyclerView) adView.setVisibility(View.GONE); else { while (parent.getParent() != null && !(parent.getParent() instanceof RecyclerView)) parent = parent.getParent(); ((View) parent).setVisibility(View.GONE); } } int pos = getAdapterCalculator().translateAdToWrapperPosition(Math.max(adIdx,0)); notifyItemRangeChanged(pos, pos+15); }
Example 3
Source File: FragmentWallets.java From Lunary-Ethereum-Wallet with GNU General Public License v3.0 | 5 votes |
@Override public void adHandling(View rootView) { // Ads if (((AnalyticsApplication) ac.getApplication()).isGooglePlayBuild()) { AdView mAdView = (AdView) rootView.findViewById(R.id.adView); if (Settings.displayAds) { MobileAds.initialize(ac, "ca-app-pub-8285849835347571~6235180375"); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); } else { mAdView.setVisibility(View.GONE); } } }
Example 4
Source File: ConditionalAdsActivity.java From snippets-android with Apache License 2.0 | 5 votes |
private void executeAdsPolicy() { boolean showAds = mFirebaseRemoteConfig.getBoolean("ads_enabled"); AdView mAdView = findViewById(R.id.adView); if (showAds) { AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); mAdView.setVisibility(View.VISIBLE); } else { mAdView.setVisibility(View.GONE); } }
Example 5
Source File: AdUtil.java From NMSAlphabetAndroidApp with MIT License | 5 votes |
public static void initBannerAd(Context context, AdView adView){ if(App.isPro(context) || BuildConfig.DEBUG){ adView.setVisibility(View.GONE); } else { adView.loadAd(getAdRequest(context)); } }
Example 6
Source File: AdmobBannerAdapterWrapper.java From admobadapter with Apache License 2.0 | 5 votes |
@Override public void onAdFailed(int adIdx, int errorCode, Object adPayload) { AdView adView = (AdView) adPayload; if (adView != null) { ViewParent parent = adView.getParent(); if(parent == null || parent instanceof ListView) { adView.setVisibility(View.GONE); } else { while (parent.getParent() != null && !(parent.getParent() instanceof ListView)) parent = parent.getParent(); ((View) parent).setVisibility(View.GONE); } } notifyDataSetChanged(); }
Example 7
Source File: BaseActivity.java From fontster with Apache License 2.0 | 4 votes |
private void hideAd(AdView adView) { adView.setVisibility(View.GONE); }