From e5117944fbcf1d940662e412c89c74d44d3399f5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 28 Nov 2011 08:20:29 +0300 Subject: [PATCH] make ads optional --- AndroidManifest.xml | 4 ++-- res/values/strings.xml | 3 ++- res/xml/preferences.xml | 3 ++- src/org/fox/ttrss/ArticleFragment.java | 11 ++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4ce9964f..1dbcc850 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="18" + android:versionName="0.1.17"> diff --git a/res/values/strings.xml b/res/values/strings.xml index edbb8db6..a8e8757b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -51,7 +51,8 @@ Mark unread Optional. Fill this if your tt-rss installation is protected by HTTP Basic authentication Your tt-rss login. Not needed for single user mode - Your tt-rss password + Enable ads + Showing ads to you supports the project URL of your tt-rss installation directory, e.g. http://site.com/tt-rss/ diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 3bc482f3..2dedf632 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -6,7 +6,7 @@ - + @@ -25,6 +25,7 @@ android:entryValues="@array/pref_theme_values" android:summary="@string/pref_theme_long"/> + diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 46d530c2..4a84aef2 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -95,11 +95,16 @@ public class ArticleFragment extends Fragment { } AdView av = (AdView)view.findViewById(R.id.ad); + boolean enableAds = m_prefs.getBoolean("enable_ads", false); if (av != null) { - AdRequest request = new AdRequest(); - request.addTestDevice(AdRequest.TEST_EMULATOR); - av.loadAd(request); + if (enableAds) { + AdRequest request = new AdRequest(); + request.addTestDevice(AdRequest.TEST_EMULATOR); + av.loadAd(request); + } else { + av.setVisibility(View.GONE); + } } }