From 405b0fa00eef8a6239f1f7ae6b0db06edb23ccb9 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 8 Oct 2015 15:12:39 -0700 Subject: [PATCH] Add menu entry for home. --- .../main/java/com/stoutner/privacybrowser/Webview.java | 8 ++++---- app/src/main/res/layout/activity_webview.xml | 1 + app/src/main/res/menu/menu_webview.xml | 9 +++++++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/Webview.java b/app/src/main/java/com/stoutner/privacybrowser/Webview.java index a0455bc9..a627a780 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/Webview.java +++ b/app/src/main/java/com/stoutner/privacybrowser/Webview.java @@ -16,9 +16,6 @@ import android.webkit.WebViewClient; import android.widget.EditText; import android.widget.ProgressBar; -import java.net.URL; - - public class Webview extends AppCompatActivity { static String formattedUrlString; @@ -117,8 +114,11 @@ public class Webview extends AppCompatActivity { int menuItemId = menuItem.getItemId(); final WebView mainWebView = (WebView) findViewById(R.id.mainWebView); - // Use the menu items to go forward or back. + // Sets the commands that relate to the menu entries. switch (menuItemId) { + case R.id.home: + mainWebView.loadUrl(homepage); + break; case R.id.back: mainWebView.goBack(); break; diff --git a/app/src/main/res/layout/activity_webview.xml b/app/src/main/res/layout/activity_webview.xml index 3244bb20..d214b1b4 100644 --- a/app/src/main/res/layout/activity_webview.xml +++ b/app/src/main/res/layout/activity_webview.xml @@ -11,6 +11,7 @@ android:orientation="horizontal" android:id="@+id/topBarLayout"> + // android:inputType="textUri" sets the keyboard to have a go arrow. + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1052d8f3..c51a4a26 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ Privacy Browser // Menu. + Home Back Forward -- 2.45.2