From: Soren Stoutner Date: Tue, 23 Feb 2016 05:10:01 +0000 (-0700) Subject: Create standard and free flavors. Add AdMob advertisements to the free flavor. X-Git-Tag: v1.0~1 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=13af786f465d2893b650cf848b65524dda58ade5;p=PrivacyBrowserAndroid.git Create standard and free flavors. Add AdMob advertisements to the free flavor. --- diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index db1251c7..75d1eb64 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -3,6 +3,7 @@ duckduckgo privacybrowser + recents rehide rehides soren diff --git a/app/app.iml b/app/app.iml index 41cbfa77..3fa1af5a 100644 --- a/app/app.iml +++ b/app/app.iml @@ -8,48 +8,60 @@ - - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -74,6 +86,8 @@ + + @@ -92,7 +106,9 @@ + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f741400b..9cb5c59c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,9 +1,29 @@ +/** + * Copyright 2016 Soren Stoutner . + * + * This file is part of Privacy Browser. + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + apply plugin: 'com.android.application' android { + signingConfigs { + } compileSdkVersion 23 buildToolsVersion "23.0.2" - defaultConfig { applicationId "com.stoutner.privacybrowser" minSdkVersion 10 @@ -11,13 +31,23 @@ android { versionCode 1 versionName "1.0" } - buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + productFlavors { + standard { + applicationId "com.stoutner.privacybrowser.standard" + versionName "1.0-standard" + } + + free { + applicationId "com.stoutner.privacybrowser.free" + versionName "1.0-free" + } + } } dependencies { @@ -25,4 +55,5 @@ dependencies { compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:support-v4:23.1.1' + compile 'com.google.android.gms:play-services-ads:8.4.0' } diff --git a/app/src/free/res/layout/ad_view.xml b/app/src/free/res/layout/ad_view.xml new file mode 100644 index 00000000..13adbaed --- /dev/null +++ b/app/src/free/res/layout/ad_view.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/free/res/values/strings.xml b/app/src/free/res/values/strings.xml new file mode 100644 index 00000000..db5ac09c --- /dev/null +++ b/app/src/free/res/values/strings.xml @@ -0,0 +1,28 @@ + + + + + + + Privacy Browser Free + + + true + ca-app-pub-5962503714887045/2738552414 + \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index febfeaf6..773f0a88 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,28 +21,34 @@ + + + + + android:icon="@mipmap/ic_launcher" + android:theme="@style/AppTheme" + android:allowBackup="false" + android:fullBackupContent="false" > + + android:persistableMode="persistNever" > @@ -59,10 +65,12 @@ + + android:parentActivityName=".MainWebViewActivity" + android:persistableMode="persistNever" > = 21. final ActionBar appBar = getSupportActionBar(); + // Setup the AdView for the free flavor. + final AdView adView = (AdView) findViewById(R.id.adView); + // Implement swipe to refresh final SwipeRefreshLayout swipeToRefresh = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout); swipeToRefresh.setColorSchemeResources(R.color.blue); @@ -211,11 +218,18 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome appBar.hide(); } + // Show the fullScreenVideoFrameLayout. fullScreenVideoFrameLayout.addView(view); fullScreenVideoFrameLayout.setVisibility(View.VISIBLE); + // Hide the mainWebView. mainWebView.setVisibility(View.GONE); + // Hide the add if this is the free flavor. + if (getString(R.string.free_flavor).equals("true")) { + adView.setVisibility(View.GONE); + } + /* SYSTEM_UI_FLAG_HIDE_NAVIGATION hides the navigation bars on the bottom or right of the screen. ** SYSTEM_UI_FLAG_FULLSCREEN hides the status bar across the top of the screen. ** SYSTEM_UI_FLAG_IMMERSIVE_STICKY makes the navigation and status bars ghosted overlays and automatically rehides them. @@ -243,8 +257,15 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome appBar.show(); } + // Show the mainWebView. mainWebView.setVisibility(View.VISIBLE); + // Show the adView if this is the free flavor. + if (getString(R.string.free_flavor).equals("true")) { + adView.setVisibility(View.VISIBLE); + } + + // Hide the fullScreenVideoFrameLayout. fullScreenVideoFrameLayout.removeAllViews(); fullScreenVideoFrameLayout.setVisibility(View.GONE); } @@ -323,6 +344,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // Load the initial website. mainWebView.loadUrl(formattedUrlString); + + // Load the ad if this is the free flavor. + if (getString(R.string.free_flavor).equals("true")) { + AdRequest adRequest = new AdRequest.Builder().build(); + adView.loadAd(adRequest); + } } @Override @@ -436,7 +463,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome } } else { menuItem.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), "Privacy Mode", Toast.LENGTH_SHORT).show(); + Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); } } else { javaScriptEnabled = true; @@ -457,7 +484,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // Update the toggleJavaScript icon and display a toast message if appropriate. if (!javaScriptEnabled && !cookiesEnabled) { toggleJavaScript.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), "Privacy Mode", Toast.LENGTH_SHORT).show(); + Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); } else { if (cookiesEnabled) { toggleJavaScript.setIcon(R.drawable.warning); @@ -505,7 +532,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // Update the toggleJavaScript icon and display a toast message if appropriate. if (!javaScriptEnabled && !domStorageEnabled) { toggleJavaScript.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), "Privacy Mode", Toast.LENGTH_SHORT).show(); + Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); } else { if (domStorageEnabled) { toggleJavaScript.setIcon(R.drawable.warning); diff --git a/app/src/main/java/com/stoutner/privacybrowser/SettingsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/SettingsActivity.java index 287237be..0a0357b6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/SettingsActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/SettingsActivity.java @@ -21,7 +21,6 @@ package com.stoutner.privacybrowser; import android.os.Bundle; import android.preference.PreferenceActivity; -import android.support.v7.widget.Toolbar; // Once the minimum API is >= 11 we can switch from the deprecated PreferenceActivity to using a PreferenceFragment. public class SettingsActivity extends PreferenceActivity { diff --git a/app/src/main/res/layout/activity_webview.xml b/app/src/main/res/layout/activity_webview.xml index d90adc7c..0efd90f6 100644 --- a/app/src/main/res/layout/activity_webview.xml +++ b/app/src/main/res/layout/activity_webview.xml @@ -44,22 +44,7 @@ app:popupTheme="@style/AppTheme.PopupOverlay" /> - - - - - - - + Privacy Browser Privacy Browser Settings + + false + + + Privacy Mode + Favorite Icon diff --git a/app/src/standard/res/layout/ad_view.xml b/app/src/standard/res/layout/ad_view.xml new file mode 100644 index 00000000..e4d6784e --- /dev/null +++ b/app/src/standard/res/layout/ad_view.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file