aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java
index 37ac9b9b..c21ac456 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java
@@ -19,6 +19,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -79,8 +80,10 @@ public class WebViewActivity extends BaseActivity {
webView.getSettings().setDomStorageEnabled(true);
url = getIntent().getDataString();
- toolbar.setTitle(url);
- webView.loadUrl(url);
+ if (savedInstanceState == null) {
+ toolbar.setTitle(url);
+ webView.loadUrl(url);
+ }
WebViewClient client = new WebViewClient() {
@Override
@@ -177,4 +180,16 @@ public class WebViewActivity extends BaseActivity {
}
return super.onKeyDown(keyCode, event);
}
+
+ @Override
+ protected void onSaveInstanceState(@NonNull Bundle outState) {
+ super.onSaveInstanceState(outState);
+ webView.saveState(outState);
+ }
+
+ @Override
+ protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ webView.restoreState(savedInstanceState);
+ }
} \ No newline at end of file