parent
e8972bb47d
commit
d1b134c2ff
|
@ -51,8 +51,8 @@ import mozilla.components.feature.session.SwipeRefreshFeature
|
||||||
import mozilla.components.feature.sitepermissions.SitePermissions
|
import mozilla.components.feature.sitepermissions.SitePermissions
|
||||||
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
|
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
|
||||||
import mozilla.components.feature.sitepermissions.SitePermissionsRules
|
import mozilla.components.feature.sitepermissions.SitePermissionsRules
|
||||||
import mozilla.components.support.base.feature.UserInteractionHandler
|
|
||||||
import mozilla.components.support.base.feature.PermissionsFeature
|
import mozilla.components.support.base.feature.PermissionsFeature
|
||||||
|
import mozilla.components.support.base.feature.UserInteractionHandler
|
||||||
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
||||||
import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded
|
import mozilla.components.support.ktx.android.view.exitImmersiveModeIfNeeded
|
||||||
import org.mozilla.fenix.Experiments
|
import org.mozilla.fenix.Experiments
|
||||||
|
@ -254,8 +254,14 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
promptsStyling = DownloadsFeature.PromptsStyling(
|
promptsStyling = DownloadsFeature.PromptsStyling(
|
||||||
gravity = Gravity.BOTTOM,
|
gravity = Gravity.BOTTOM,
|
||||||
shouldWidthMatchParent = true,
|
shouldWidthMatchParent = true,
|
||||||
positiveButtonBackgroundColor = ThemeManager.resolveAttribute(R.attr.accent, context),
|
positiveButtonBackgroundColor = ThemeManager.resolveAttribute(
|
||||||
positiveButtonTextColor = ThemeManager.resolveAttribute(R.attr.contrastText, context),
|
R.attr.accent,
|
||||||
|
context
|
||||||
|
),
|
||||||
|
positiveButtonTextColor = ThemeManager.resolveAttribute(
|
||||||
|
R.attr.contrastText,
|
||||||
|
context
|
||||||
|
),
|
||||||
positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat()
|
positiveButtonRadius = (resources.getDimensionPixelSize(R.dimen.tab_corner_radius)).toFloat()
|
||||||
),
|
),
|
||||||
onNeedToRequestPermissions = { permissions ->
|
onNeedToRequestPermissions = { permissions ->
|
||||||
|
@ -266,7 +272,8 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
downloadFeature.onDownloadStopped = { download, _, downloadJobStatus ->
|
downloadFeature.onDownloadStopped = { download, _, downloadJobStatus ->
|
||||||
// If the download is just paused, don't show any in-app notification
|
// If the download is just paused, don't show any in-app notification
|
||||||
if (downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.COMPLETED ||
|
if (downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.COMPLETED ||
|
||||||
downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED) {
|
downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED
|
||||||
|
) {
|
||||||
val dialog = DownloadNotificationBottomSheetDialog(
|
val dialog = DownloadNotificationBottomSheetDialog(
|
||||||
context = context,
|
context = context,
|
||||||
didFail = downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED,
|
didFail = downloadJobStatus == AbstractFetchDownloadService.DownloadJobStatus.FAILED,
|
||||||
|
@ -275,7 +282,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
onCannotOpenFile = {
|
onCannotOpenFile = {
|
||||||
FenixSnackbar.make(view, Snackbar.LENGTH_SHORT)
|
FenixSnackbar.make(view, Snackbar.LENGTH_SHORT)
|
||||||
.setText(context.getString(R.string.mozac_feature_downloads_could_not_open_file))
|
.setText(context.getString(R.string.mozac_feature_downloads_could_not_open_file))
|
||||||
.setAnchorView(browserToolbarView.view)
|
.setAnchorView(browserToolbarView.getSnackbarAnchor())
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +677,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
|
|
||||||
view?.let { view ->
|
view?.let { view ->
|
||||||
FenixSnackbar.make(view, Snackbar.LENGTH_LONG)
|
FenixSnackbar.make(view, Snackbar.LENGTH_LONG)
|
||||||
.setAnchorView(browserToolbarView.view)
|
.setAnchorView(browserToolbarView.getSnackbarAnchor())
|
||||||
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
||||||
nav(
|
nav(
|
||||||
R.id.browserFragment,
|
R.id.browserFragment,
|
||||||
|
|
|
@ -256,7 +256,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
|
||||||
view?.let { view ->
|
view?.let { view ->
|
||||||
FenixSnackbar.make(view, Snackbar.LENGTH_SHORT)
|
FenixSnackbar.make(view, Snackbar.LENGTH_SHORT)
|
||||||
.setText(view.context.getString(R.string.create_collection_tab_saved))
|
.setText(view.context.getString(R.string.create_collection_tab_saved))
|
||||||
.setAnchorView(browserToolbarView.view)
|
.setAnchorView(browserToolbarView.getSnackbarAnchor())
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,14 @@ class BrowserToolbarView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the correct snackbar anchor for bottom or top toolbar configuration.
|
||||||
|
* A null anchor view is ignored.
|
||||||
|
*
|
||||||
|
* @see #setAnchorView(com.google.android.material.snackbar.BaseTransientBottomBar)
|
||||||
|
*/
|
||||||
|
fun getSnackbarAnchor(): View? = if (shouldUseBottomToolbar) view else null
|
||||||
|
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun update(state: BrowserFragmentState) {
|
fun update(state: BrowserFragmentState) {
|
||||||
// Intentionally leaving this as a stub for now since we don't actually want to update currently
|
// Intentionally leaving this as a stub for now since we don't actually want to update currently
|
||||||
|
|
Loading…
Reference in New Issue