Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
f05761ac
Commit
f05761ac
authored
Jan 04, 2018
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine the animation of snackbar
parent
a33efea2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
mobile/build.gradle
mobile/build.gradle
+2
-2
mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt
.../java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt
+12
-9
No files found.
mobile/build.gradle
View file @
f05761ac
...
@@ -20,8 +20,8 @@ android {
...
@@ -20,8 +20,8 @@ android {
applicationId
"com.github.shadowsocks"
applicationId
"com.github.shadowsocks"
minSdkVersion
rootProject
.
minSdkVersion
minSdkVersion
rootProject
.
minSdkVersion
targetSdkVersion
rootProject
.
sdkVersion
targetSdkVersion
rootProject
.
sdkVersion
versionCode
20
3
versionCode
20
4
versionName
"4.4.
3
"
versionName
"4.4.
4
"
testApplicationId
"com.github.shadowsocks.test"
testApplicationId
"com.github.shadowsocks.test"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables
.
useSupportLibrary
true
vectorDrawables
.
useSupportLibrary
true
...
...
mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt
View file @
f05761ac
...
@@ -45,7 +45,9 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
...
@@ -45,7 +45,9 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
dependency
is
Snackbar
.
SnackbarLayout
dependency
is
Snackbar
.
SnackbarLayout
override
fun
onDependentViewChanged
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
):
Boolean
{
override
fun
onDependentViewChanged
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
):
Boolean
{
child
.
translationY
=
Math
.
min
(
0f
,
dependency
.
translationY
-
dependency
.
height
)
val
params
=
child
.
layoutParams
params
.
height
=
parent
.
height
-
dependency
.
height
child
.
layoutParams
=
params
return
true
return
true
}
}
...
@@ -55,22 +57,23 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
...
@@ -55,22 +57,23 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
override
fun
onDependentViewRemoved
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
{
override
fun
onDependentViewRemoved
(
parent
:
CoordinatorLayout
,
child
:
View
,
dependency
:
View
)
{
if
(!
isAccessibilityEnabled
(
parent
.
getContext
()))
{
if
(!
isAccessibilityEnabled
(
parent
.
getContext
()))
{
val
animator
=
ValueAnimator
()
val
animator
=
ValueAnimator
()
val
start
=
child
.
translationY
val
start
=
child
.
height
animator
.
set
FloatValues
(
start
,
0f
)
animator
.
set
IntValues
(
start
,
parent
.
height
)
animator
.
interpolator
=
SnackbarAnimation
.
FAST_OUT_SLOW_IN_INTERPOLATOR
animator
.
interpolator
=
SnackbarAnimation
.
FAST_OUT_SLOW_IN_INTERPOLATOR
animator
.
duration
=
SnackbarAnimation
.
ANIMATION_DURATION
animator
.
duration
=
SnackbarAnimation
.
ANIMATION_DURATION
animator
.
addUpdateListener
(
object
:
ValueAnimator
.
AnimatorUpdateListener
{
animator
.
addUpdateListener
(
object
:
ValueAnimator
.
AnimatorUpdateListener
{
private
var
previousValue
=
start
override
fun
onAnimationUpdate
(
animator
:
ValueAnimator
)
{
override
fun
onAnimationUpdate
(
animator
:
ValueAnimator
)
{
val
currentValue
=
animator
.
animatedValue
as
Float
val
currentValue
=
animator
.
animatedValue
as
Int
child
.
translationY
=
currentValue
val
params
=
child
.
layoutParams
previousValue
=
currentValue
params
.
height
=
currentValue
child
.
layoutParams
=
params
}
}
})
})
animator
.
start
()
animator
.
start
()
}
else
{
}
else
{
child
.
translationY
=
0f
val
params
=
child
.
layoutParams
params
.
height
=
parent
.
height
child
.
layoutParams
=
params
}
}
}
}
}
}
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