make ads optional

This commit is contained in:
Andrew Dolgov 2011-11-28 08:20:29 +03:00
parent d791a7222b
commit e5117944fb
4 changed files with 14 additions and 7 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="17"
android:versionName="0.1.16">
android:versionCode="18"
android:versionName="0.1.17">
<uses-sdk android:minSdkVersion="8" />
<!-- <supports-screens android:smallScreens="false" android:normalScreens="false" /> -->

View File

@ -51,7 +51,8 @@
<string name="set_unread">Mark unread</string>
<string name="http_login_summary">Optional. Fill this if your tt-rss installation is protected by HTTP Basic authentication</string>
<string name="login_summary">Your tt-rss login. Not needed for single user mode</string>
<string name="password_summary">Your tt-rss password</string>
<string name="enable_ads">Enable ads</string>
<string name="enable_ads_summary">Showing ads to you supports the project</string>
<string name="ttrss_url_summary">URL of your tt-rss installation directory, e.g. http://site.com/tt-rss/</string>
</resources>

View File

@ -6,7 +6,7 @@
<PreferenceCategory android:title="@string/connection">
<EditTextPreference android:summary="@string/login_summary" android:title="@string/login" android:key="login" android:singleLine="true"></EditTextPreference>
<EditTextPreference android:summary="@string/password_summary" android:title="@string/password" android:key="password" android:singleLine="true" android:password="true"></EditTextPreference>
<EditTextPreference android:title="@string/password" android:key="password" android:singleLine="true" android:password="true"></EditTextPreference>
<EditTextPreference android:summary="@string/ttrss_url_summary" android:key="ttrss_url" android:title="@string/ttrss_url" android:singleLine="true" textUri="true" android:hint="@string/default_url"></EditTextPreference>
<CheckBoxPreference android:defaultValue="false" android:title="@string/ssl_trust_any" android:key="ssl_trust_any" />
</PreferenceCategory>
@ -25,6 +25,7 @@
android:entryValues="@array/pref_theme_values" android:summary="@string/pref_theme_long"/>
<CheckBoxPreference android:title="@string/sort_feeds_by_unread" android:key="sort_feeds_by_unread"/>
<CheckBoxPreference android:defaultValue="false" android:summary="@string/enable_ads_summary" android:title="@string/enable_ads" android:key="enable_ads" />
</PreferenceCategory>

View File

@ -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);
}
}
}