+ // Get the bottom app bar status from the arguments.
+ val bottomAppBar = requireArguments().getBoolean(BOTTOM_APP_BAR)
+
+ // Inflate the tab's WebView according to the app bar position. Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
+ // The fragment will take care of attaching the root automatically.
+ val newPageView = if (bottomAppBar)
+ layoutInflater.inflate(R.layout.webview_framelayout_bottom_appbar, container, false)
+ else
+ layoutInflater.inflate(R.layout.webview_framelayout_top_appbar, container, false)
+
+ // Get handles for the views.
+ nestedScrollWebView = newPageView.findViewById(R.id.nestedscroll_webview)
+ val progressBar = newPageView.findViewById<ProgressBar>(R.id.progress_bar)
+
+ // Store the WebView fragment ID in the nested scroll WebView.
+ nestedScrollWebView.webViewFragmentId = fragmentId
+