]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/fragments/AboutWebViewFragment.kt
Use FQDNs for some file names. https://redmine.stoutner.com/issues/680
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / fragments / AboutWebViewFragment.kt
index 054d200e0236e2320aa43f8ac87d57f868a4bcbf..3d36c05737e53598cdf48dac99c1415282b90974 100644 (file)
@@ -40,6 +40,8 @@ import com.stoutner.privacybrowser.R
 
 // Define the class constants.
 private const val TAB_NUMBER = "tab_number"
+private const val SCROLL_X = "scroll_x"
+private const val SCROLL_Y = "scroll_y"
 
 class AboutWebViewFragment : Fragment() {
     // Define the class variables.
@@ -101,7 +103,8 @@ class AboutWebViewFragment : Fragment() {
             }
 
             override fun shouldInterceptRequest(webView: WebView, url: String): WebResourceResponse? {
-                // Have the WebView asset loader process the request.  This allows the loading of SVG files, which otherwise is prevented by the CORS policy.
+                // Have the WebView asset loader process the request.
+                // This allows using the `appassets.androidplatform.net` URL, which handles the loading of SVG files, which otherwise is prevented by the CORS policy.
                 return webViewAssetLoader.shouldInterceptRequest(Uri.parse(url))
             }
         }
@@ -128,8 +131,8 @@ class AboutWebViewFragment : Fragment() {
         // Scroll the tab if the saved instance state is not null.
         if (savedInstanceState != null) {
             tabWebView.post {
-                tabWebView.scrollX = savedInstanceState.getInt("scroll_x")
-                tabWebView.scrollY = savedInstanceState.getInt("scroll_y")
+                tabWebView.scrollX = savedInstanceState.getInt(SCROLL_X)
+                tabWebView.scrollY = savedInstanceState.getInt(SCROLL_Y)
             }
         }
 
@@ -146,8 +149,8 @@ class AboutWebViewFragment : Fragment() {
 
         // Save the scroll positions if the layout is not null, which can happen if a tab is not currently selected.
         if (tabWebView != null) {
-            savedInstanceState.putInt("scroll_x", tabWebView.scrollX)
-            savedInstanceState.putInt("scroll_y", tabWebView.scrollY)
+            savedInstanceState.putInt(SCROLL_X, tabWebView.scrollX)
+            savedInstanceState.putInt(SCROLL_Y, tabWebView.scrollY)
         }
     }
 }
\ No newline at end of file