Android Open Source - snakk-ads-android-sample-app Ad Interstitial View






From Project

Back to project page snakk-ads-android-sample-app.

License

The source code is released under:

Copyright (c) 2012, Snakk! Media Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project snakk-ads-android-sample-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.snakk.adview;
//w w w  . j a v  a2 s  .co  m
import android.content.Context;
import android.view.View;
import android.widget.RelativeLayout;

import java.util.Map;

/**
 * Viewer of interstitial advertising.
 */
public class AdInterstitialView extends AdInterstitialBaseView {
    protected static final float CLOSE_BUTTON_SIZE_DP = 50.0f;
    protected static final float CLOSE_BUTTON_PADDING_DP = 8.0f;

//    protected ImageButton closeButton;

    public AdInterstitialView(Context context, String zone){
        super(context, zone);
        setAdtype("2");
    }

    public AdInterstitialView(Context context, AdRequest adRequest) {
        this(context, adRequest.getZone());
        Map<String, String> cparms = adRequest.getCustomParameters();
        if (cparms != null && !cparms.isEmpty()) {
            setCustomParameters(cparms);
        }
    }

    @Override
    public View getInterstitialView(Context ctx){
//        callingActivityContext = ctx;
        interstitialLayout = new RelativeLayout(ctx);
        final RelativeLayout.LayoutParams adViewLayout = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        adViewLayout.addRule(RelativeLayout.CENTER_IN_PARENT);
        interstitialLayout.addView(this, adViewLayout);
//        showInterstitialCloseButton();
        return interstitialLayout;
    }

//    protected void showInterstitialCloseButton(){
//        StateListDrawable states = new StateListDrawable();
//
//        try {
//            states.addState(new int[]{-android.R.attr.state_pressed}, getResources().getDrawable(android.R.drawable.ic_notification_clear_all));
//        } catch (RuntimeException e){
//            e.printStackTrace();
//        }
//        closeButton = new ImageButton(context);
//        closeButton.setImageDrawable(states);
//        closeButton.setBackgroundDrawable(null);
//        closeButton.setOnClickListener(new OnClickListener() {
//            public void onClick(View v){
//                closeInterstitial();
//            }
//        });
//
//        final float scale = getResources().getDisplayMetrics().density;
//        int buttonSize = (int) (CLOSE_BUTTON_SIZE_DP * scale + 0.5f);
//        int buttonPadding = (int) (CLOSE_BUTTON_PADDING_DP * scale + 0.5f);
//        RelativeLayout.LayoutParams buttonLayout = new RelativeLayout.LayoutParams(
//                buttonSize, buttonSize);
//        buttonLayout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
//        buttonLayout.setMargins(buttonPadding, 0, buttonPadding, 0);
//        interstitialLayout.removeView(closeButton);
//        interstitialLayout.addView(closeButton, buttonLayout);
//    }
//
//    @Override
//    public void click(String url){
//        closeButton.setVisibility(GONE);
//        super.click(url);
//    }

    @Override
    public void end(AdViewCore adView){
        super.end(adView);
    }

    @Override
    public void didResize(AdViewCore adView) {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}




Java Source Code List

com.snakk.advertising.Config.java
com.snakk.advertising.SnakkAdPrompt.java
com.snakk.advertising.SnakkAdRequest.java
com.snakk.advertising.SnakkAdvertising.java
com.snakk.advertising.SnakkBannerAdView.java
com.snakk.advertising.SnakkInterstitialAd.java
com.snakk.advertising.SnakkVideoInterstitialAd.java
com.snakk.advertising.internal.AbstractStatefulAd.java
com.snakk.advertising.internal.AdActivityContentWrapper.java
com.snakk.advertising.internal.AdPromptImpl.java
com.snakk.advertising.internal.AdRequestImpl.java
com.snakk.advertising.internal.BasicWebView.java
com.snakk.advertising.internal.DeviceCapabilities.java
com.snakk.advertising.internal.InterstitialAdImpl.java
com.snakk.advertising.internal.InterstitialBaseView.java
com.snakk.advertising.internal.Sharable.java
com.snakk.advertising.internal.SnakkAdActivity.java
com.snakk.advertising.internal.VastPlayerView.java
com.snakk.advertising.internal.VideoInterstitialAdImpl.java
com.snakk.advertising.package-info.java
com.snakk.adview.AdFullscreenView.java
com.snakk.adview.AdInterstitialBaseView.java
com.snakk.adview.AdInterstitialView.java
com.snakk.adview.AdLog.java
com.snakk.adview.AdOfferWallView.java
com.snakk.adview.AdPrompt.java
com.snakk.adview.AdRequest.java
com.snakk.adview.AdVideoUnitView.java
com.snakk.adview.AdViewCore.java
com.snakk.adview.AdView.java
com.snakk.adview.AutoDetectedParametersSet.java
com.snakk.adview.Base64.java
com.snakk.adview.DeprecatedInterstitialBaseView.java
com.snakk.adview.IMraidCommand.java
com.snakk.adview.LockedOrientationDialog.java
com.snakk.adview.MraidCommand.java
com.snakk.adview.Mraid.java
com.snakk.adview.OldAdActivity.java
com.snakk.adview.Rotate3dAnimation.java
com.snakk.adview.Utils.java
com.snakk.adview.track.EventTracker.java
com.snakk.adview.track.InstallTracker.java
com.snakk.adview.package-info.java
com.snakk.core.SnakkLog.java
com.snakk.vastsdk.TVASTAdErrorEvent.java
com.snakk.vastsdk.TVASTAdErrorListener.java
com.snakk.vastsdk.TVASTAdError.java
com.snakk.vastsdk.TVASTAdType.java
com.snakk.vastsdk.TVASTAdView.java
com.snakk.vastsdk.TVASTAd.java
com.snakk.vastsdk.TVASTAdsLoader.java
com.snakk.vastsdk.TVASTAdsRequest.java
com.snakk.vastsdk.TVASTCompanionAdSlot.java
com.snakk.vastsdk.TVASTCompanionAd.java
com.snakk.vastsdk.TVASTCreative.java
com.snakk.vastsdk.TVASTLinearAd.java
com.snakk.vastsdk.TVASTLinearIcon.java
com.snakk.vastsdk.TVASTMediaFile.java
com.snakk.vastsdk.TVASTNonlinearAd.java
com.snakk.vastsdk.TVASTPostbackTask.java
com.snakk.vastsdk.TVASTUtils.java
com.snakk.vastsdk.TVASTVideoAdsManager.java
com.snakk.vastsdk.player.TVASTPlayer.java
com.snakk.vastsdk.player.TVASTSharable.java
com.snakk.vastsdk.player.TVASTTrackingVideoView.java
com.snakk.vastsdk.player.TVASTVideoProgressThread.java
com.snakkads.tabsswipe.BannerAdPromptFragment.java
com.snakkads.tabsswipe.BannerInterstitialFragment.java
com.snakkads.tabsswipe.BannerRichMediaFragment.java
com.snakkads.tabsswipe.BannerStandardMediaFragment.java
com.snakkads.tabsswipe.BannerVideoFragment.java
com.snakkads.tabsswipe.MainActivity.java
com.snakkads.tabsswipe.SplashScreen.java
com.snakkads.tabsswipe.adapter.TabsPagerAdapter.java
com.yourcompany.AdMobActivity.java
com.yourcompany.SampleActivity.java