commit | b6ea9ee6fe6fc205f4f8be593ca993d594e8d504 | [log] [tgz] |
---|---|---|
author | Paul Jensen <pauljensen@google.com> | Fri Jul 18 12:27:23 2014 -0400 |
committer | Paul Jensen <pauljensen@google.com> | Fri Jul 18 16:34:57 2014 +0000 |
tree | 9a1fe699622e1d7b5510f45a91437d43cf807e47 | |
parent | 53777b58f355d09e22c1dc91702f1701a9a7fb09 [diff] [blame] |
Make back button work in CaptivePortalLogin app like a web browser. Users will be using the app to navigate web pages like they are used to in web browsers, so the back button should act similarly. There also isn't an in-app back button so this adds essentially necessary functionality. bug:16397616 Change-Id: Idd73d4a048d79e56bf981a8f477336f00eaafc3b
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index 2c1db02..09525b2 100644 --- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -97,6 +97,16 @@ } @Override + public void onBackPressed() { + WebView myWebView = (WebView) findViewById(R.id.webview); + if (myWebView.canGoBack()) { + myWebView.goBack(); + } else { + super.onBackPressed(); + } + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_use_network) {