diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/TrayPagerAdapter.kt b/app/src/main/java/org/mozilla/fenix/tabstray/TrayPagerAdapter.kt index da04b28098..3ee2f2325a 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/TrayPagerAdapter.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/TrayPagerAdapter.kt @@ -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 -> { diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/browser/NormalBrowserTrayList.kt b/app/src/main/java/org/mozilla/fenix/tabstray/browser/NormalBrowserTrayList.kt index 3b4cd2e4eb..975a3707fd 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/browser/NormalBrowserTrayList.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/browser/NormalBrowserTrayList.kt @@ -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 {