Skip to content

Commit

Permalink
Issue mozilla-mobile#21671: Remove Recently Closed from Inactive Tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalmeida authored and mergify[bot] committed Oct 4, 2021
1 parent 16a3b92 commit b8946f8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import mozilla.components.browser.toolbar.MAX_URI_LENGTH
import mozilla.components.concept.tabstray.Tab
import org.mozilla.fenix.R
import org.mozilla.fenix.databinding.InactiveFooterItemBinding
import org.mozilla.fenix.databinding.InactiveRecentlyClosedItemBinding
import org.mozilla.fenix.databinding.InactiveHeaderItemBinding
import org.mozilla.fenix.databinding.InactiveTabListItemBinding
import org.mozilla.fenix.ext.components
Expand Down Expand Up @@ -106,28 +105,6 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
}
}

class RecentlyClosedHolder(
itemView: View,
private val browserTrayInteractor: BrowserTrayInteractor,
) : InactiveTabViewHolder(itemView) {

val binding = InactiveRecentlyClosedItemBinding.bind(itemView)

fun bind() {
val context = itemView.context
binding.inactiveRecentlyClosedText.text =
context.getString(R.string.tab_tray_inactive_recently_closed)

binding.inactiveRecentlyClosed.setOnClickListener {
browserTrayInteractor.onRecentlyClosedClicked()
}
}

companion object {
const val LAYOUT_ID = R.layout.inactive_recently_closed_item
}
}

class FooterHolder(itemView: View) : InactiveTabViewHolder(itemView) {

val binding = InactiveFooterItemBinding.bind(itemView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import org.mozilla.fenix.components.Components
import org.mozilla.fenix.tabstray.TabsTrayInteractor
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.FooterHolder
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.HeaderHolder
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.RecentlyClosedHolder
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.TabViewHolder
import org.mozilla.fenix.tabstray.ext.autoCloseInterval
import mozilla.components.support.base.observer.Observable as ComponentObservable
Expand Down Expand Up @@ -58,7 +57,6 @@ class InactiveTabsAdapter(
HeaderHolder.LAYOUT_ID -> HeaderHolder(view, inactiveTabsInteractor, tabsTrayInteractor)
TabViewHolder.LAYOUT_ID -> TabViewHolder(view, browserTrayInteractor, featureName)
FooterHolder.LAYOUT_ID -> FooterHolder(view)
RecentlyClosedHolder.LAYOUT_ID -> RecentlyClosedHolder(view, browserTrayInteractor)
else -> throw IllegalStateException("Unknown viewType: $viewType")
}
}
Expand All @@ -76,16 +74,12 @@ class InactiveTabsAdapter(
is HeaderHolder -> {
// do nothing.
}
is RecentlyClosedHolder -> {
holder.bind()
}
}
}

override fun getItemViewType(position: Int): Int {
return when (position) {
0 -> HeaderHolder.LAYOUT_ID
itemCount - 2 -> RecentlyClosedHolder.LAYOUT_ID
itemCount - 1 -> FooterHolder.LAYOUT_ID
else -> TabViewHolder.LAYOUT_ID
}
Expand All @@ -107,7 +101,7 @@ class InactiveTabsAdapter(
val items = tabs.list.map { Item.Tab(it) }
val footer = Item.Footer(context.autoCloseInterval)

submitList(listOf(Item.Header) + items + listOf(Item.RecentlyClosed, footer))
submitList(listOf(Item.Header) + items + listOf(footer))
}

override fun isTabSelected(tabs: Tabs, position: Int): Boolean = false
Expand Down Expand Up @@ -146,11 +140,6 @@ class InactiveTabsAdapter(
*/
data class Tab(val tab: TabsTrayTab) : Item()

/**
* A button that leads to the Recently Closed section in History.
*/
object RecentlyClosed : Item()

/**
* A footer for the inactive tab section. This may be seen only
* when at least one inactive tab is present.
Expand Down
54 changes: 0 additions & 54 deletions app/src/main/res/layout/inactive_recently_closed_item.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@
<!-- Text shown in the menu to view recently closed tabs -->
<string name="tab_tray_menu_recently_closed">Recently closed tabs</string>
<!-- Text shown in the tabs tray inactive tabs section -->
<string name="tab_tray_inactive_recently_closed">Recently closed</string>
<string name="tab_tray_inactive_recently_closed" tools:ignore="UnusedResources">Recently closed</string>
<!-- Text shown in the menu to view account settings -->
<string name="tab_tray_menu_account_settings">Account settings</string>
<!-- Text shown in the menu to view tab settings -->
Expand Down

0 comments on commit b8946f8

Please sign in to comment.