-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#229 Reflect swipe velocity in swipe animation
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
cardstackview/src/main/java/com/yuyakaido/android/cardstackview/Duration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.yuyakaido.android.cardstackview; | ||
|
||
public enum Duration { | ||
Fast(50), | ||
Normal(200), | ||
Slow(400); | ||
|
||
public final int duration; | ||
|
||
Duration(int duration) { | ||
this.duration = duration; | ||
} | ||
|
||
public static Duration fromVelocity(int velocity) { | ||
if (velocity < 1000) { | ||
return Slow; | ||
} else if (velocity < 5000) { | ||
return Normal; | ||
} | ||
return Fast; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters