2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[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

This commit is contained in:
Noah Bond 2021-09-09 10:19:15 -07:00 committed by mergify[bot]
parent 1d78c8b1a7
commit 434c0b6918
2 changed files with 8 additions and 6 deletions

View File

@ -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 -> {

View File

@ -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 {