Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
fenix
Commits
8b843ac9
Commit
8b843ac9
authored
May 26, 2020
by
David Walsh
Committed by
Jeff Boek
May 27, 2020
Browse files
Fix elevation for snackbar and fab
parent
e9bcc9bb
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
View file @
8b843ac9
...
...
@@ -221,9 +221,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
tabTrayDialog
.
dismiss
()
}
override
fun
onTabClosed
(
tab
:
Tab
)
{
TODO
(
"Not yet implemented"
)
}
override
fun
onTabClosed
(
tab
:
Tab
)
{
/* noop */
}
override
fun
onNewTabTapped
(
private
:
Boolean
)
{
(
activity
as
HomeActivity
).
browsingModeManager
.
mode
=
BrowsingMode
.
fromBoolean
(
private
)
...
...
app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
View file @
8b843ac9
...
...
@@ -373,7 +373,7 @@ class HomeFragment : Fragment() {
}
override
fun
onTabClosed
(
tab
:
mozilla
.
components
.
concept
.
tabstray
.
Tab
)
{
TODO
(
"Not yet implemented"
)
/* noop */
}
}
}
...
...
app/src/main/java/org/mozilla/fenix/tabtray/TabTrayDialogFragment.kt
View file @
8b843ac9
...
...
@@ -68,7 +68,6 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
}
override
fun
onTabClosed
(
tab
:
Tab
)
{
// interactor?.onTabClosed(tab)
val
sessionManager
=
view
?.
context
?.
components
?.
core
?.
sessionManager
val
snapshot
=
sessionManager
?.
findSessionById
(
tab
.
id
)
?.
let
{
...
...
@@ -84,16 +83,18 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
getString
(
R
.
string
.
snackbar_tab_closed
)
}
viewLifecycleOwner
.
lifecycleScope
.
allowUndo
(
requireView
(),
snackbarMessage
,
getString
(
R
.
string
.
snackbar_deleted_undo
),
{
sessionManager
.
add
(
snapshot
.
session
,
isSelected
,
engineSessionState
=
state
)
},
operation
=
{
},
anchorView
=
view
?.
handle
)
view
?.
tabLayout
?.
let
{
viewLifecycleOwner
.
lifecycleScope
.
allowUndo
(
it
,
snackbarMessage
,
getString
(
R
.
string
.
snackbar_deleted_undo
),
{
sessionManager
.
add
(
snapshot
.
session
,
isSelected
,
engineSessionState
=
state
)
},
operation
=
{
},
elevation
=
ELEVATION
)
}
}
override
fun
onTabSelected
(
tab
:
Tab
)
{
...
...
@@ -107,4 +108,8 @@ class TabTrayDialogFragment : AppCompatDialogFragment(), TabTrayInteractor {
override
fun
onTabTrayDismissed
()
{
dismissAllowingStateLoss
()
}
companion
object
{
private
const
val
ELEVATION
=
80f
}
}
app/src/main/java/org/mozilla/fenix/tabtray/TabTrayView.kt
View file @
8b843ac9
...
...
@@ -52,7 +52,7 @@ class TabTrayView(
behavior
.
addBottomSheetCallback
(
object
:
BottomSheetBehavior
.
BottomSheetCallback
()
{
override
fun
onSlide
(
bottomSheet
:
View
,
slideOffset
:
Float
)
{
if
(
slideOffset
>
SLIDE_OFFSET
)
{
if
(
slideOffset
>
=
SLIDE_OFFSET
)
{
fabView
.
new_tab_button
.
show
()
}
else
{
fabView
.
new_tab_button
.
hide
()
...
...
@@ -120,7 +120,7 @@ class TabTrayView(
companion
object
{
private
const
val
DEFAULT_TAB_ID
=
0
private
const
val
PRIVATE_TAB_ID
=
1
private
const
val
SLIDE_OFFSET
=
0
.4
private
const
val
ELEVATION
=
41
f
private
const
val
SLIDE_OFFSET
=
0
private
const
val
ELEVATION
=
90
f
}
}
app/src/main/java/org/mozilla/fenix/utils/Undo.kt
View file @
8b843ac9
...
...
@@ -36,7 +36,8 @@ fun CoroutineScope.allowUndo(
undoActionTitle
:
String
,
onCancel
:
suspend
()
->
Unit
=
{},
operation
:
suspend
()
->
Unit
,
anchorView
:
View
?
=
null
anchorView
:
View
?
=
null
,
elevation
:
Float
?
=
null
)
{
// By using an AtomicBoolean, we achieve memory effects of reading and
// writing a volatile variable.
...
...
@@ -58,6 +59,10 @@ fun CoroutineScope.allowUndo(
}
}
elevation
?.
also
{
snackbar
.
view
.
elevation
=
it
}
snackbar
.
show
()
// Wait a bit, and if user didn't request cancellation, proceed with
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment