Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JuniperPhoton/FlipperView
Android version of FlipperControl for UWP (https://github.com/JuniperPhoton/FlipperControl)
https://github.com/JuniperPhoton/FlipperView
android flip layout
Last synced: 22 days ago
JSON representation
Android version of FlipperControl for UWP (https://github.com/JuniperPhoton/FlipperControl)
- Host: GitHub
- URL: https://github.com/JuniperPhoton/FlipperView
- Owner: JuniperPhoton
- Created: 2017-01-08T17:13:34.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-31T13:46:52.000Z (over 3 years ago)
- Last Synced: 2024-08-04T00:07:09.681Z (4 months ago)
- Topics: android, flip, layout
- Language: Kotlin
- Homepage:
- Size: 149 KB
- Stars: 92
- Watchers: 2
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - FlipperView - 使用翻转过渡改变不同状态 (其他)
README
# FlipperView
Android version of [FlipperControl for UWP](https://github.com/JuniperPhoton/FlipperControl) . Now it's written in Kotlin.A control that uses flip transition to change different states.
Works on API 19, but with more tests I think it works well on API 16.![](https://github.com/JuniperPhoton/FlipperControl/blob/master/demo.gif)
## How to use
FlipperView extends from `FrameLayout` so you can use it as a `FrameLayout` but it only displays one child at a time and you can call `next()` to switch to another child. Please don't put views that do **heavy** work.
It has a sample proj to demonstrate how to use it.
There are a few attrs that control the behavior:
## defaultIndex:int
Default display index of view. Note that the value of zero points to the first view you declare in XML.## flipDirection:int
FlipDirection.XML : `backToFront` or `frontToBack`
CODE: `FLIP_DIRECTION_BACK_TO_FRONT` or `FLIP_DIRECTION_FRONT_TO_BACK`
## flipAxis:int
XML : `X` or `Y`
CODE: `AXIS_X` or `AXIS_Y`
## duration:int
Animation duration in millis. The default value is 200 which I think it's fast enough.## tapToFlip:boolean
Enable tap to flip or not. Default value is false.## Switch views
Current there are **4** ways to switch views:
#### fun next()
Segue to next view. If it's the end of the views, then segue to the first one.
#### fun previous()
Segue to the previous view. If it's the head of the views, then segue to the last one.
### fun next(Int, Boolean, ViewAction, ViewAction?)
Segue to the specified one with/without animation, and custom the action that will be applied on the current display view on **Exit animation** end and run the action after the **Enter animation**.
To understand the running time on both actions, please refer to the **advance** topic.
Note that both `ViewAction` has default value for Kotlin.
Please be aware of *IndexOutOfBoundsException*.
### fun refreshCurrent(ViewAction)
Perform the flip animation and run the custom action on exit animation end.
## Advance
The flipping animation contains two parts:
1. Exit animation: the current display view rotates from 0 to 90 degrees
2. Enter animation: the next display view rotates from -90 to 0 degreesAt the end of both animations, you can perform your actions. See `fun next(Int, Boolean, ViewAction, ViewAction?)` method for details.
## Note for Android P user
Since the elevation shadow in Android P is NOT control by animation transformation, thus it will cause some weird issues on Android P devices.
Thus the FlipperLayout will disable elevation during animation and apply it back for you at the end of animation.