[fenix] Issue mozilla-mobilehttps://github.com/mozilla-mobile/fenix/issues/20637 - Fixed bug causing the tabs tray to scroll to the wrong tab when opened

pull/600/head
Noah Bond 3 years ago committed by mergify[bot]
parent 1d78c8b1a7
commit 434c0b6918

@ -18,6 +18,8 @@ import org.mozilla.fenix.sync.SyncedTabsAdapter
import org.mozilla.fenix.tabstray.browser.BrowserTabsAdapter
import org.mozilla.fenix.tabstray.browser.BrowserTrayInteractor
import org.mozilla.fenix.tabstray.browser.InactiveTabsAdapter
import org.mozilla.fenix.tabstray.browser.maxActiveTime
import org.mozilla.fenix.tabstray.ext.isNormalTabActive
import org.mozilla.fenix.tabstray.syncedtabs.TabClickDelegate
import org.mozilla.fenix.tabstray.viewholders.AbstractPageViewHolder
import org.mozilla.fenix.tabstray.viewholders.NormalBrowserPageViewHolder
@ -53,7 +55,7 @@ class TrayPagerAdapter(
itemView,
store,
interactor,
browserStore.state.normalTabs.indexOf(selectedTab)
browserStore.state.normalTabs.filter { it.isNormalTabActive(maxActiveTime) }.indexOf(selectedTab)
)
}
PrivateBrowserPageViewHolder.LAYOUT_ID -> {

@ -23,17 +23,17 @@ import java.util.concurrent.TimeUnit
*/
const val DEFAULT_ACTIVE_DAYS = 4L
/**
* The maximum time from when a tab was created or accessed until it is considered "inactive".
*/
val maxActiveTime = TimeUnit.DAYS.toMillis(DEFAULT_ACTIVE_DAYS)
class NormalBrowserTrayList @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : AbstractBrowserTrayList(context, attrs, defStyleAttr) {
/**
* The maximum time from when a tab was created or accessed until it is considered "inactive".
*/
var maxActiveTime = TimeUnit.DAYS.toMillis(DEFAULT_ACTIVE_DAYS)
private val concatAdapter by lazy { adapter as ConcatAdapter }
override val tabsFeature by lazy {

Loading…
Cancel
Save