Search in sources :

Example 1 with NativeExpressAdView

use of com.google.android.gms.ads.NativeExpressAdView in project Tapad by berict.

the class AdmobHelper method resumeNativeAdView.

public void resumeNativeAdView(int id, Activity activity) {
    NativeExpressAdView adView = window.getNativeAdView(id, activity);
    if (adView != null) {
        adView.resume();
        Log.d(TAG, "ad resumed");
    }
}
Also used : NativeExpressAdView(com.google.android.gms.ads.NativeExpressAdView)

Example 2 with NativeExpressAdView

use of com.google.android.gms.ads.NativeExpressAdView in project Tapad by berict.

the class AdmobHelper method destroyNativeAdView.

public void destroyNativeAdView(int id, Activity activity) {
    NativeExpressAdView adView = window.getNativeAdView(id, activity);
    if (adView != null) {
        adView.destroy();
        Log.d(TAG, "ad destroyed");
    }
}
Also used : NativeExpressAdView(com.google.android.gms.ads.NativeExpressAdView)

Example 3 with NativeExpressAdView

use of com.google.android.gms.ads.NativeExpressAdView in project Tapad by berict.

the class AdmobHelper method pauseNativeAdView.

public void pauseNativeAdView(int id, Activity activity) {
    NativeExpressAdView adView = window.getNativeAdView(id, activity);
    if (adView != null) {
        adView.pause();
        Log.d(TAG, "ad paused");
    }
}
Also used : NativeExpressAdView(com.google.android.gms.ads.NativeExpressAdView)

Example 4 with NativeExpressAdView

use of com.google.android.gms.ads.NativeExpressAdView in project Tapad by berict.

the class AdmobHelper method setNativeAdViewSize.

public void setNativeAdViewSize(int id, AdSize adSize, Activity activity) {
    NativeExpressAdView adView = window.getNativeAdView(id, activity);
    adView.setAdSize(adSize);
}
Also used : NativeExpressAdView(com.google.android.gms.ads.NativeExpressAdView)

Example 5 with NativeExpressAdView

use of com.google.android.gms.ads.NativeExpressAdView in project LibreraReader by foobnix.

the class ADS method activateAdmobNativeBanner.

public static void activateAdmobNativeBanner(final Activity a, NativeExpressAdView adViewNative) {
    try {
        final FrameLayout frame = (FrameLayout) a.findViewById(R.id.adFrame);
        frame.removeAllViews();
        frame.setVisibility(View.VISIBLE);
        if (adViewNative != null) {
            adViewNative.destroy();
            adViewNative = null;
        }
        adViewNative = new NativeExpressAdView(a);
        adViewNative.setAdUnitId(AppsConfig.ADMOB_NATIVE_BANNER);
        int adSizeHeight = Dips.screenHeightDP() / 9;
        LOG.d("adSizeHeight", adSizeHeight);
        adViewNative.setAdSize(new AdSize(AdSize.FULL_WIDTH, Math.max(82, adSizeHeight)));
        adViewNative.loadAd(ADS.adRequest);
        adViewNative.setAdListener(new AdListener() {

            @Override
            public void onAdFailedToLoad(int arg0) {
                frame.removeAllViews();
            // frame.setVisibility(View.GONE);
            }
        });
        frame.addView(adViewNative);
    } catch (Exception e) {
        LOG.e(e);
    }
}
Also used : NativeExpressAdView(com.google.android.gms.ads.NativeExpressAdView) FrameLayout(android.widget.FrameLayout) AdSize(com.google.android.gms.ads.AdSize) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) AdListener(com.google.android.gms.ads.AdListener)

Aggregations

NativeExpressAdView (com.google.android.gms.ads.NativeExpressAdView)5 FrameLayout (android.widget.FrameLayout)1 AdListener (com.google.android.gms.ads.AdListener)1 AdSize (com.google.android.gms.ads.AdSize)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1