For #21906 ⁃ Remove old copy form inactive tabs section

upstream-sync
Arturo Mejia 3 years ago committed by mergify[bot]
parent 55763073b5
commit 25c784b684

@ -5,7 +5,6 @@
package org.mozilla.fenix.tabstray.browser
import android.view.View
import androidx.annotation.StringRes
import androidx.core.view.updatePadding
import androidx.recyclerview.widget.RecyclerView
import mozilla.components.browser.toolbar.MAX_URI_LENGTH
@ -20,10 +19,6 @@ import org.mozilla.fenix.ext.loadIntoView
import org.mozilla.fenix.ext.toShortUrl
import org.mozilla.fenix.home.topsites.dpToPx
import org.mozilla.fenix.tabstray.TabsTrayInteractor
import org.mozilla.fenix.tabstray.browser.AutoCloseInterval.Manual
import org.mozilla.fenix.tabstray.browser.AutoCloseInterval.OneDay
import org.mozilla.fenix.tabstray.browser.AutoCloseInterval.OneMonth
import org.mozilla.fenix.tabstray.browser.AutoCloseInterval.OneWeek
sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
@ -135,27 +130,8 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
class FooterHolder(itemView: View) : InactiveTabViewHolder(itemView) {
val binding = InactiveFooterItemBinding.bind(itemView)
fun bind(interval: AutoCloseInterval) {
val context = itemView.context
val stringRes = when (interval) {
Manual, OneDay -> {
binding.inactiveDescription.visibility = View.GONE
binding.topDivider.visibility = View.GONE
null
}
OneWeek -> {
context.getString(interval.description)
}
OneMonth -> {
context.getString(interval.description)
}
}
if (stringRes != null) {
binding.inactiveDescription.text =
context.getString(R.string.inactive_tabs_description, stringRes)
}
init {
InactiveFooterItemBinding.bind(itemView)
}
companion object {
@ -163,10 +139,3 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
}
}
}
enum class AutoCloseInterval(@StringRes val description: Int) {
Manual(0),
OneDay(0),
OneWeek(R.string.inactive_tabs_7_days),
OneMonth(R.string.inactive_tabs_30_days)
}

@ -19,7 +19,6 @@ import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.AutoCloseDialogH
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.FooterHolder
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.HeaderHolder
import org.mozilla.fenix.tabstray.browser.InactiveTabViewHolder.TabViewHolder
import org.mozilla.fenix.tabstray.ext.autoCloseInterval
import org.mozilla.fenix.utils.Settings
import mozilla.components.support.base.observer.Observable as ComponentObservable
@ -73,11 +72,8 @@ class InactiveTabsAdapter(
val item = getItem(position) as Item.Tab
holder.bind(item.tab)
}
is FooterHolder -> {
val item = getItem(position) as Item.Footer
holder.bind(item.interval)
}
is HeaderHolder, is AutoCloseDialogHolder -> {
is FooterHolder, is HeaderHolder, is AutoCloseDialogHolder -> {
// do nothing.
}
}
@ -112,7 +108,7 @@ class InactiveTabsAdapter(
}
val items = tabs.list.map { Item.Tab(it) }
val footer = Item.Footer(context.autoCloseInterval)
val footer = Item.Footer
val headerItems = if (settings.shouldShowInactiveTabsAutoCloseDialog(items.size)) {
listOf(Item.Header, Item.AutoCloseMessage)
} else {
@ -162,6 +158,6 @@ class InactiveTabsAdapter(
* A footer for the inactive tab section. This may be seen only
* when at least one inactive tab is present.
*/
data class Footer(val interval: AutoCloseInterval) : Item()
object Footer : Item()
}
}

@ -6,7 +6,6 @@ package org.mozilla.fenix.tabstray.ext
import android.content.Context
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.tabstray.browser.AutoCloseInterval
const val MIN_COLUMN_WIDTH_DP = 180
@ -32,16 +31,3 @@ internal val Context.defaultBrowserLayoutColumns: Int
1
}
}
/**
* Returns the appropriate [AutoCloseInterval] based on user preferences.
*/
internal val Context.autoCloseInterval: AutoCloseInterval
get() = with(components.settings) {
when {
closeTabsAfterOneDay -> AutoCloseInterval.OneDay
closeTabsAfterOneWeek -> AutoCloseInterval.OneWeek
closeTabsAfterOneMonth -> AutoCloseInterval.OneMonth
else -> AutoCloseInterval.Manual
}
}

@ -15,37 +15,11 @@
android:paddingEnd="1dp"
android:paddingBottom="1dp">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_bottom_corners"
android:paddingBottom="8dp">
<View
android:id="@+id/top_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?neutralFaded"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/inactive_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp"
android:textColor="?secondaryText"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/top_divider"
tools:text="@string/inactive_tabs_description" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -1944,11 +1944,11 @@
<!-- Content description for closing all inactive tabs -->
<string name="inactive_tabs_delete_all">Close all inactive tabs</string>
<!-- A description below the section of "inactive" tabs to notify the user when those tabs will be closed, if appropriate. See strings inactive_tabs_30_days and inactive_tabs_7_days for placeholders options. -->
<string name="inactive_tabs_description">Tabs are available here for %s. After that time, tabs will be automatically closed.</string>
<string name="inactive_tabs_description" moz:removedIn="93" tools:ignore="UnusedResources">Tabs are available here for %s. After that time, tabs will be automatically closed.</string>
<!-- The amount of time until a tab in the "inactive" section of the tabs tray will be closed. See string inactive_tabs_description as well -->
<string name="inactive_tabs_30_days">30 days</string>
<string name="inactive_tabs_30_days" moz:removedIn="93" tools:ignore="UnusedResources">30 days</string>
<!-- The amount of time until a tab in the "inactive" section of the tabs tray will be closed. See string inactive_tabs_description as well -->
<string name="inactive_tabs_7_days">1 week</string>
<string name="inactive_tabs_7_days" moz:removedIn="93" tools:ignore="UnusedResources">1 week</string>
<!-- Inactive tabs auto-close message in the tabs tray -->
<!-- The header text of the auto-close message when the user is asked if they want to turn on the auto-closing of inactive tabs. -->

Loading…
Cancel
Save