-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from yuyakaido/issue/229
Reflect swipe velocity in swipe animation
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 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(100), | ||
Normal(200), | ||
Slow(500); | ||
|
||
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
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
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