aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java19
2 files changed, 19 insertions, 3 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 71359562..05cd4a65 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -76,7 +76,8 @@
android:name=".activities.WebViewActivity"
android:label=""
android:parentActivityName=".activities.MainActivity"
- android:theme="@style/AppTheme.NoActionBar" />
+ android:theme="@style/AppTheme.NoActionBar"
+ android:configChanges="orientation|screenSize" />
<activity
android:name=".activities.SuicidePreventionActivity"
android:parentActivityName=".activities.MainActivity"
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