]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewStateAdapter.kt
Move the progress bar to the bottom when using the bottom app bar. https://redmine...
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / adapters / WebViewStateAdapter.kt
index 7a7913a5de77dc7288f192cc380976c7df31594c..d16636308671ea3ee0b5f194bcb3ee63c1f90cdc 100644 (file)
@@ -34,7 +34,7 @@ import com.stoutner.privacybrowser.views.NestedScrollWebView
 
 import java.util.LinkedList
 
-class WebViewStateAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
+class WebViewStateAdapter(fragmentActivity: FragmentActivity, private val bottomAppBar: Boolean) : FragmentStateAdapter(fragmentActivity) {
     // Define the class variables.
     private val webViewFragmentsList = LinkedList<WebViewTabFragment>()
 
@@ -84,7 +84,7 @@ class WebViewStateAdapter(fragmentActivity: FragmentActivity) : FragmentStateAda
 
     fun addPage(pagePosition: Int, url: String) {
         // Add a new page.
-        webViewFragmentsList.add(pagePosition, WebViewTabFragment.createPage(pagePosition, url))
+        webViewFragmentsList.add(pagePosition, WebViewTabFragment.createPage(pagePosition, url, bottomAppBar))
 
         // Update the view pager.
         notifyItemInserted(pagePosition)
@@ -156,7 +156,7 @@ class WebViewStateAdapter(fragmentActivity: FragmentActivity) : FragmentStateAda
 
     fun restorePage(savedState: Bundle, savedNestedScrollWebViewState: Bundle) {
         // Restore the page.
-        webViewFragmentsList.add(WebViewTabFragment.restorePage(savedState, savedNestedScrollWebViewState))
+        webViewFragmentsList.add(WebViewTabFragment.restorePage(savedState, savedNestedScrollWebViewState, bottomAppBar))
 
         // Update the view pager.  The position is zero indexed.
         notifyItemInserted(webViewFragmentsList.size - 1)