# Rotatable **Repository Path**: agonimaple/Rotatable ## Basic Information - **Project Name**: Rotatable - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-22 - **Last Updated**: 2021-11-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Rotatable ========= This is a helper class actually, it simplifies having a view as rotatable by setting touch events and handling a lot of boilerplate works! So if you need a component that needs to be able to rotate by touch, you do not have to deal with all these stuff. Sample Video ============ [![Rotatable Sample Video](http://yayandroid.com/data/github_library/rotatable/rotatable.gif)](https://www.youtube.com/watch?v=Gkd9QpAZmU8) # Usage You can apply this rotatable class to any view in your xml, just need to pass the required view into Rotatable builder and configure up to your needs. ```java Rotatable rotatable = new Rotatable.Builder(findViewById(R.id.targetView)) .sides(R.id.frontView, R.id.backView) .direction(Rotatable.ROTATE_X) .listener(rotationListener) .rotationCount(floatValue) .rotataionDistance(floatValue) .pivotX(intValue) .pivotY(intValue) .build(); ``` **Rotatable.Builder** ```java sides(int frontViewResId, int backViewResId) ``` ```java rotationCount(float count) ``` ```java rotataionDistance(float distance) ``` ```java pivotX(int pivotXValue) pivotY(int pivotYValue) // or pivot(int pivotXValue, int pivotYValue) ``` **Rotatable Object** We have built into Rotatable object, but why do we need that? Rotatable object has some useful methods that you may need to change some of configurations or notify rotatable on configuration changes. Such as: ```java rotatable.rotate(int direction, float degree, int duration, Animator.AnimatorListener listener) ``` ```java rotatable.setTouchEnable(boolean enable) rotatable.isTouchEnable() ``` ```java rotatable.setDirection(int direction) ``` ```java rotatable.orientationChanged(int newOrientation) ``` ```java rotatable.drop() ``` ```java rotatable.takeAttention() ``` ## Download Add library dependency to your `build.gradle` file: ```groovy dependencies { compile 'com.yayandroid:Rotatable:1.1.2' } ``` ## License ``` The MIT License (MIT) Copyright (c) 2015 yayandroid Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` [1]: http://stackoverflow.com/a/7366101/1171484