Gesture Library for the Android Platform (Supports API 14+)
HacerGestoV3 is a gesture library for the Android Platform This library comes with a comprehensive demo app complete with source code to help developers get a head start. Though the library is protected by an open source licence, the code for the demo app is free source. You can download the Demo app directly from the Google Play Store: https://play.google.com/store/apps/details?id=com.WarwickWestonWright.HacerGestoV3Demo&hl=en_GB
You can view the demo of the library here: https://youtu.be/hCLdoOShkpw
You can make a donation the HG Widgets for Android here: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DWT2TT7X83PE8
This Gesture Library allows for the simultaneous use of 4 Gestures: Rotate, Pinch/Scale Move and Fling.
Each Gesture has numerous configurable behaviours.
Developer Note: The last update could break your code The last update changed the way the touchpoint return the values in the callback. The origin is now the center (was upper left). This change was for consistency as all texture positions are center centric.
Rotate The Rotate behaviour is based upon the HGDial libraries and has the following behaviours:
- The ability to record the direction of rotation.
- Allows precision rotation settings causing the dial to rotate at a different rate than the gesture (including the ability to rotate in the opposite direction of the gesture).
- It records the number of gesture rotations.
- It records the number of image rotations.
- It has a cumulative dial setting. When enabled the rotation will occur relative to the touch; and disabled the rotation will start from the point where the gesture starts.
- It has an advanced angle snap feature with an angle snap tolerance setting. The tolerance causes the dial to rotate freely until the snap tolerance is met.
- The dial can operate in single or dual finger mode.
- With this dial it is possible to set a minimum/maximum rotation constraint.
- It has a variable dial behaviour causing the rotation rate to change depending on how close the gesture is the centre of the dial.
- This gesture comes with a 'fling-to-spin' behaviour; having configurable fling tolerance, spin start/end speed and spin animation duration.
- A key feature is that the dial controls are designed to interact with each other and any other widgets/layouts that implement touch listeners.
- All of the above features play together in perfect harmony.
Scale The Scale Gesture has the following behaviours:
- Minimum and maximum scale constraint.
- Scale Snapping.
Move The Move gesture has the following:
- Cumulative Move (moves image relative to touch)
- Non Cumulative (position starts from the position of the touch)
- Move Snapping: Can set multiple snap points with snap distance tolerance.
- Move constraints. Set movement to constrain to left, top, right and bottom. Also sas dynamic constraints for edge and off edge of view.
Fling The Fling Gesture has the following behaviours:
- Fling off of edge or fling to edge.
- Fling to nearest corner.
- Fling to nearest edge.
Pan Zoom Mode:
Pan Zoom has the following behaviours:
- Calling a simple method will run the library in pan zoom mode.
- Minimum pan zoom scale setting: centre crop and best fit. This scaling also works with device rotation.
- Scales and constrains movement perfectly.
- Works with fling gesture.
All gestures and behavioural flags work together in any combination and each gesture can be turned on or off
All of the gestures can be used simultaneously and behave intuitively while doing so.
- Get 90 degree rotation working with pan zoom behaviour.
- Set touch zones callbacks for pan zome mode.
- Alter rotate snap flag to work when there is no free rotation between snaps
- Add snap flag to callback object for scale gesture.
- Write demo app demonstrating how to use the library as a gesture detector.
Improvements on Version 2
- It is now possible to use rotate, scale and move simultaneously.
- The move snapping now works with the fling behaviour.
- Now uses canvas; making it perfect for use as a custom control.
Slow spin on curve behaviour has been removed and replaced with a 'Slow Factor' behaviour. See Commit Note (https://bitbucket.org/warwick/hacergestov3/commits/1e6a25c10d876bdfe37e40c5483da597) for potential beaks in your code when updating an existing application that uses this library.
Only need a rotate/dial library? Try one of these.
LICENSE. This project is licensed with the 2-clause BSD license. The BSD 2-Clause License [OSI Approved License] The BSD 2-Clause License
In the original BSD license, both occurrences of the phrase "COPYRIGHT HOLDERS AND CONTRIBUTORS" in the disclaimer read "REGENTS AND CONTRIBUTORS".
Copyright (c) 2015, Warwick Weston Wright All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.