Issue #21671: Remove Recently Closed from Inactive Tabs

upstream-sync
Jonathan Almeida 3 years ago committed by mergify[bot]
parent 16a3b92d34
commit b8946f807a

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

@ -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
@ -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")
}
}
@ -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
}
@ -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
@ -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.

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- 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
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@color/photonLightGrey30"
android:importantForAccessibility="no"
android:paddingStart="1dp"
android:paddingEnd="1dp">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/inactive_recently_closed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?above"
android:foreground="?android:attr/selectableItemBackground"
android:minHeight="@dimen/mozac_widget_site_item_height">
<TextView
android:id="@+id/inactive_recently_closed_text"
style="@style/Mozac.Widgets.SiteItem.Label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:importantForAccessibility="no"
android:text="@string/tab_tray_inactive_recently_closed"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/arrowhead_right"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="RecentlyClosed" />
<ImageView
android:id="@+id/arrowhead_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:importantForAccessibility="no"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_arrowhead_right" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

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

Loading…
Cancel
Save