For #21986 Confirmation when people set tabs to auto-close
For #22034 Inactive tabs prompt is redisplayed after dismissing by turning on Auto close
This commit is contained in:
parent
1a7b486808
commit
ee8c4de62d
|
@ -11,6 +11,7 @@ import mozilla.components.browser.toolbar.MAX_URI_LENGTH
|
|||
import mozilla.components.concept.tabstray.Tab
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.FenixSnackbar
|
||||
import org.mozilla.fenix.databinding.InactiveFooterItemBinding
|
||||
import org.mozilla.fenix.databinding.InactiveHeaderItemBinding
|
||||
import org.mozilla.fenix.databinding.InactiveTabListItemBinding
|
||||
|
@ -19,6 +20,7 @@ import org.mozilla.fenix.ext.components
|
|||
import org.mozilla.fenix.ext.loadIntoView
|
||||
import org.mozilla.fenix.ext.toShortUrl
|
||||
import org.mozilla.fenix.home.topsites.dpToPx
|
||||
import org.mozilla.fenix.tabstray.TabsTrayFragment
|
||||
import org.mozilla.fenix.tabstray.TabsTrayInteractor
|
||||
|
||||
sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
@ -80,9 +82,23 @@ sealed class InactiveTabViewHolder(itemView: View) : RecyclerView.ViewHolder(ite
|
|||
|
||||
binding.action.setOnClickListener {
|
||||
interactor.onEnabledAutoCloseClicked()
|
||||
showConfirmationSnackbar()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showConfirmationSnackbar() {
|
||||
val context = binding.root.context
|
||||
val view = binding.root
|
||||
val text = context.getString(R.string.inactive_tabs_auto_close_message_snackbar)
|
||||
val snackbar = FenixSnackbar.make(
|
||||
view = view,
|
||||
duration = FenixSnackbar.LENGTH_SHORT,
|
||||
isDisplayedWithBrowserToolbar = true
|
||||
).setText(text)
|
||||
snackbar.view.elevation = TabsTrayFragment.ELEVATION
|
||||
snackbar.show()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val LAYOUT_ID = R.layout.inactive_tabs_auto_close
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class InactiveTabsAutoCloseDialogController(
|
|||
* Enable the auto-close feature with the after a month setting.
|
||||
*/
|
||||
fun enableAutoClosed() {
|
||||
settings.hasInactiveTabsAutoCloseDialogBeenDismissed = true
|
||||
settings.closeTabsAfterOneMonth = true
|
||||
settings.closeTabsAfterOneWeek = false
|
||||
settings.closeTabsAfterOneDay = false
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
android:paddingHorizontal="1dp"
|
||||
android:background="@color/photonLightGrey30">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -18,7 +17,7 @@
|
|||
android:clickable="false"
|
||||
android:clipToPadding="false"
|
||||
android:focusable="true"
|
||||
android:padding="16dp">
|
||||
android:padding="12dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/banner_container"
|
||||
|
@ -28,7 +27,7 @@
|
|||
android:clipToPadding="false"
|
||||
android:background="@drawable/inactive_tab_auto_close_border_background"
|
||||
android:focusable="true"
|
||||
android:padding="16dp">
|
||||
android:padding="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/banner_info_message"
|
||||
|
@ -67,12 +66,12 @@
|
|||
android:background="?android:attr/selectableItemBackground"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:textAllCaps="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:text="@string/tab_tray_inactive_turn_on_auto_close_button"
|
||||
android:text="@string/tab_tray_inactive_turn_on_auto_close_button_2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/message" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
|
|
|
@ -117,7 +117,11 @@
|
|||
<!-- Content description for close button in the auto-close dialog of the inactive tabs. -->
|
||||
<string name="tab_tray_inactive_auto_close_button_content_description">Close</string>
|
||||
<!-- Text for turn on auto close tabs button in the auto-close dialog of the inactive tabs. -->
|
||||
<string name="tab_tray_inactive_turn_on_auto_close_button">Turn on auto close</string>
|
||||
<string name="tab_tray_inactive_turn_on_auto_close_button" moz:removedIn="95" tools:ignore="UnusedResources">Turn on auto close</string>
|
||||
|
||||
<!-- Text for turn on auto close tabs button in the auto-close dialog of the inactive tabs. -->
|
||||
<string name="tab_tray_inactive_turn_on_auto_close_button_2">Turn on auto-close</string>
|
||||
|
||||
|
||||
<!-- Home screen icons - Long press shortcuts -->
|
||||
<!-- Shortcut action to open new tab -->
|
||||
|
@ -1957,6 +1961,8 @@
|
|||
<string name="inactive_tabs_auto_close_message_description" tools:ignore="UnusedResources">Firefox can close tabs you haven’t viewed over the past month.</string>
|
||||
<!-- A call to action below the description to allow the user to turn on the auto closing of inactive tabs. -->
|
||||
<string name="inactive_tabs_auto_close_message_action" tools:ignore="UnusedResources">TURN ON AUTO CLOSE</string>
|
||||
<!-- Text for the snackbar to confirm auto-close is enabled for inactive tabs -->
|
||||
<string name="inactive_tabs_auto_close_message_snackbar">Auto-close enabled</string>
|
||||
|
||||
<!-- Inactive tabs survey -->
|
||||
<!-- Header text for the inactive tabs survey asking for feedback to improve the inactive tabs feature. -->
|
||||
|
|
Loading…
Reference in New Issue