Trevor Johns | a6b4636 | 2013-10-30 16:38:01 -0700 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!-- |
| 3 | Copyright 2013 The Android Open Source Project |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | --> |
| 17 | <sample> |
| 18 | <name>BasicGestureDetect</name> |
| 19 | <group>Input</group> |
| 20 | <package>com.example.android.basicgesturedetect</package> |
| 21 | |
| 22 | |
| 23 | <!-- change minSdk if needed--> |
| 24 | <minSdk>18</minSdk> |
| 25 | |
| 26 | |
| 27 | <strings> |
| 28 | <intro> |
| 29 | <![CDATA[ |
| 30 | Welcome to Basic Gesture Detect! |
| 31 | In order to try this sample out, try dragging or tapping this text to see what happens! |
| 32 | ]]> |
| 33 | </intro> |
| 34 | <sample_action>Clear Text</sample_action> |
| 35 | </strings> |
| 36 | |
| 37 | <template src="base"/> |
| 38 | <template src="SingleView"/> |
| 39 | <common src="logger"/> |
| 40 | <common src="activities"/> |
| 41 | |
Jose Alcerreca | a07d394 | 2014-11-26 11:57:12 +0000 | [diff] [blame] | 42 | <metadata> |
| 43 | <status>PUBLISHED</status> |
| 44 | <categories>UI, Input</categories> |
| 45 | <technologies>Android</technologies> |
| 46 | <languages>Java</languages> |
| 47 | <solutions>Mobile</solutions> |
| 48 | <level>INTERMEDIATE</level> |
| 49 | <icon>screenshots/icon-web.png</icon> |
| 50 | <screenshots> |
| 51 | <img>screenshots/1-main.png</img> |
| 52 | </screenshots> |
| 53 | <api_refs> |
| 54 | <android>android.view.GestureDetector</android> |
| 55 | <android>android.view.MotionEvent</android> |
| 56 | </api_refs> |
| 57 | <description> |
| 58 | <![CDATA[ |
| 59 | This sample detects gestures on a view and logs them. In order to try this |
| 60 | sample out, try dragging or tapping the text. |
| 61 | ]]> |
| 62 | </description> |
| 63 | <intro> |
| 64 | <![CDATA[ |
| 65 | In this sample, the gestures are detected using a custom gesture listener that extends |
| 66 | [SimpleOnGestureListener][1] and writes the detected [MotionEvent][2] into the log. |
| 67 | |
| 68 | In this example, the steps followed to set up the gesture detector are: |
| 69 | 1. Create the GestureListener that includes all your callbacks. |
| 70 | 2. Create the GestureDetector ([SimpleOnGestureListener][1]) that will take the listener as an argument. |
| 71 | 3. For the view where the gestures will occur, create an [onTouchListener][3] |
| 72 | that sends all motion events to the gesture detector. |
| 73 | |
| 74 | [1]: http://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener.html |
| 75 | [2]: http://developer.android.com/reference/android/view/MotionEvent.html |
| 76 | [3]: http://developer.android.com/reference/android/view/View.OnTouchListener.html |
| 77 | ]]> |
| 78 | </intro> |
| 79 | </metadata> |
Trevor Johns | a6b4636 | 2013-10-30 16:38:01 -0700 | [diff] [blame] | 80 | </sample> |