Revision control
Copy as Markdown
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
package org.mozilla.reference.browser.tabs
import androidx.recyclerview.widget.ItemTouchHelper
import mozilla.components.browser.state.state.TabSessionState
import mozilla.components.browser.tabstray.TabTouchCallback
import kotlin.math.abs
class TabsTouchHelper(
observable: (TabSessionState) -> Unit,
) : ItemTouchHelper(object : TabTouchCallback(observable) {
override fun alphaForItemSwipe(
dX: Float,
distanceToAlphaMin: Int,
): Float = 1f - 2f * abs(dX) / distanceToAlphaMin
})