Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
b59e05c6
Commit
b59e05c6
authored
Sep 22, 2020
by
Viktor De Pasquale
Committed by
John Wu
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a check against view being initialized in its behavior
The view will be simply hidden if not
parent
3c0630bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
HideBottomViewOnScrollBehavior.kt
.../topjohnwu/magisk/utils/HideBottomViewOnScrollBehavior.kt
+15
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/HideBottomViewOnScrollBehavior.kt
View file @
b59e05c6
...
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk.utils
...
@@ -3,6 +3,7 @@ package com.topjohnwu.magisk.utils
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.coordinatorlayout.widget.CoordinatorLayout
import
androidx.core.view.isGone
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
import
androidx.core.view.updateLayoutParams
import
androidx.core.view.updateLayoutParams
import
androidx.interpolator.view.animation.FastOutSlowInInterpolator
import
androidx.interpolator.view.animation.FastOutSlowInInterpolator
...
@@ -15,10 +16,16 @@ class HideBottomViewOnScrollBehavior<V : View> : HideBottomViewOnScrollBehavior<
...
@@ -15,10 +16,16 @@ class HideBottomViewOnScrollBehavior<V : View> : HideBottomViewOnScrollBehavior<
HideableBehavior
<
V
>
{
HideableBehavior
<
V
>
{
private
var
lockState
:
Boolean
=
false
private
var
lockState
:
Boolean
=
false
private
var
isLaidOut
=
false
override
fun
layoutDependsOn
(
parent
:
CoordinatorLayout
,
child
:
V
,
dependency
:
View
)
=
override
fun
layoutDependsOn
(
parent
:
CoordinatorLayout
,
child
:
V
,
dependency
:
View
)
=
super
.
layoutDependsOn
(
parent
,
child
,
dependency
)
or
(
dependency
is
Snackbar
.
SnackbarLayout
)
super
.
layoutDependsOn
(
parent
,
child
,
dependency
)
or
(
dependency
is
Snackbar
.
SnackbarLayout
)
override
fun
onLayoutChild
(
parent
:
CoordinatorLayout
,
child
:
V
,
layoutDirection
:
Int
):
Boolean
{
isLaidOut
=
true
return
super
.
onLayoutChild
(
parent
,
child
,
layoutDirection
)
}
override
fun
onDependentViewChanged
(
override
fun
onDependentViewChanged
(
parent
:
CoordinatorLayout
,
parent
:
CoordinatorLayout
,
child
:
V
,
child
:
V
,
...
@@ -92,8 +99,15 @@ class HideBottomViewOnScrollBehavior<V : View> : HideBottomViewOnScrollBehavior<
...
@@ -92,8 +99,15 @@ class HideBottomViewOnScrollBehavior<V : View> : HideBottomViewOnScrollBehavior<
}
}
if
(
hide
)
{
if
(
hide
)
{
slideDown
(
view
)
// view is not laid out and drawn yet properly, so animation will not be attached
// hence we just simply hide the view
if
(!
isLaidOut
)
{
view
.
isGone
=
true
}
else
{
slideDown
(
view
)
}
}
else
{
}
else
{
view
.
isVisible
=
true
slideUp
(
view
)
slideUp
(
view
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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