From: Soren Stoutner Date: Thu, 24 Mar 2016 03:12:27 +0000 (-0700) Subject: Create a blank navigation drawer. X-Git-Tag: v1.3-standard~3 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff_plain;h=8366efd6bd48448d2b67c30ac5ceb321111d9c4c Create a blank navigation drawer. --- diff --git a/app/src/free/res/layout/ad_view.xml b/app/src/free/res/layout/ad_view.xml deleted file mode 100644 index 22c17deb..00000000 --- a/app/src/free/res/layout/ad_view.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/free/res/layout/main_webview.xml b/app/src/free/res/layout/main_webview.xml new file mode 100644 index 00000000..c7bf4b0f --- /dev/null +++ b/app/src/free/res/layout/main_webview.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java index 64dd8dbf..96f49b5b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java @@ -20,7 +20,6 @@ package com.stoutner.privacybrowser; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.app.Activity; import android.app.DownloadManager; import android.content.Intent; @@ -32,8 +31,10 @@ 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.DrawerLayout; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBar; +import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatDialogFragment; import android.support.v7.widget.Toolbar; @@ -53,7 +54,6 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ProgressBar; -import android.widget.Toast; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; @@ -67,6 +67,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome // mainWebView is public static so it can be accessed from AboutDialog. It is also used in onCreate(), onOptionsItemSelected(), and loadUrlFromTextBox(). public static WebView mainWebView; + // DrawerTottle is use in onCrate() and onPostCreate(). + private ActionBarDrawerToggle drawerToggle; // mainMenu is used in onCreateOptionsMenu() and onOptionsItemSelected(). private Menu mainMenu; // formattedUrlString is used in onCreate(), onOptionsItemSelected(), onCreateHomeScreenShortcutCreate(), and loadUrlFromTextBox(). @@ -96,7 +98,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateHome @SuppressLint("SetJavaScriptEnabled") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_webview); + setContentView(R.layout.coordinator_layout); // We need to use the SupportActionBar from android.support.v7.app.ActionBar until the minimum API is >= 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/ad_view.xml b/app/src/main/res/layout/ad_view.xml deleted file mode 100644 index dc61e6b1..00000000 --- a/app/src/main/res/layout/ad_view.xml +++ /dev/null @@ -1,46 +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/main_webview.xml b/app/src/main/res/layout/main_webview.xml new file mode 100644 index 00000000..ed8bcc68 --- /dev/null +++ b/app/src/main/res/layout/main_webview.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-v11/styles.xml b/app/src/main/res/values-v11/styles.xml deleted file mode 100644 index dfc0cacf..00000000 --- a/app/src/main/res/values-v11/styles.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-v19/styles.xml b/app/src/main/res/values-v19/styles.xml new file mode 100644 index 00000000..96ec9d69 --- /dev/null +++ b/app/src/main/res/values-v19/styles.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + +