]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/commitdiff
Initial implementation of the navigation drawer.
authorSoren Stoutner <soren@stoutner.com>
Thu, 7 Apr 2016 22:28:07 +0000 (15:28 -0700)
committerSoren Stoutner <soren@stoutner.com>
Thu, 7 Apr 2016 22:28:07 +0000 (15:28 -0700)
22 files changed:
.idea/.name
.idea/dictionaries/soren.xml [deleted file]
.idea/encodings.xml [new file with mode: 0644]
.idea/gradle.xml
app/build.gradle
app/src/main/assets/about_text.html
app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java
app/src/main/res/drawable/about.xml [new file with mode: 0644]
app/src/main/res/drawable/back.xml [new file with mode: 0644]
app/src/main/res/drawable/downloads.xml [new file with mode: 0644]
app/src/main/res/drawable/exit.xml [new file with mode: 0644]
app/src/main/res/drawable/forward.xml [new file with mode: 0644]
app/src/main/res/drawable/home.xml [new file with mode: 0644]
app/src/main/res/drawable/settings.xml [new file with mode: 0644]
app/src/main/res/layout/coordinator_layout.xml
app/src/main/res/layout/navigation_header.xml [new file with mode: 0644]
app/src/main/res/menu/menu_navigation.xml [new file with mode: 0644]
app/src/main/res/menu/menu_options.xml [new file with mode: 0644]
app/src/main/res/menu/menu_webview.xml [deleted file]
app/src/main/res/values/strings.xml
build.gradle
gradle/wrapper/gradle-wrapper.properties

index ca458fec1818d79f247a3135e0fb097a9c1ce0c1..c285efa76c66be02758c293364fe3090286cb0e9 100644 (file)
@@ -1 +1 @@
-Privacy Browser
\ No newline at end of file
+PrivacyBrowser
\ No newline at end of file
diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml
deleted file mode 100644 (file)
index 920c48c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<component name="ProjectDictionaryState">
-  <dictionary name="soren">
-    <words>
-      <w>affero</w>
-      <w>creativecommons</w>
-      <w>duckduckgo</w>
-      <w>homescreen</w>
-      <w>lgpl</w>
-      <w>licensors</w>
-      <w>mailto</w>
-      <w>mimetype</w>
-      <w>noncommercially</w>
-      <w>privacybrowser</w>
-      <w>recents</w>
-      <w>rehide</w>
-      <w>rehides</w>
-      <w>relicensing</w>
-      <w>soren</w>
-      <w>stoutner</w>
-      <w>sublicenses</w>
-      <w>sublicensing</w>
-      <w>webpage</w>
-      <w>webview</w>
-      <w>wipo</w>
-    </words>
-  </dictionary>
-</component>
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644 (file)
index 0000000..97626ba
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="PROJECT" charset="UTF-8" />
+  </component>
+</project>
\ No newline at end of file
index 261ec2856093f0a05c3d713bbb87bd84db5c8b1a..494ac8395a1ca24211fbec4d60c5b4686109e56f 100644 (file)
@@ -5,7 +5,7 @@
       <GradleProjectSettings>
         <option name="distributionType" value="LOCAL" />
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
-        <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.8" />
+        <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.10" />
         <option name="gradleJvm" value="1.7" />
         <option name="modules">
           <set>
             <option value="$PROJECT_DIR$/app" />
           </set>
         </option>
+        <option name="myModules">
+          <set>
+            <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/app" />
+          </set>
+        </option>
       </GradleProjectSettings>
     </option>
   </component>
index 0c42440c3c67d50ecb24153cfc5bf96414c33919..df66f58a9ee3b4f73b187f324e0848fee2aab92c 100644 (file)
@@ -35,7 +35,7 @@ android {
 
     buildTypes {
         release {
-            minifyEnabled false
+            minifyEnabled true
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
@@ -43,21 +43,19 @@ android {
     productFlavors {
         standard {
             applicationId "com.stoutner.privacybrowser.standard"
-            versionName "1.1-standard"
+            versionName "1.2-standard"
         }
 
         free {
             applicationId "com.stoutner.privacybrowser.free"
-            versionName "1.1-free"
+            versionName "1.2-free"
         }
     }
 }
 
 dependencies {
     compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile 'com.android.support:appcompat-v7:23.2.1'
-    compile 'com.android.support:design:23.2.1'
-    compile 'com.android.support:support-v4:23.2.1'
+    compile 'com.android.support:design:23.3.0'
     // Only compile com.google.android.gms:play-services-ads for the free version so that the standard version can build of F-Droid.
     freeCompile 'com.google.android.gms:play-services-ads:8.4.0'
 }
index fc6db0a3173c62052f26aca4a4e0499ebe9528a1..9a5a27b478c4ffdd27a171cfb4849fb9e59dc5e7 100644 (file)
     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.
+<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>
 
+<p>app/src/main/res/drawable/back.xml is part of the Android Material icon set, where it is named ic_arrow_back.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
+<p>app/src/main/res/drawable/forward.xml is part of the Android Material icon set, where it is named ic_arrow_forward.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
+<p>app/src/main/res/drawable/settings.xml is part of the Android Material icon set, where it is named ic_settings.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
+<p>app/src/main/res/drawable/downloads.xml is part of the Android Material icon set, where it is named ic_file_download.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
+<p>app/src/main/res/drawable/exit.xml is part of the Android Material icon set, where it is named ic_exit_to_app.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
+<p>app/src/main/res/drawable/about.xml is part of the Android Material icon set, where it is named ic_info.
+    It is released under the <a href=https://creativecommons.org/licenses/by/4.0/>CC-BY license</a>.</p>
+
 <br/>
 <hr/>
 <br/>
index 96f49b5b22463dc81f3c66cb6c184dab06cb4ea0..13600840837ef20d245fd564cc742abda5dcf82c 100644 (file)
@@ -24,13 +24,16 @@ import android.app.Activity;
 import android.app.DownloadManager;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.content.res.Configuration;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
+import android.support.design.widget.NavigationView;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.DialogFragment;
+import android.support.v4.view.GravityCompat;
 import android.support.v4.widget.DrawerLayout;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.support.v7.app.ActionBar;
@@ -61,14 +64,16 @@ import java.net.URL;
 import java.net.URLEncoder;
 
 // We need to use AppCompatActivity from android.support.v7.app.AppCompatActivity to have access to the SupportActionBar until the minimum API is >= 21.
-public class MainWebViewActivity extends AppCompatActivity implements CreateHomeScreenShortcut.CreateHomeScreenSchortcutListener {
+public class MainWebViewActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, CreateHomeScreenShortcut.CreateHomeScreenSchortcutListener {
     // favoriteIcon is public static so it can be accessed from CreateHomeScreenShortcut.
     public static Bitmap favoriteIcon;
-    // mainWebView is public static so it can be accessed from AboutDialog.  It is also used in onCreate(), onOptionsItemSelected(), and loadUrlFromTextBox().
+    // mainWebView is public static so it can be accessed from AboutDialog.  It is also used in onCreate(), onOptionsItemSelected(), onNavigationItemSelected(), and loadUrlFromTextBox().
     public static WebView mainWebView;
 
-    // DrawerTottle is use in onCrate() and onPostCreate().
+    // drawerToggle is used in onCreate(), onPostCreate(), onConfigurationChanged(), onNewIntent(), and onNavigationItemSelected().
     private ActionBarDrawerToggle drawerToggle;
+    // drawerLayout is used in onCreate(), onNewIntent(), and onBackPressed().
+    private DrawerLayout drawerLayout;
     // mainMenu is used in onCreateOptionsMenu() and onOptionsItemSelected().
     private Menu mainMenu;
     // formattedUrlString is used in onCreate(), onOptionsItemSelected(), onCreateHomeScreenShortcutCreate(), and loadUrlFromTextBox().
@@ -85,7 +90,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
     private boolean saveFormDataEnabled;
     */
 
-    // cookieManager is used in onCreate() and onOptionsItemSelected().
+    // cookieManager is used in onCreate(), onOptionsItemSelected(), and onNavigationItemSelected().
     private CookieManager cookieManager;
     // cookiesEnabled is used in onCreate(), onCreateOptionsMenu(), and onOptionsItemSelected().
     private boolean cookiesEnabled;
@@ -151,7 +156,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
             });
         }
 
-        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
+        // Create the navigation drawer.
+        drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
+        // The DrawerTitle identifies the drawer in accessibility mode.
+        drawerLayout.setDrawerTitle(GravityCompat.START, getString(R.string.navigation_drawer));
+
+        // Listen for touches on the navigation menu.
+        final NavigationView navigationView = (NavigationView) findViewById(R.id.navigationView);
+        navigationView.setNavigationItemSelectedListener(this);
+
+        // drawerToggle creates the hamburger icon at the start of the AppBar.
         drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, supportAppBar, R.string.open_navigation, R.string.close_navigation);
 
         mainWebView.setWebViewClient(new WebViewClient() {
@@ -352,6 +366,11 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
             formattedUrlString = intentUriData.toString();
         }
 
+        // Close the navigation drawer if it is open.
+        if (drawerLayout.isDrawerVisible(GravityCompat.START)) {
+            drawerLayout.closeDrawer(GravityCompat.START);
+        }
+
         // Load the website.
         mainWebView.loadUrl(formattedUrlString);
 
@@ -362,7 +381,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         // Inflate the menu; this adds items to the action bar if it is present.
-        getMenuInflater().inflate(R.menu.menu_webview, menu);
+        getMenuInflater().inflate(R.menu.menu_options, menu);
 
         // Set mainMenu so it can be used by onOptionsItemSelected.
         mainMenu = menu;
@@ -402,14 +421,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
         MenuItem clearCookies = menu.findItem(R.id.clearCookies);
         clearCookies.setEnabled(cookieManager.hasCookies());
 
-        // Enable Back if canGoBack().
-        MenuItem back = menu.findItem(R.id.back);
-        back.setEnabled(mainWebView.canGoBack());
-
-        // Enable forward if canGoForward().
-        MenuItem forward = menu.findItem(R.id.forward);
-        forward.setEnabled(mainWebView.canGoForward());
-
         // Run all the other default commands.
         super.onPrepareOptionsMenu(menu);
 
@@ -556,6 +567,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
                 Snackbar.make(findViewById(R.id.mainWebView), R.string.cookies_deleted, Snackbar.LENGTH_SHORT).show();
                 return true;
 
+            case R.id.share:
+                Intent shareIntent = new Intent();
+                shareIntent.setAction(Intent.ACTION_SEND);
+                shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString());
+                shareIntent.setType("text/plain");
+                startActivity(Intent.createChooser(shareIntent, "Share URL"));
+                return true;
+
             case R.id.addToHomescreen:
                 // Show the CreateHomeScreenShortcut AlertDialog and name this instance createShortcut.
                 AppCompatDialogFragment shortcutDialog = new CreateHomeScreenShortcut();
@@ -564,47 +583,55 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
                 //Everything else will be handled by CreateHomeScreenShortcut and the associated listeners below.
                 return true;
 
-            case R.id.downloads:
-                // Launch the system Download Manager.
-                Intent downloadManagerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
-
-                // Launch as a new task so that Download Manager and Privacy Browser show as separate windows in the recent tasks list.
-                downloadManagerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            default:
+                return super.onOptionsItemSelected(menuItem);
+        }
+    }
 
-                startActivity(downloadManagerIntent);
-                return true;
+    @Override
+    // removeAllCookies is deprecated, but it is required for API < 21.
+    @SuppressWarnings("deprecation")
+    public boolean onNavigationItemSelected(MenuItem menuItem) {
+        int menuItemId = menuItem.getItemId();
 
+        switch (menuItemId) {
             case R.id.home:
                 mainWebView.loadUrl(homepage);
-                return true;
+                break;
 
             case R.id.back:
-                mainWebView.goBack();
-                return true;
+                if (mainWebView.canGoBack()) {
+                    mainWebView.goBack();
+                }
+                break;
 
             case R.id.forward:
-                mainWebView.goForward();
-                return true;
+                if (mainWebView.canGoForward()) {
+                    mainWebView.goForward();
+                }
+                break;
 
-            case R.id.share:
-                Intent shareIntent = new Intent();
-                shareIntent.setAction(Intent.ACTION_SEND);
-                shareIntent.putExtra(Intent.EXTRA_TEXT, urlTextBox.getText().toString());
-                shareIntent.setType("text/plain");
-                startActivity(Intent.createChooser(shareIntent, "Share URL"));
-                return true;
+            case R.id.downloads:
+                // Launch the system Download Manager.
+                Intent downloadManagerIntent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);
+
+                // Launch as a new task so that Download Manager and Privacy Browser show as separate windows in the recent tasks list.
+                downloadManagerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+                startActivity(downloadManagerIntent);
+                break;
 
             case R.id.settings:
                 // Launch SettingsActivity.
                 Intent intent = new Intent(this, SettingsActivity.class);
                 startActivity(intent);
-                return true;
+                break;
 
             case R.id.about:
                 // Show the AboutDialog AlertDialog and name this instance aboutDialog.
                 AppCompatDialogFragment aboutDialog = new AboutDialog();
                 aboutDialog.show(getSupportFragmentManager(), "aboutDialog");
-                return true;
+                break;
 
             case R.id.clearAndExit:
                 // Clear DOM storage.
@@ -627,11 +654,15 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
                 } else {
                     finish();
                 }
-                return true;
+                break;
 
             default:
-                return super.onOptionsItemSelected(menuItem);
+                break;
         }
+
+        // Close the navigation drawer.
+        drawerLayout.closeDrawer(GravityCompat.START);
+        return true;
     }
 
     @Override
@@ -642,6 +673,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
         drawerToggle.syncState();
     }
 
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+
+        // Update the status of the drawerToggle icon.
+        drawerToggle.onConfigurationChanged(newConfig);
+    }
+
     @Override
     public void onCreateHomeScreenShortcutCancel(DialogFragment dialog) {
         // Do nothing because the user selected "Cancel".
@@ -666,15 +705,22 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome
         sendBroadcast(placeBookmarkShortcut);
     }
 
-    // Override onBackPressed so that if mainWebView can go back it does when the system back button is pressed.
+    // Override onBackPressed to handle the navigation drawer and mainWebView.
     @Override
     public void onBackPressed() {
         final WebView mainWebView = (WebView) findViewById(R.id.mainWebView);
 
-        if (mainWebView.canGoBack()) {
-            mainWebView.goBack();
+        // Close the navigation drawer if it is available.  GravityCompat.START is the drawer on the left on Left-to-Right layout text.
+        if (drawerLayout.isDrawerVisible(GravityCompat.START)) {
+            drawerLayout.closeDrawer(GravityCompat.START);
         } else {
-            super.onBackPressed();
+            // Load the previous URL if available.
+            if (mainWebView.canGoBack()) {
+                mainWebView.goBack();
+            } else {
+                // Pass onBackPressed to the system.
+                super.onBackPressed();
+            }
         }
     }
 
diff --git a/app/src/main/res/drawable/about.xml b/app/src/main/res/drawable/about.xml
new file mode 100644 (file)
index 0000000..52f0307
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/back.xml b/app/src/main/res/drawable/back.xml
new file mode 100644 (file)
index 0000000..beafea3
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/downloads.xml b/app/src/main/res/drawable/downloads.xml
new file mode 100644 (file)
index 0000000..492b41d
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
+</vector>
diff --git a/app/src/main/res/drawable/exit.xml b/app/src/main/res/drawable/exit.xml
new file mode 100644 (file)
index 0000000..6f40d77
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
+</vector>
diff --git a/app/src/main/res/drawable/forward.xml b/app/src/main/res/drawable/forward.xml
new file mode 100644 (file)
index 0000000..cf9e208
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
+</vector>
diff --git a/app/src/main/res/drawable/home.xml b/app/src/main/res/drawable/home.xml
new file mode 100644 (file)
index 0000000..70fb291
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
+</vector>
diff --git a/app/src/main/res/drawable/settings.xml b/app/src/main/res/drawable/settings.xml
new file mode 100644 (file)
index 0000000..ace746c
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="#FF000000"
+        android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>
index 4f11f6090cdde9c35a2ef2776f6b5a6e0825ece7..fae9a510ff9ee5b9c63fff31b0c22c9d1dc9f6e7 100644 (file)
 
 <android.support.v4.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/drawerLayout"
     android:layout_height="match_parent"
-    android:layout_width="match_parent" >
+    android:layout_width="match_parent">
 
     <!-- The main content view. -->
     <!-- android:fitsSystemWindows="true" moves rootCoordinatorLayout below the system status bar. -->
     </android.support.design.widget.CoordinatorLayout>
 
     <!-- The navigation drawer. -->
-    <ListView
-        android:id="@+id/navigationDrawer"
-        android:layout_width="240dp"
+    <android.support.design.widget.NavigationView
+        android:id="@+id/navigationView"
+        android:layout_width="wrap_content"
         android:layout_height="match_parent"
         android:layout_gravity="start"
-        android:choiceMode="singleChoice"
-        android:background="@color/white"/>
+        app:headerLayout="@layout/navigation_header"
+        app:menu="@menu/menu_navigation"/>
 
 </android.support.v4.widget.DrawerLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/navigation_header.xml b/app/src/main/res/layout/navigation_header.xml
new file mode 100644 (file)
index 0000000..7ed9685
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/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 <http://www.gnu.org/licenses/>. -->
+
+<!-- We can remove android:paddingLeft and android:PaddingRight once API >=17. -->
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/navigationText"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:text="@string/navigation"
+    android:paddingTop="60dp"
+    android:paddingBottom="8dp"
+    android:paddingLeft="15dp"
+    android:paddingRight="15dp"
+    android:paddingStart="15dp"
+    android:textStyle="bold"
+    android:textSize="20sp"
+    android:background="@color/blue"
+    android:textColor="@color/white" />
+
diff --git a/app/src/main/res/menu/menu_navigation.xml b/app/src/main/res/menu/menu_navigation.xml
new file mode 100644 (file)
index 0000000..6e5a31f
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/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 <http://www.gnu.org/licenses/>. -->
+
+<menu
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:id="@+id/home"
+        android:title="@string/home"
+        android:icon="@drawable/home"
+        android:orderInCategory="11" />
+
+    <item
+        android:id="@+id/back"
+        android:title="@string/back"
+        android:icon="@drawable/back"
+        android:orderInCategory="12" />
+
+    <item
+        android:id="@+id/forward"
+        android:title="@string/forward"
+        android:icon="@drawable/forward"
+        android:orderInCategory="13" />
+
+    <!-- If a group has an id, a line is drawn above it in the navigation view. -->
+    <group
+        android:id="@+id/navigationGroup1" >
+        <item
+            android:id="@+id/downloads"
+            android:title="@string/downloads"
+            android:icon="@drawable/downloads"
+            android:orderInCategory="20" />
+
+        <item
+            android:id="@+id/settings"
+            android:title="@string/settings"
+            android:icon="@drawable/settings"
+            android:orderInCategory="30" />
+
+        <item
+            android:id="@+id/about"
+            android:title="@string/about"
+            android:icon="@drawable/about"
+            android:orderInCategory="40" />
+    </group>
+
+    <!-- If a group has an id, a line is drawn above it in the navigation view. -->
+    <group
+        android:id="@+id/navigationGroup2" >
+        <item
+            android:id="@+id/clearAndExit"
+            android:title="@string/clear_and_exit"
+            android:icon="@drawable/exit"
+            android:orderInCategory="50" />
+    </group>
+</menu>
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_options.xml b/app/src/main/res/menu/menu_options.xml
new file mode 100644 (file)
index 0000000..e6bdead
--- /dev/null
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+  Copyright 2015-2016 Soren Stoutner <soren@stoutner.com>.
+
+  This file is part of Privacy Browser <https://www.stoutner.com/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 <http://www.gnu.org/licenses/>. -->
+
+<menu
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:context=".MainWebViewActivity">
+
+    <item
+        android:id="@+id/toggleJavaScript"
+        android:title="@string/javascript"
+        android:orderInCategory="10"
+        app:showAsAction="always" />
+
+    <item
+        android:id="@+id/toggleDomStorage"
+        android:title="@string/dom_storage"
+        android:orderInCategory="20"
+        android:checkable="true"
+        app:showAsAction="never" />
+
+    <!-- toggleSaveFormData does nothing until database storage is implemented
+    <item
+        android:id="@+id/toggleSaveFormData"
+        android:title="@string/saveFormData"
+        android:orderInCategory="30"
+        android:checkable="true"
+        app:showAsAction="never" />
+        -->
+
+    <item
+        android:id="@+id/toggleCookies"
+        android:title="@string/cookies"
+        android:orderInCategory="40"
+        android:checkable="true"
+        app:showAsAction="never" />
+
+    <item
+        android:id="@+id/clearDomStorage"
+        android:title="@string/clear_dom_storage"
+        android:orderInCategory="50"
+        app:showAsAction="never" />
+
+    <item
+        android:id="@+id/clearCookies"
+        android:title="@string/clear_cookies"
+        android:orderInCategory="60"
+        app:showAsAction="never" />
+
+    <item
+        android:id="@+id/share"
+        android:title="@string/share"
+        android:orderInCategory="70"
+        app:showAsAction="never" />
+
+    <item
+        android:id="@+id/addToHomescreen"
+        android:title="@string/add_to_home_screen"
+        android:orderInCategory="80"
+        app:showAsAction="never" />
+</menu>
diff --git a/app/src/main/res/menu/menu_webview.xml b/app/src/main/res/menu/menu_webview.xml
deleted file mode 100644 (file)
index a8c38b4..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
-  Copyright 2015-2016 Soren Stoutner <soren@stoutner.com>.
-
-  This file is part of Privacy Browser <https://www.stoutner.com/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 <http://www.gnu.org/licenses/>. -->
-
-<menu
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:context=".MainWebViewActivity">
-
-    <item
-        android:id="@+id/toggleJavaScript"
-        android:title="@string/javascript"
-        android:orderInCategory="10"
-        app:showAsAction="always" />
-
-    <item
-        android:id="@+id/toggleDomStorage"
-        android:title="@string/dom_storage"
-        android:orderInCategory="20"
-        android:checkable="true"
-        app:showAsAction="never" />
-
-    <!-- toggleSaveFormData does nothing until database storage is implemented
-    <item
-        android:id="@+id/toggleSaveFormData"
-        android:title="@string/saveFormData"
-        android:orderInCategory="30"
-        android:checkable="true"
-        app:showAsAction="never" />
-        -->
-
-    <item
-        android:id="@+id/toggleCookies"
-        android:title="@string/cookies"
-        android:orderInCategory="40"
-        android:checkable="true"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/clearDomStorage"
-        android:title="@string/clear_dom_storage"
-        android:orderInCategory="50"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/clearCookies"
-        android:title="@string/clear_cookies"
-        android:orderInCategory="60"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/addToHomescreen"
-        android:title="@string/add_to_home_screen"
-        android:orderInCategory="70"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/downloads"
-        android:title="@string/downloads"
-        android:orderInCategory="80"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/navigation"
-        android:title="@string/navigation"
-        android:orderInCategory="90"
-        app:showAsAction="never" >
-        <menu>
-            <item
-                android:id="@+id/home"
-                android:title="@string/home"
-                android:orderInCategory="91"
-                app:showAsAction="never" />
-
-            <item
-                android:id="@+id/back"
-                android:title="@string/back"
-                android:orderInCategory="92"
-                app:showAsAction="never" />
-
-            <item
-                android:id="@+id/forward"
-                android:title="@string/forward"
-                android:orderInCategory="93"
-                app:showAsAction="never" />
-        </menu>
-    </item>
-
-    <item
-        android:id="@+id/share"
-        android:title="@string/share"
-        android:orderInCategory="100"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/settings"
-        android:title="@string/settings"
-        android:orderInCategory="110"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/about"
-        android:title="@string/about"
-        android:orderInCategory="120"
-        app:showAsAction="never" />
-
-    <item
-        android:id="@+id/clearAndExit"
-        android:title="@string/clear_and_exit"
-        android:orderInCategory="130"
-        app:showAsAction="never" />
-</menu>
index 6cf2bf62dd9b5af6b7c70ce149a2b7e100389885..f8a25db2c6afff8ce77ad0b8bfd15b06f117a805 100644 (file)
     <!-- Custom App Bar. -->
     <string name="favorite_icon">Favorite Icon</string>
 
-    <!-- Menu. -->
-    <string name="javascript">JavaScript</string>
-    <string name="dom_storage">DOM Storage</string>
-    <string name="cookies">Cookies</string>
-    <string name="clear_dom_storage">Clear DOM Storage</string>
-    <string name="clear_cookies">Clear Cookies</string>
-    <string name="add_to_home_screen">Add to Home Screen</string>
-    <string name="downloads">Downloads</string>
+    <!-- Navigation Drawer. -->
+    <string name="navigation_drawer">Navigation Drawer</string>
     <string name="navigation">Navigation</string>
     <string name="home">Home</string>
     <string name="back">Back</string>
     <string name="forward">Forward</string>
-    <string name="share">Share</string>
+    <string name="downloads">Downloads</string>
     <string name="settings">Settings</string>
     <string name="about">About</string>
     <string name="clear_and_exit">Clear and Exit</string>
 
+    <!-- Menu. -->
+    <string name="javascript">JavaScript</string>
+    <string name="dom_storage">DOM Storage</string>
+    <string name="cookies">Cookies</string>
+    <string name="clear_dom_storage">Clear DOM Storage</string>
+    <string name="clear_cookies">Clear Cookies</string>
+    <string name="share">Share</string>
+    <string name="add_to_home_screen">Add to Home Screen</string>
+
     <!-- Create Home Screen Shortcut Alert Dialog. -->
     <string name="shortcut_name">Shortcut name</string>
     <string name="cancel">Cancel</string>
index a6fcfe1fe984519945439094e057b832413cf791..cb98401414e07f8a3e651fceb3218800dc52e60b 100644 (file)
@@ -5,7 +5,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.5.0'
+        classpath 'com.android.tools.build:gradle:2.0.0'
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
index 0c71e760dc93830dd3411fe50d6f5c86bf0a8f4d..60509da61e97c24f15655a4ab60051ce9f40f169 100644 (file)
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Thu Apr 07 11:52:03 MST 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip