From fed0059091902592606bfb3c449f445b454f4432 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 16 Mar 2016 17:31:08 -0700 Subject: [PATCH] Update Privacy Mode icons and convert toasts to snackbars. --- app/src/main/assets/about_text.html | 16 +++---- .../privacybrowser/MainWebViewActivity.java | 43 ++++++++----------- .../main/res/drawable/javascript_enabled.xml | 21 ++++----- app/src/main/res/drawable/privacy_mode.xml | 21 ++++----- app/src/main/res/drawable/warning.xml | 21 ++++----- app/src/main/res/drawable/world.xml | 2 +- app/src/main/res/values/strings.xml | 10 ++++- 7 files changed, 58 insertions(+), 76 deletions(-) diff --git a/app/src/main/assets/about_text.html b/app/src/main/assets/about_text.html index 7ba3d0b8..fc6db0a3 100644 --- a/app/src/main/assets/about_text.html +++ b/app/src/main/assets/about_text.html @@ -6,18 +6,12 @@

Privacy Browser is released under the GPLv3+ license. The full text of the license is below.

-

/app/src/main/res/mipmap-*/privacy_browser.png, /app/src/main/res/privacy-browser-web.png, /app/src/free/mipmap-*/privacy_browser.png, and /app/src/free/res/privacy_browser-web.png - are derived from ic_security and ic_language, which are part of the Android Material icon set. - They are released under the CC-BY license. Modification were made by Soren Stoutner in 2016.

+

app/src/main/res/mipmap-*/privacy_browser.png and app/src/free/mipmap-*/privacy_browser.png are derived from ic_security and ic_language, which are part of the Android Material icon set. + They are released under the CC-BY license. Modifications were made by Soren Stoutner in 2016.

-

/app/src/main/res/drawable/javascript_enabled.xml is part of the Android Material icon set, where it is named ic_visibility. - It is released under the CC-BY license. Changes to fill color and size were made by Soren Stoutner in 2016.

- -

/app/src/main/res/drawable/warning.xml is part of the Android Material icon set, where it is named ic_visibility. - It is released under the CC-BY license. Changes to fill color and size were made by Soren Stoutner in 2016.

- -

/app/src/main/res/drawable/privacy_mode.xml is part of the Android Material icon set, where it is named ic_visibility_off. - It is released under the CC-BY license. Changes to fill color and size were made by Soren Stoutner in 2016.

+

app/src/main/res/drawable/javascript_enabled.xml, app/src/main/res/drawable/warning.xml, and app/src/main/res/drawable/privacy_mode.xml are derived from ic_security, + which is part of the Android Material icon set. It is released under the CC-BY license. + Modifications were made by Soren Stoutner in 2016.

/app.src/main/res/drawable/world.xml is part of the Android Material icon set, where it is named ic_language. It is released under the CC-BY license. Changes to fill color and size were made by Soren Stoutner in 2016.

diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java index 2919a222..61b208a8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java @@ -30,6 +30,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.design.widget.Snackbar; import android.support.v4.app.DialogFragment; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBar; @@ -102,7 +103,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome setSupportActionBar(supportAppBar); final FrameLayout fullScreenVideoFrameLayout = (FrameLayout) findViewById(R.id.fullScreenVideoFrameLayout); - final Activity mainWebViewActivity = this; + // We need to use the SupportActionBar from android.support.v7.app.ActionBar until the minimum API is >= 21. final ActionBar appBar = getSupportActionBar(); @@ -156,12 +157,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome return true; } - /* These errors do not provide any useful information and clutter the screen. - public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { - Toast.makeText(mainWebViewActivity, "Error loading " + request + " Error: " + error, Toast.LENGTH_SHORT).show(); - } - */ - // Update the URL in urlTextBox when the page starts to load. @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { @@ -281,7 +276,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome } downloadManager.enqueue(requestUri); - Toast.makeText(mainWebViewActivity, R.string.download_started, Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.download_started, Snackbar.LENGTH_SHORT).show(); } }); @@ -439,28 +434,28 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome mainWebView.getSettings().setJavaScriptEnabled(false); mainWebView.reload(); - // Update the toggleJavaScript icon and display a toast message. + // Update the toggleJavaScript icon and display a snackbar. if (domStorageEnabled || cookiesEnabled) { menuItem.setIcon(R.drawable.warning); if (domStorageEnabled && cookiesEnabled) { - Toast.makeText(getApplicationContext(), "JavaScript disabled, DOM Storage and Cookies still enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.both_still_enabled, Snackbar.LENGTH_SHORT).show(); } else { if (domStorageEnabled) { - Toast.makeText(getApplicationContext(), "JavaScript disabled, DOM Storage still enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_still_enabled, Snackbar.LENGTH_SHORT).show(); } else { - Toast.makeText(getApplicationContext(), "JavaScript disabled, Cookies still enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_still_enabled, Snackbar.LENGTH_SHORT).show(); } } } else { menuItem.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show(); } } else { javaScriptEnabled = true; menuItem.setIcon(R.drawable.javascript_enabled); mainWebView.getSettings().setJavaScriptEnabled(true); mainWebView.reload(); - Toast.makeText(getApplicationContext(), "JavaScript enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.javascript_enabled, Snackbar.LENGTH_SHORT).show(); } return true; @@ -471,14 +466,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome mainWebView.getSettings().setDomStorageEnabled(false); mainWebView.reload(); - // Update the toggleJavaScript icon and display a toast message if appropriate. + // Update the toggleJavaScript icon and display a snackbar if appropriate. if (!javaScriptEnabled && !cookiesEnabled) { toggleJavaScript.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show(); } else { if (cookiesEnabled) { toggleJavaScript.setIcon(R.drawable.warning); - Toast.makeText(getApplicationContext(), "Cookies still enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_still_enabled, Snackbar.LENGTH_SHORT).show(); } // Else Do nothing because JavaScript is enabled. } } else { @@ -492,7 +487,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome toggleJavaScript.setIcon(R.drawable.warning); } // Else Do nothing because JavaScript is enabled. - Toast.makeText(getApplicationContext(), "DOM Storage enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_enabled, Snackbar.LENGTH_SHORT).show(); } return true; @@ -519,14 +514,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome cookieManager.setAcceptCookie(false); mainWebView.reload(); - // Update the toggleJavaScript icon and display a toast message if appropriate. + // Update the toggleJavaScript icon and display a snackbar if appropriate. if (!javaScriptEnabled && !domStorageEnabled) { toggleJavaScript.setIcon(R.drawable.privacy_mode); - Toast.makeText(getApplicationContext(), R.string.privacy_mode, Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.privacy_mode, Snackbar.LENGTH_SHORT).show(); } else { if (domStorageEnabled) { toggleJavaScript.setIcon(R.drawable.warning); - Toast.makeText(getApplicationContext(), "DOM Storage still enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_enabled, Snackbar.LENGTH_SHORT).show(); } // Else Do nothing because JavaScript is enabled. } } else { @@ -540,14 +535,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome toggleJavaScript.setIcon(R.drawable.warning); } // Else Do nothing because JavaScript is enabled. - Toast.makeText(getApplicationContext(), "Cookies enabled", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_enabled, Snackbar.LENGTH_SHORT).show(); } return true; case R.id.clearDomStorage: WebStorage webStorage = WebStorage.getInstance(); webStorage.deleteAllData(); - Toast.makeText(getApplicationContext(), "DOM storage deleted", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.dom_storage_deleted, Snackbar.LENGTH_SHORT).show(); return true; case R.id.clearCookies: @@ -556,7 +551,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome } else { cookieManager.removeAllCookies(null); } - Toast.makeText(getApplicationContext(), "Cookies deleted", Toast.LENGTH_SHORT).show(); + Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_deleted, Snackbar.LENGTH_SHORT).show(); return true; case R.id.addToHomescreen: diff --git a/app/src/main/res/drawable/javascript_enabled.xml b/app/src/main/res/drawable/javascript_enabled.xml index b4162402..fd4524a1 100644 --- a/app/src/main/res/drawable/javascript_enabled.xml +++ b/app/src/main/res/drawable/javascript_enabled.xml @@ -1,16 +1,11 @@ + javascript_enabled.xml is derived from ic_security, which is part of the Android Material icon set. + It is released under the CC-BY license . Modifications were made by Soren Stoutner in 2016. --> - - - - + + + diff --git a/app/src/main/res/drawable/privacy_mode.xml b/app/src/main/res/drawable/privacy_mode.xml index 30bf3928..0a5744e5 100644 --- a/app/src/main/res/drawable/privacy_mode.xml +++ b/app/src/main/res/drawable/privacy_mode.xml @@ -1,16 +1,11 @@ + privacy_mode.xml is derived from ic_security, which is part of the Android Material icon set. + It is released under the CC-BY license . Modifications were made by Soren Stoutner in 2016. --> - - - - + + + diff --git a/app/src/main/res/drawable/warning.xml b/app/src/main/res/drawable/warning.xml index 9df2bc09..5c4adf30 100644 --- a/app/src/main/res/drawable/warning.xml +++ b/app/src/main/res/drawable/warning.xml @@ -1,16 +1,11 @@ + warning.xml is derived from ic_security, which is part of the Android Material icon set. + It is released under the CC-BY license . Modifications were made by Soren Stoutner in 2016. --> - - - - + + + diff --git a/app/src/main/res/drawable/world.xml b/app/src/main/res/drawable/world.xml index c923d9a2..9e06879d 100644 --- a/app/src/main/res/drawable/world.xml +++ b/app/src/main/res/drawable/world.xml @@ -1,7 +1,7 @@ + Changes to fill color and size were made by Soren Stoutner in 2016. --> Privacy Browser Settings - Privacy Mode Download started + Privacy Mode + JavaScript enabled + DOM Storage enabled + Cookies enabled + JavaScript disabled, DOM Storage still enabled + Cookies still enabled + JavaScript disabled, DOM Storage and Cookies still enabled + DOM Storage deleted + Cookies deleted Favorite Icon -- 2.45.2