]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Update Privacy Mode icons and convert toasts to snackbars.
authorSoren Stoutner <soren@stoutner.com>
Thu, 17 Mar 2016 00:31:08 +0000 (17:31 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 17 Mar 2016 00:31:08 +0000 (17:31 -0700)
app/src/main/assets/about_text.html
app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java
app/src/main/res/drawable/javascript_enabled.xml
app/src/main/res/drawable/privacy_mode.xml
app/src/main/res/drawable/warning.xml
app/src/main/res/drawable/world.xml
app/src/main/res/values/strings.xml

index 7ba3d0b8072548fb72ef7a00c031a923e02bf7f0..fc6db0a3173c62052f26aca4a4e0499ebe9528a1 100644 (file)
@@ -6,18 +6,12 @@
 
 <p>Privacy Browser is released under the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPLv3+ license</a>.  The full text of the license is below.</p>
 
-<p>/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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Modification were made by Soren Stoutner in 2016.</p>
+<p>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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Modifications were made by Soren Stoutner in 2016.</p>
 
-<p>/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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Changes to fill color and size were made by Soren Stoutner in 2016.</p>
-
-<p>/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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Changes to fill color and size were made by Soren Stoutner in 2016.</p>
-
-<p>/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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Changes to fill color and size were made by Soren Stoutner in 2016.</p>
+<p>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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.
+    Modifications were made by Soren Stoutner in 2016.</p>
 
 <p>/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 <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.  Changes to fill color and size were made by Soren Stoutner in 2016.</p>
index 2919a2229d3297bc5baa13f1a19587ac6805deb6..61b208a84b589b13e7142d7911050aeaa9d73aa8 100644 (file)
@@ -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:
index b41624023e3fa9a3ad0a4d9b51f2b4868517c270..fd4524a1b5f14de395454b38c6a7779a1d48aa3e 100644 (file)
@@ -1,16 +1,11 @@
 <!--
-  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 <https://creativecommons.org/licenses/by/4.0/>.
-  Changes to fill color were made by Soren Stoutner in 2016. -->
+  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 <https://creativecommons.org/licenses/by/4.0/>.  Modifications were made by Soren Stoutner <soren@stoutner.com> in 2016. -->
 
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="26dp"
-        android:height="26dp"
-        android:viewportWidth="26.0"
-        android:viewportHeight="26.0">
-
-    <!-- The fillColor must be hardcoded in this file until the minimum API is >= 22.  Then the resources in colors.xml may be used instead. -->
-    <path
-        android:fillColor="#FFD50000"
-        android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zm0,-8c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
+<vector android:height="26dp" android:viewportHeight="256.0"
+    android:viewportWidth="256.0" android:width="26dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillAlpha="1" android:fillColor="#b71c1c"
+        android:pathData="m128,12.8 l-94.25,41.89 0,62.84c0,58.12 40.22,112.48 94.25,125.67 54.04,-13.2 94.25,-67.55 94.25,-125.67l0,-62.84z" android:strokeColor="#00000000"/>
+    <path android:fillAlpha="1" android:fillColor="#d32f2f"
+        android:pathData="m128,0 l-104.73,46.55 0,69.82C23.27,180.95 67.96,241.34 128,256 188.04,241.34 232.73,180.95 232.73,116.36l0,-69.82L128,0ZM128,127.88 L209.45,127.88C203.29,175.83 171.29,218.53 128,231.91l0,-103.91 -81.45,0 0,-66.33L128,25.48l0,102.4z" android:strokeColor="#00000000"/>
 </vector>
index 30bf392805a0c124521b6d35e662e4416d6abaa2..0a5744e5ee34e1872515183cadfe71f26cc43e41 100644 (file)
@@ -1,16 +1,11 @@
 <!--
-  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 <https://creativecommons.org/licenses/by/4.0/>.
-  Changes to fill color and size were made by Soren Stoutner in 2016. -->
+  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 <https://creativecommons.org/licenses/by/4.0/>.  Modifications were made by Soren Stoutner <soren@stoutner.com> in 2016. -->
 
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="26dp"
-        android:height="26dp"
-        android:viewportWidth="26.0"
-        android:viewportHeight="26.0">
-
-    <!-- The fillColor must be hardcoded in this file until the minimum API is >= 22.  Then the resources in colors.xml may be used instead. -->
-    <path
-        android:fillColor="#FF64DD17"
-        android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zm4.31,-0.78l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/>
+<vector android:height="26dp" android:viewportHeight="256.0"
+    android:viewportWidth="256.0" android:width="26dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillAlpha="1" android:fillColor="#0d4781"
+        android:pathData="m128,12.8 l-94.25,41.89 0,62.84c0,58.12 40.22,112.48 94.25,125.67 54.04,-13.2 94.25,-67.55 94.25,-125.67l0,-62.84z" android:strokeColor="#00000000"/>
+    <path android:fillAlpha="1" android:fillColor="#1976d2"
+        android:pathData="m128,0 l-104.73,46.55 0,69.82C23.27,180.95 67.96,241.34 128,256 188.04,241.34 232.73,180.95 232.73,116.36l0,-69.82L128,0ZM128,127.88 L209.45,127.88C203.29,175.83 171.29,218.53 128,231.91l0,-103.91 -81.45,0 0,-66.33L128,25.48l0,102.4z" android:strokeColor="#00000000"/>
 </vector>
index 9df2bc0991a0f4507dc3c334a20d204016dd1b84..5c4adf300bfaab60112b25d05dd47a471139e09d 100644 (file)
@@ -1,16 +1,11 @@
 <!--
-  warning.xml is part of the Android Material icon set, where it is named ic_visibility.
-  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>.
-  Changes to fill color and size were made by Soren Stoutner in 2016. -->
+  warning.xml is derived from ic_security, which is part of the Android Material icon set.
+  It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>.  Modifications were made by Soren Stoutner <soren@stoutner.com> in 2016. -->
 
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="26dp"
-        android:height="26dp"
-        android:viewportWidth="26.0"
-        android:viewportHeight="26.0">
-
-    <!-- The fillColor must be hardcoded in this file until the minimum API is >= 22.  Then the resources in colors.xml may be used instead. -->
-    <path
-        android:fillColor="#FFFFD600"
-        android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zm0,-8c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
+<vector android:height="26dp" android:viewportHeight="256.0"
+    android:viewportWidth="256.0" android:width="26dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillAlpha="1" android:fillColor="#f57f17"
+        android:pathData="m128,12.8 l-94.25,41.89 0,62.84c0,58.12 40.22,112.48 94.25,125.67 54.04,-13.2 94.25,-67.55 94.25,-125.67l0,-62.84z" android:strokeColor="#00000000"/>
+    <path android:fillAlpha="1" android:fillColor="#fbc02d"
+        android:pathData="m128,0 l-104.73,46.55 0,69.82C23.27,180.95 67.96,241.34 128,256 188.04,241.34 232.73,180.95 232.73,116.36l0,-69.82L128,0ZM128,127.88 L209.45,127.88C203.29,175.83 171.29,218.53 128,231.91l0,-103.91 -81.45,0 0,-66.33L128,25.48l0,102.4z" android:strokeColor="#00000000"/>
 </vector>
index c923d9a2c1dc62228d8e157ae36872a2c8c687bb..9e06879dfd9c63b81387ecab2124c38d2d59521b 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   world.xml is part of the Android Material icon set, where it is named ic_language.
   It is released under the CC-BY license <https://creativecommons.org/licenses/by/4.0/>.
-  Changes to fill color and size were made by Soren Stoutner in 2016. -->
+  Changes to fill color and size were made by Soren Stoutner <soren@stoutner.com> in 2016. -->
 
 <vector
     xmlns:android="http://schemas.android.com/apk/res/android"
index 68709a7b8ea25f8aae55951455889868e8892590..920d468d34f08499865fc5c73cc17cdc19b99f0f 100644 (file)
     <string name="privacy_browser_settings">Privacy Browser Settings</string>
 
     <!-- MainWebViewActivity. -->
-    <string name="privacy_mode">Privacy Mode</string>
     <string name="download_started">Download started</string>
+    <string name="privacy_mode">Privacy Mode</string>
+    <string name="javascript_enabled">JavaScript enabled</string>
+    <string name="dom_storage_enabled">DOM Storage enabled</string>
+    <string name="cookies_enabled">Cookies enabled</string>
+    <string name="dom_storage_still_enabled">JavaScript disabled, DOM Storage still enabled</string>
+    <string name="cookies_still_enabled">Cookies still enabled</string>
+    <string name="both_still_enabled">JavaScript disabled, DOM Storage and Cookies still enabled</string>
+    <string name="dom_storage_deleted">DOM Storage deleted</string>
+    <string name="cookies_deleted">Cookies deleted</string>
 
     <!-- Custom App Bar. -->
     <string name="favorite_icon">Favorite Icon</string>