]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Fix back button in HtmlActivity.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 24 Jan 2016 20:07:31 +0000 (21:07 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 24 Jan 2016 20:07:31 +0000 (21:07 +0100)
It should return to the previous web
page if any first, not directly to
the dictionary.
The action bar up button is for going
directly back to the dictionary.

src/com/hughes/android/dictionary/HtmlDisplayActivity.java

index 2845c74e23618e43f20243767fe22074eebb73d2..dd07c4e7dd975a88b4d11459f433afa2c929b67a 100644 (file)
@@ -109,6 +109,13 @@ public final class HtmlDisplayActivity extends ActionBarActivity {
         }\r
     }\r
 \r
+    @Override\r
+    public void onBackPressed() {\r
+        final MyWebView webView = (MyWebView)findViewById(R.id.webView);\r
+        if (webView.canGoBack()) webView.goBack();\r
+        else super.onBackPressed();\r
+    }\r
+\r
     @Override\r
     public boolean onOptionsItemSelected(MenuItem item) {\r
         // Explicitly handle the up button press so\r