[fenix] Code cleanup - Remove unused FindInPageBarBehavior

There is a "unused" lint suppression in place with the comment
"Referenced from XML". I found no such usage.
It's documentation says that this Behavior will always position FindInPageBar
above BrowserToolbar but the current code ensures
BrowserToolbar.visibility == GONE when FindInPageBar.visibility == VISIBLE
so there's no need for such behavior.
pull/600/head
Petru Lingurar 5 years ago committed by Jonathan Almeida
parent f911a3d485
commit 37308af6b8

@ -4,17 +4,13 @@
package org.mozilla.fenix.components
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.ViewStub
import androidx.coordinatorlayout.widget.CoordinatorLayout
import mozilla.components.browser.session.SessionManager
import mozilla.components.browser.session.runWithSessionIdOrSelected
import mozilla.components.browser.toolbar.BrowserToolbar
import mozilla.components.concept.engine.EngineView
import mozilla.components.feature.findinpage.FindInPageFeature
import mozilla.components.feature.findinpage.view.FindInPageBar
import mozilla.components.feature.findinpage.view.FindInPageView
import mozilla.components.support.base.feature.LifecycleAwareFeature
import org.mozilla.fenix.test.Mockable
@ -44,42 +40,3 @@ class FindInPageIntegration(
}
}
}
/**
* [CoordinatorLayout.Behavior] that will always position the [FindInPageBar] above the [BrowserToolbar] (including
* when the browser toolbar is scrolling or performing a snap animation).
*/
@Suppress("unused") // Referenced from XML
class FindInPageBarBehavior(
context: Context,
attrs: AttributeSet
) : CoordinatorLayout.Behavior<FindInPageBar>(context, attrs) {
override fun layoutDependsOn(
parent: CoordinatorLayout,
child: FindInPageBar,
dependency: View
): Boolean {
if (dependency is BrowserToolbar) {
return true
}
return super.layoutDependsOn(parent, child, dependency)
}
override fun onDependentViewChanged(
parent: CoordinatorLayout,
child: FindInPageBar,
dependency: View
): Boolean {
return if (dependency is BrowserToolbar) {
repositionFindInPageBar(child, dependency)
true
} else {
false
}
}
private fun repositionFindInPageBar(findInPageView: FindInPageBar, toolbar: BrowserToolbar) {
findInPageView.translationY = (toolbar.translationY + toolbar.height * -1.0).toFloat()
}
}

Loading…
Cancel
Save