From 1d4c780f50208b06621765132c4272393d74cae1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 27 Nov 2011 19:04:25 +0300 Subject: [PATCH] use test mode ads on emulator --- res/layout/article_fragment.xml | 4 ++-- src/org/fox/ttrss/ArticleFragment.java | 11 +++++++++++ src/org/fox/ttrss/MainActivity.java | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/res/layout/article_fragment.xml b/res/layout/article_fragment.xml index a24db6c3..29334931 100644 --- a/res/layout/article_fragment.xml +++ b/res/layout/article_fragment.xml @@ -25,7 +25,7 @@ + ads:loadAdOnCreate="false" /> diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 7297daa1..46d530c2 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -16,6 +16,9 @@ import android.view.ViewGroup; import android.webkit.WebView; import android.widget.TextView; +import com.google.ads.AdRequest; +import com.google.ads.AdView; + public class ArticleFragment extends Fragment { @SuppressWarnings("unused") private final String TAG = this.getClass().getSimpleName(); @@ -90,6 +93,14 @@ public class ArticleFragment extends Fragment { if (cv != null) { cv.setVisibility(View.GONE); } + + AdView av = (AdView)view.findViewById(R.id.ad); + + if (av != null) { + AdRequest request = new AdRequest(); + request.addTestDevice(AdRequest.TEST_EMULATOR); + av.loadAd(request); + } } return view; diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 49b3db03..08971d59 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -1,6 +1,7 @@ package org.fox.ttrss; import java.util.HashMap; + import java.util.Timer; import java.util.TimerTask;