• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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[
59This sample detects gestures on a view and logs them. In order to try this
60sample out, try dragging or tapping the text.
61]]>
62        </description>
63        <intro>
64<![CDATA[
65In 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
68In this example, the steps followed to set up the gesture detector are:
691. Create the GestureListener that includes all your callbacks.
702. Create the GestureDetector ([SimpleOnGestureListener][1]) that will take the listener as an argument.
713. For the view where the gestures will occur, create an [onTouchListener][3]
72that 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>
80</sample>
81