Unverified Commit c7c4ad05 authored by Sawyer Blatz's avatar Sawyer Blatz Committed by GitHub
Browse files

For #6413: Adds more snackbar positioning logic (#7444)

* For #6413: Adds more snackbar positioning logic

* Refactor
parent f6e286fd
...@@ -64,7 +64,6 @@ import org.mozilla.fenix.NavGraphDirections ...@@ -64,7 +64,6 @@ import org.mozilla.fenix.NavGraphDirections
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.browser.readermode.DefaultReaderModeController import org.mozilla.fenix.browser.readermode.DefaultReaderModeController
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.BrowserSnackbarPresenter
import org.mozilla.fenix.components.FindInPageIntegration import org.mozilla.fenix.components.FindInPageIntegration
import org.mozilla.fenix.components.StoreProvider import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
...@@ -160,7 +159,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session ...@@ -160,7 +159,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
// browsing data on quit" is activated). After the deletion is over, the snackbar // browsing data on quit" is activated). After the deletion is over, the snackbar
// is dismissed. // is dismissed.
val snackbar: FenixSnackbar? = requireActivity().getRootView()?.let { v -> val snackbar: FenixSnackbar? = requireActivity().getRootView()?.let { v ->
FenixSnackbar.make(v, Snackbar.LENGTH_INDEFINITE) FenixSnackbar.makeWithToolbarPadding(v)
.setText(v.context.getString(R.string.deleting_browsing_data_in_progress)) .setText(v.context.getString(R.string.deleting_browsing_data_in_progress))
} }
...@@ -283,12 +282,10 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session ...@@ -283,12 +282,10 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
download = download, download = download,
tryAgain = downloadFeature::tryAgain, tryAgain = downloadFeature::tryAgain,
onCannotOpenFile = { onCannotOpenFile = {
BrowserSnackbarPresenter(view).present( FenixSnackbar.makeWithToolbarPadding(view, Snackbar.LENGTH_SHORT)
text = context.getString(R.string.mozac_feature_downloads_could_not_open_file), .setText(context.getString(R.string.mozac_feature_downloads_could_not_open_file))
length = Snackbar.LENGTH_SHORT .show()
)
} }
) )
dialog.show() dialog.show()
} }
...@@ -520,9 +517,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session ...@@ -520,9 +517,9 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
@CallSuper @CallSuper
override fun onBackPressed(): Boolean { override fun onBackPressed(): Boolean {
return findInPageIntegration.onBackPressed() || return findInPageIntegration.onBackPressed() ||
fullScreenFeature.onBackPressed() || fullScreenFeature.onBackPressed() ||
sessionFeature.onBackPressed() || sessionFeature.onBackPressed() ||
removeSessionIfNeeded() removeSessionIfNeeded()
} }
/** /**
...@@ -703,17 +700,16 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session ...@@ -703,17 +700,16 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
requireComponents.analytics.metrics.track(Event.AddBookmark) requireComponents.analytics.metrics.track(Event.AddBookmark)
view?.let { view -> view?.let { view ->
BrowserSnackbarPresenter(view).present( FenixSnackbar.makeWithToolbarPadding(view)
text = getString(R.string.bookmark_saved_snackbar), .setText(getString(R.string.bookmark_saved_snackbar))
action = { nav( .setAction(getString(R.string.edit_bookmark_snackbar_action)) {
R.id.browserFragment, nav(
BrowserFragmentDirections.actionBrowserFragmentToBookmarkEditFragment( R.id.browserFragment,
guid BrowserFragmentDirections.actionBrowserFragmentToBookmarkEditFragment(
)) guid
}, ))
actionName = getString(R.string.edit_bookmark_snackbar_action), }
length = Snackbar.LENGTH_LONG .show()
)
} }
} }
} }
......
...@@ -30,7 +30,7 @@ import mozilla.components.support.base.feature.UserInteractionHandler ...@@ -30,7 +30,7 @@ import mozilla.components.support.base.feature.UserInteractionHandler
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.BrowserSnackbarPresenter import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.TabCollectionStorage import org.mozilla.fenix.components.TabCollectionStorage
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
...@@ -230,10 +230,9 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler { ...@@ -230,10 +230,9 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
private fun showTabSavedToCollectionSnackbar() { private fun showTabSavedToCollectionSnackbar() {
view?.let { view -> view?.let { view ->
BrowserSnackbarPresenter(view).present( FenixSnackbar.makeWithToolbarPadding(view, Snackbar.LENGTH_SHORT)
text = view.context.getString(R.string.create_collection_tab_saved), .setText(view.context.getString(R.string.create_collection_tab_saved))
length = Snackbar.LENGTH_SHORT .show()
)
} }
} }
} }
......
...@@ -6,9 +6,8 @@ package org.mozilla.fenix.browser ...@@ -6,9 +6,8 @@ package org.mozilla.fenix.browser
import android.view.View import android.view.View
import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.google.android.material.snackbar.Snackbar
import mozilla.components.feature.contextmenu.ContextMenuCandidate import mozilla.components.feature.contextmenu.ContextMenuCandidate
import org.mozilla.fenix.components.BrowserSnackbarPresenter import org.mozilla.fenix.components.FenixSnackbar
class FenixSnackbarDelegate(val view: View) : class FenixSnackbarDelegate(val view: View) :
ContextMenuCandidate.SnackbarDelegate { ContextMenuCandidate.SnackbarDelegate {
...@@ -20,17 +19,14 @@ class FenixSnackbarDelegate(val view: View) : ...@@ -20,17 +19,14 @@ class FenixSnackbarDelegate(val view: View) :
listener: ((v: View) -> Unit)? listener: ((v: View) -> Unit)?
) { ) {
if (listener != null && action != 0) { if (listener != null && action != 0) {
BrowserSnackbarPresenter(view).present( FenixSnackbar.makeWithToolbarPadding(view)
text = view.context.getString(text), .setText(view.context.getString(text))
length = Snackbar.LENGTH_LONG, .setAction(view.context.getString(action)) { listener.invoke(view) }
actionName = view.context.getString(action), .show()
action = { listener.invoke(view) }
)
} else { } else {
BrowserSnackbarPresenter(view).present( FenixSnackbar.makeWithToolbarPadding(view)
text = view.context.getString(text), .setText(view.context.getString(text))
length = Snackbar.LENGTH_LONG .show()
)
} }
} }
} }
...@@ -32,11 +32,7 @@ class FenixSnackbar private constructor( ...@@ -32,11 +32,7 @@ class FenixSnackbar private constructor(
init { init {
view.background = null view.background = null
view.snackbar_layout.background = if (isError) { setAppropriateBackground(isError)
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_error_background)
} else {
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_background)
}
content.snackbar_btn.increaseTapArea(actionButtonIncreaseDps) content.snackbar_btn.increaseTapArea(actionButtonIncreaseDps)
...@@ -49,10 +45,22 @@ class FenixSnackbar private constructor( ...@@ -49,10 +45,22 @@ class FenixSnackbar private constructor(
) )
} }
fun setAppropriateBackground(isError: Boolean) {
view.snackbar_layout.background = if (isError) {
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_error_background)
} else {
AppCompatResources.getDrawable(context, R.drawable.fenix_snackbar_background)
}
}
fun setText(text: String) = this.apply { fun setText(text: String) = this.apply {
view.snackbar_text.text = text view.snackbar_text.text = text
} }
fun setLength(duration: Int) = this.apply {
this.duration = duration
}
fun setAction(text: String, action: () -> Unit) = this.apply { fun setAction(text: String, action: () -> Unit) = this.apply {
view.snackbar_btn.apply { view.snackbar_btn.apply {
setText(text) setText(text)
...@@ -90,6 +98,28 @@ class FenixSnackbar private constructor( ...@@ -90,6 +98,28 @@ class FenixSnackbar private constructor(
} }
} }
/**
* Considers BrowserToolbar for padding when making snackbar
*/
fun makeWithToolbarPadding(
view: View,
duration: Int = LENGTH_LONG,
isError: Boolean = false
): FenixSnackbar {
val shouldUseBottomToolbar = view.context.settings().shouldUseBottomToolbar
val toolbarHeight = view.context.resources
.getDimensionPixelSize(R.dimen.browser_toolbar_height)
return make(view, duration, isError).apply {
this.view.setPadding(
0,
0,
0,
if (shouldUseBottomToolbar) toolbarHeight else 0
)
}
}
// Use the same implementation of `Snackbar` // Use the same implementation of `Snackbar`
private fun findSuitableParent(_view: View?): ViewGroup? { private fun findSuitableParent(_view: View?): ViewGroup? {
var view = _view var view = _view
...@@ -147,35 +177,3 @@ private class FenixSnackbarCallback( ...@@ -147,35 +177,3 @@ private class FenixSnackbarCallback(
private const val animateOutDuration = 150L private const val animateOutDuration = 150L
} }
} }
/**
* This snackbar presenter should be used when displaying a snackbar that will appear in
* the BrowserFragment as it takes into account the position of the BrowserToolbar
*/
class BrowserSnackbarPresenter(
private val view: View
) {
fun present(
text: String,
length: Int = FenixSnackbar.LENGTH_LONG,
action: (() -> Unit)? = null,
actionName: String? = null,
isError: Boolean = false
) {
val shouldUseBottomToolbar = view.context.settings().shouldUseBottomToolbar
val toolbarHeight = view.context.resources
.getDimensionPixelSize(R.dimen.browser_toolbar_height)
FenixSnackbar.make(view, length, isError).apply {
if (action != null && actionName != null) setAction(actionName, action)
setText(text)
view.setPadding(
0,
0,
0,
if (shouldUseBottomToolbar) toolbarHeight else 0
)
show()
}
}
}
...@@ -20,10 +20,10 @@ import androidx.annotation.StringRes ...@@ -20,10 +20,10 @@ import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.constraintlayout.widget.ConstraintSet import androidx.constraintlayout.widget.ConstraintSet
import androidx.constraintlayout.widget.ConstraintSet.BOTTOM import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
import androidx.constraintlayout.widget.ConstraintSet.TOP
import androidx.constraintlayout.widget.ConstraintSet.START
import androidx.constraintlayout.widget.ConstraintSet.END import androidx.constraintlayout.widget.ConstraintSet.END
import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
import androidx.constraintlayout.widget.ConstraintSet.START
import androidx.constraintlayout.widget.ConstraintSet.TOP
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
...@@ -41,12 +41,12 @@ import androidx.transition.TransitionInflater ...@@ -41,12 +41,12 @@ import androidx.transition.TransitionInflater
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_home.view.* import kotlinx.android.synthetic.main.fragment_home.view.*
import kotlinx.coroutines.delay import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import mozilla.appservices.places.BookmarkRoot import mozilla.appservices.places.BookmarkRoot
import mozilla.components.browser.menu.BrowserMenu import mozilla.components.browser.menu.BrowserMenu
import mozilla.components.browser.session.Session import mozilla.components.browser.session.Session
...@@ -546,11 +546,7 @@ class HomeFragment : Fragment() { ...@@ -546,11 +546,7 @@ class HomeFragment : Fragment() {
deleteAndQuit( deleteAndQuit(
activity, activity,
lifecycleScope, lifecycleScope,
view?.let { view -> view?.let { view -> FenixSnackbar.makeWithToolbarPadding(view) }
FenixSnackbar.make(view, Snackbar.LENGTH_INDEFINITE)
.setText(view.context.getString(R.string.deleting_browsing_data_in_progress))
.setAnchorView(bottom_bar)
}
) )
} }
} }
......
...@@ -17,7 +17,7 @@ import org.mozilla.fenix.BrowserDirection ...@@ -17,7 +17,7 @@ import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.BrowserSnackbarPresenter import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.Services import org.mozilla.fenix.components.Services
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
...@@ -46,7 +46,7 @@ interface BookmarkController { ...@@ -46,7 +46,7 @@ interface BookmarkController {
class DefaultBookmarkController( class DefaultBookmarkController(
private val context: Context, private val context: Context,
private val navController: NavController, private val navController: NavController,
private val snackbarPresenter: BrowserSnackbarPresenter, private val snackbar: FenixSnackbar,
private val deleteBookmarkNodes: (Set<BookmarkNode>, Event) -> Unit, private val deleteBookmarkNodes: (Set<BookmarkNode>, Event) -> Unit,
private val invokePendingDeletion: () -> Unit private val invokePendingDeletion: () -> Unit
) : BookmarkController { ) : BookmarkController {
...@@ -72,13 +72,15 @@ class DefaultBookmarkController( ...@@ -72,13 +72,15 @@ class DefaultBookmarkController(
} }
override fun handleBookmarkSelected(node: BookmarkNode) { override fun handleBookmarkSelected(node: BookmarkNode) {
snackbarPresenter.present(resources.getString(R.string.bookmark_cannot_edit_root)) snackbar.setText(resources.getString(R.string.bookmark_cannot_edit_root))
snackbar.show()
} }
override fun handleCopyUrl(item: BookmarkNode) { override fun handleCopyUrl(item: BookmarkNode) {
val urlClipData = ClipData.newPlainText(item.url, item.url) val urlClipData = ClipData.newPlainText(item.url, item.url)
context.getSystemService<ClipboardManager>()?.primaryClip = urlClipData context.getSystemService<ClipboardManager>()?.primaryClip = urlClipData
snackbarPresenter.present(resources.getString(R.string.url_copied)) snackbar.setText(resources.getString(R.string.url_copied))
snackbar.show()
} }
override fun handleBookmarkSharing(item: BookmarkNode) { override fun handleBookmarkSharing(item: BookmarkNode) {
......
...@@ -38,7 +38,7 @@ import mozilla.components.concept.sync.OAuthAccount ...@@ -38,7 +38,7 @@ import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.lib.state.ext.consumeFrom import mozilla.components.lib.state.ext.consumeFrom
import mozilla.components.support.base.feature.UserInteractionHandler import mozilla.components.support.base.feature.UserInteractionHandler
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.BrowserSnackbarPresenter import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.StoreProvider import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.bookmarkStorage import org.mozilla.fenix.ext.bookmarkStorage
...@@ -87,7 +87,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan ...@@ -87,7 +87,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarksController = DefaultBookmarkController( bookmarksController = DefaultBookmarkController(
context = context!!, context = context!!,
navController = findNavController(), navController = findNavController(),
snackbarPresenter = BrowserSnackbarPresenter(view), snackbar = FenixSnackbar.make(view, FenixSnackbar.LENGTH_LONG),
deleteBookmarkNodes = ::deleteMulti, deleteBookmarkNodes = ::deleteMulti,
invokePendingDeletion = ::invokePendingDeletion invokePendingDeletion = ::invokePendingDeletion
), ),
......
...@@ -37,7 +37,7 @@ import mozilla.components.concept.storage.BookmarkNodeType ...@@ -37,7 +37,7 @@ import mozilla.components.concept.storage.BookmarkNodeType
import mozilla.components.support.ktx.android.content.getColorFromAttr import mozilla.components.support.ktx.android.content.getColorFromAttr
import mozilla.components.support.ktx.android.view.hideKeyboard import mozilla.components.support.ktx.android.view.hideKeyboard
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.BrowserSnackbarPresenter import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getRootView import org.mozilla.fenix.ext.getRootView
...@@ -187,13 +187,14 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark) { ...@@ -187,13 +187,14 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark) {
.popBackStack() .popBackStack()
bookmarkNode?.let { bookmark -> bookmarkNode?.let { bookmark ->
BrowserSnackbarPresenter(activity.getRootView()!!).present( FenixSnackbar.makeWithToolbarPadding(activity.getRootView()!!)
getString( .setText(
R.string.bookmark_deletion_snackbar_message, getString(R.string.bookmark_deletion_snackbar_message,
bookmark.url?.toShortUrl(context.components.publicSuffixList) bookmark.url?.toShortUrl(context.components.publicSuffixList)
?: bookmark.title ?: bookmark.title
)
) )
) .show()
} }
} }
} }
......
...@@ -18,7 +18,6 @@ import mozilla.components.concept.sync.AuthType ...@@ -18,7 +18,6 @@ import mozilla.components.concept.sync.AuthType
import mozilla.components.concept.sync.OAuthAccount import mozilla.components.concept.sync.OAuthAccount
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.BrowserSnackbarPresenter
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.showToolbar import org.mozilla.fenix.ext.showToolbar
...@@ -26,6 +25,9 @@ import org.mozilla.fenix.ext.showToolbar ...@@ -26,6 +25,9 @@ import org.mozilla.fenix.ext.showToolbar
@SuppressWarnings("TooManyFunctions") @SuppressWarnings("TooManyFunctions")
class TurnOnSyncFragment : Fragment(), AccountObserver { class TurnOnSyncFragment : Fragment(), AccountObserver {
private val safeArguments get() = requireNotNull(arguments)
private val args get() = TurnOnSyncFragmentArgs.fromBundle(safeArguments)
private val signInClickListener = View.OnClickListener { private val signInClickListener = View.OnClickListener {
requireComponents.services.accountsAuthFeature.beginAuthentication(requireContext()) requireComponents.services.accountsAuthFeature.beginAuthentication(requireContext())
// TODO The sign-in web content populates session history, // TODO The sign-in web content populates session history,
...@@ -74,9 +76,19 @@ class TurnOnSyncFragment : Fragment(), AccountObserver { ...@@ -74,9 +76,19 @@ class TurnOnSyncFragment : Fragment(), AccountObserver {
} }
override fun onAuthenticated(account: OAuthAccount, authType: AuthType) { override fun onAuthenticated(account: OAuthAccount, authType: AuthType) {
BrowserSnackbarPresenter(requireView()).present( val snackbarText = requireContext().getString(R.string.sync_syncing_in_progress)
text = requireContext().getString(R.string.sync_syncing_in_progress), val snackbarLength = FenixSnackbar.LENGTH_SHORT
length = FenixSnackbar.LENGTH_SHORT
) // Since the snackbar can be presented in BrowserFragment or in SettingsFragment we must
// base our display method on the padSnackbar argument
if (args.padSnackbar) {
FenixSnackbar.makeWithToolbarPadding(requireView(), snackbarLength)
.setText(snackbarText)
.show()
} else {
FenixSnackbar.make(requireView(), snackbarLength)
.setText(snackbarText)
.show()
}
} }
} }
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
package org.mozilla.fenix.settings.deletebrowsingdata package org.mozilla.fenix.settings.deletebrowsingdata
import android.app.Activity import android.app.Activity
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.joinAll import kotlinx.coroutines.joinAll
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
...@@ -21,7 +23,11 @@ fun deleteAndQuit(activity: Activity, coroutineScope: CoroutineScope, snackbar: ...@@ -21,7 +23,11 @@ fun deleteAndQuit(activity: Activity, coroutineScope: CoroutineScope, snackbar:
val settings = activity.settings() val settings = activity.settings()
val controller = DefaultDeleteBrowsingDataController(activity, coroutineContext) val controller = DefaultDeleteBrowsingDataController(activity, coroutineContext)
snackbar?.show() snackbar?.apply {
setText(activity.getString(R.string.deleting_browsing_data_in_progress))
duration = Snackbar.LENGTH_INDEFINITE
show()
}
DeleteBrowsingDataOnQuitType.values().map { type -> DeleteBrowsingDataOnQuitType.values().map { type ->
launch { launch {
......
...@@ -146,7 +146,7 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da ...@@ -146,7 +146,7 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
updateItemCounts() updateItemCounts()