For #2794 - Adjust engine margins when enter/exit fullscreen
parent
71a8064411
commit
14fe356d62
|
@ -14,6 +14,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import androidx.navigation.Navigation
|
||||
|
@ -317,6 +318,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
toolbar.visibility = View.VISIBLE
|
||||
nestedScrollQuickAction.visibility = View.VISIBLE
|
||||
}
|
||||
changeEngineMargins(swipeRefresh = view.swipeRefresh, inFullScreen = it)
|
||||
},
|
||||
owner = this,
|
||||
view = view
|
||||
|
@ -388,6 +390,21 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
|
|||
}
|
||||
}
|
||||
|
||||
private fun changeEngineMargins(swipeRefresh: View, inFullScreen: Boolean) {
|
||||
swipeRefresh.apply {
|
||||
val toolbarAndQASSize = resources.getDimension(R.dimen.toolbar_and_qab_height).toInt()
|
||||
val toolbarSize = resources.getDimension(R.dimen.browser_toolbar_height).toInt()
|
||||
(layoutParams as CoordinatorLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (customTabSessionId == null || inFullScreen) 0 else toolbarSize,
|
||||
0,
|
||||
if (inFullScreen) 0 else if (customTabSessionId == null) toolbarAndQASSize else 0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
if (getSessionById() == null) findNavController(this).popBackStack(R.id.homeFragment, false)
|
||||
super.onResume()
|
||||
|
|
Loading…
Reference in New Issue