mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/15402: Hide ETP pop-up if the toolbar is not visible (https://github.com/mozilla-mobile/fenix/pull/15667)
For https://github.com/mozilla-mobile/fenix/issues/15402: Hide ETP pop-up when top or bottom toolbar is not visible
This commit is contained in:
parent
17fc28304a
commit
3aaded4868
@ -15,6 +15,7 @@ import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.marginTop
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.*
|
||||
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.*
|
||||
import mozilla.components.browser.session.Session
|
||||
@ -49,8 +50,27 @@ class TrackingProtectionOverlay(
|
||||
|
||||
@Suppress("MagicNumber", "InflateParams")
|
||||
private fun showTrackingProtectionOnboarding() {
|
||||
|
||||
if (!getToolbar().hasWindowFocus()) return
|
||||
|
||||
val toolbarPosition = settings.toolbarPosition
|
||||
|
||||
when (toolbarPosition) {
|
||||
ToolbarPosition.BOTTOM -> {
|
||||
if (getToolbar().translationY > 0) {
|
||||
return
|
||||
}
|
||||
}
|
||||
ToolbarPosition.TOP -> {
|
||||
val appBarLayout = getToolbar().parent as? AppBarLayout
|
||||
appBarLayout?.let { appBar ->
|
||||
if (appBar.y != 0.toFloat()) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val trackingOnboardingDialog = object : Dialog(context) {
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
|
||||
@ -63,7 +83,6 @@ class TrackingProtectionOverlay(
|
||||
|
||||
val layout = LayoutInflater.from(context)
|
||||
.inflate(R.layout.tracking_protection_onboarding_popup, null)
|
||||
val toolbarPosition = settings.toolbarPosition
|
||||
|
||||
layout.drop_down_triangle.isVisible = toolbarPosition == ToolbarPosition.TOP
|
||||
layout.pop_up_triangle.isVisible = toolbarPosition == ToolbarPosition.BOTTOM
|
||||
|
Loading…
Reference in New Issue
Block a user