From 8366efd6bd48448d2b67c30ac5ceb321111d9c4c Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Wed, 23 Mar 2016 20:12:27 -0700 Subject: [PATCH] Create a blank navigation drawer. --- .../layout/{ad_view.xml => main_webview.xml} | 1 - .../privacybrowser/MainWebViewActivity.java | 19 ++++- app/src/main/res/layout/activity_webview.xml | 56 -------------- .../main/res/layout/coordinator_layout.xml | 76 +++++++++++++++++++ .../layout/{ad_view.xml => main_webview.xml} | 6 +- .../res/{values-v11 => values-v19}/styles.xml | 12 ++- app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 2 + app/src/main/res/values/styles.xml | 5 +- 9 files changed, 111 insertions(+), 68 deletions(-) rename app/src/free/res/layout/{ad_view.xml => main_webview.xml} (96%) delete mode 100644 app/src/main/res/layout/activity_webview.xml create mode 100644 app/src/main/res/layout/coordinator_layout.xml rename app/src/main/res/layout/{ad_view.xml => main_webview.xml} (90%) rename app/src/main/res/{values-v11 => values-v19}/styles.xml (69%) diff --git a/app/src/free/res/layout/ad_view.xml b/app/src/free/res/layout/main_webview.xml similarity index 96% rename from app/src/free/res/layout/ad_view.xml rename to app/src/free/res/layout/main_webview.xml index 22c17deb..c7bf4b0f 100644 --- a/app/src/free/res/layout/ad_view.xml +++ b/app/src/free/res/layout/main_webview.xml @@ -30,7 +30,6 @@ tools:context="com.stoutner.privacybrowser.MainWebViewActivity" tools:showIn="@layout/activity_webview"> - = 21. Toolbar supportAppBar = (Toolbar) findViewById(R.id.appBar); @@ -149,6 +151,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome }); } + DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); + drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, supportAppBar, R.string.open_navigation, R.string.close_navigation); + mainWebView.setWebViewClient(new WebViewClient() { // shouldOverrideUrlLoading makes this WebView the default handler for URLs inside the app, so that links are not kicked out to other apps. @Override @@ -629,6 +634,14 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome } } + @Override + public void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + + // Sync the state of the DrawerToggle after onRestoreInstanceState has finished. + drawerToggle.syncState(); + } + @Override public void onCreateHomeScreenShortcutCancel(DialogFragment dialog) { // Do nothing because the user selected "Cancel". diff --git a/app/src/main/res/layout/activity_webview.xml b/app/src/main/res/layout/activity_webview.xml deleted file mode 100644 index 5be88fef..00000000 --- a/app/src/main/res/layout/activity_webview.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/coordinator_layout.xml b/app/src/main/res/layout/coordinator_layout.xml new file mode 100644 index 00000000..4f11f609 --- /dev/null +++ b/app/src/main/res/layout/coordinator_layout.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/ad_view.xml b/app/src/main/res/layout/main_webview.xml similarity index 90% rename from app/src/main/res/layout/ad_view.xml rename to app/src/main/res/layout/main_webview.xml index dc61e6b1..ed8bcc68 100644 --- a/app/src/main/res/layout/ad_view.xml +++ b/app/src/main/res/layout/main_webview.xml @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - + + tools:showIn="@layout/coordinator_layout" > - \ No newline at end of file + diff --git a/app/src/main/res/values-v11/styles.xml b/app/src/main/res/values-v19/styles.xml similarity index 69% rename from app/src/main/res/values-v11/styles.xml rename to app/src/main/res/values-v19/styles.xml index dfc0cacf..96ec9d69 100644 --- a/app/src/main/res/values-v11/styles.xml +++ b/app/src/main/res/values-v19/styles.xml @@ -20,11 +20,21 @@ - + + + +