CS371m - Mobile Computing Gestures.

Slides:



Advertisements
Similar presentations
Introduction to XNA on Windows Phone 7 SILVERLIGHTSHOW.NET Webinar Peter Kuhn, June 30 th, 2011.
Advertisements

ANDROID – GESTURES L. Grewe. What and why  a great way to interact with applications on mobile devices.  With a touch screen, users can easily tap,
Dale Roberts GUI Programming using Java - Mouse Events Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Touch & Gestures.  MotionEvents  Touch Handling  Gestures.
Button click handlers Maarten Pennings. Introduction An activity has one or more views – view is also known as widget or control – examples include Button,
Android Application Development 2013 PClassic Chris Murphy 1.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
Android Apps: Look and Feel Module 6, Intro to I.T., Fall 2011 Sam Scott.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Introduction to Mobile Programming. Slide 2 Overview Fundamentally, it all works the same way You get the SDK for the device (Droid, Windows, Apple) You.
WiZiQ Tutorial for the Teacher During the class. After you launch the class, you will enter our virtual classroom.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
1 Mobile Computing Advanced Touching Copyright 2014 by Janson Industries Assg Part1Assg Part1 AssgPart2AssgPart2.
1 CSC111H Graphical User Interfaces (GUIs) Introduction GUIs in Java Understanding Events A Simple Application The Containment Hierarchy Layout Managers.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Event Driven Programming, The.
© by Pearson Education, Inc. All Rights Reserved. 1 Introduction to Android From “Android: How to Program” By Paul Deitel and Harvey Deitel.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Java GUI’s are event driven, meaning they generate events when the user interacts with the program. Typical events are moving the mouse, clicking a mouse.
Chapter 10: Applets and Advanced Graphics The Applet Class The Applet Class The HTML Tag The HTML Tag Passing Parameters to Applets Passing Parameters.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Mobile Programming Lecture 12 HierarchyViewer, Linkify, Gestures, and Version Control.
Object Oriented Programming.  Interface  Event Handling.
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Event Handling. User actions are called “events” – Low-level window events Window changes – Low-level component events Mouse events, Keyboard events,
Internet Explorer 10 IE9 hardware-accelerated platform CSS 2D Transforms CSS Backgrounds & Borders CSS Color CSS Fonts CSS Media Queries CSS Namespaces.
Lecture 18: Events; Cool Applets Yoni Fridman 7/30/01 7/30/01.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Events. Slide 2©SoftMoore Consulting Events Events are generated when a user interacts with the view objects of an application. Examples –button clicked–
Chapter 7 Touch Gestures. Figure 07.01: Common touch gestures for Android devices.
| Mobile Accessibility Development Making an Accessible App Usable Scott McCormack.
CHAPTER 7 TouchGestures. Chapter objectives: To code the detection of and response to touch gestures. Patterns of common touches to create touch gestures.
School of Engineering and Information and Communication Technology KIT305/KIT607 Mobile Application Development Android OS –Permissions (cont.), Fragments,
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
User Interaction Radan Ganchev Astea Solutions. Content Basic input events Gestures Drag and drop Sensors.
Building UI Components Димитър Н. Димитров Astea Solutions AD.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
CS371m - Mobile Computing Audio. Audio on Device Devices have multiple audio streams: – music, alarms, notifications, incoming call ringer, in call volume,
CS371m - Mobile Computing Gestures. Common Gestures 2.
Audio and Haptic Feedback
Events and Event Handling
Java FX: Scene Builder.
TUTORIAL ON MULTITOUCH AND SWIPE GESTURES
Appendix I GUI Components and Event Handling
AnDroid GoogleMaps API
Android Studio, Android System Basics and Git
Mobile Application Development BSCS-7 Lecture # 6
Technologies Overview Media files, such as the sounds, are placed in the app’s resource folder res/raw. When an Activity is shut down, its Fragment.
Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Sensors, maps and fragments:
ANDROID UI – FRAGMENTS UNIT II.
Mobile Computing With Android ACST 4550 Android Logs and Gestures
Introduction to Computing Using Java
GUI Programming using Java - Mouse Events
Cannon Game App Android How to Program
Android Topics Custom ArrayAdapters
Android Topics Custom ArrayAdapters Creating an Event Listener
Android Developer Fundamentals V2
Chapter 7: Touches and Swipes
Interactive Graphics in Android
Mobile Programming Gestures in Android.
Mobile Programming Dr. Mohsin Ali Memon.
Mobile Programming Dr. Mohsin Ali Memon.
Game Programming Algorithms and Techniques
Cosc 4730 An Introduction.
Creating a Simple Game in Scratch
CSC 221: Introduction to Programming Fall 2018
Preference Activity class
Presentation transcript:

CS371m - Mobile Computing Gestures

Common Gestures Or Scroll

Common Gestures http://developer.android.com/design/patterns/gestures.html

Common Gestures Fling or flick gesture: similar to swipe or drag scroll/swipe/drag user presses then moves finger in steady motion before lifting finger fling or flick user presses then moves finger in an accelerating motion before lifting

Dealing With Gestures To handle simple touch events create View.OnTouchListener for view Example from tic-tac-toe tutorial, screen press leads to player moving if it is their turn and they touch an open square

onTouchEvent passed a MotionEvent object with a large amount of data in tic tac toe tutorial you only use location of event (x and y)

MotionEvent Example of the astonishing amount of data packed into the motionEvent object

Other View Listeners View also has ability to listen for long clicks and drags In addition to View.OnTouchListener View.OnLongClickListener View.OnDragListener

Handling Common Gestures Instead of trying to decode gestures from the MotionEvent passed to the on touch method … Use the GestureDetector class Add a GestureDetector object to View override View.onTouchEvent method to pass MotionEvent on to the GestureDetector.onTouchEvent method

Handling Common Gestures create a GestureDetector.OnGestureListener (several gestures) or a GestureDetector.DoubleTapListener (more gestures) and register it with the GesturerDetector

GestureDetector.OnGestureListener

GestureDetector.DoubleTapListener

Clicker Question In Java, if a class implements an interface, how many methods declared in the interface does the class have to implement? All of them Some of them None of them It depends

Adapter Classes OOP Pattern Create a class that implements methods of interface with minimal (or no) functionality Standard Java Example Interfaces for MouseListener(5), MouseWheelListener(1), and MouseMotionListener(3) MouseAdapter class implements all three interfaces with empty methods extend MouseAdapter and add functionality for events you care about.

GestureDetector.SimpleOnGestureListener Implements all methods of GestureDetector.OnGestureListener and GestureDetector.DoubleTapListener Does nothing but return false for all the methods Extend this class and add more meaningful behavior

Simple Gesture Demo App that listens for simple gestures update lower TextView in call back methods

Gesture Demo

Gesture Demo Simply pass event on to the GestureDetectorCompat object it will call back methods

Callback Methods for OnGestureListener

Callback Methods for OnGestureListener

Callback Methods for DoubleTapListener

Multi Touch Gestures Multiple fingers (pointers) touch screen at same time Still handled via MotionEvents each pointer (finger) has a MotionEvent track via index (in array of MotionEvents) or ID MotionEvent object sent to onTouch contains number of "pointers" involved

Displaying Multitouch data static methods from MotionEventCompat class

Scale Gestures ScaleGestureDetector class from Api level 8 (API 2.2) pinch to zoom in or out out -> scale up in -> scale down

Scale Gestures Create class that implements ScaleGestureDetector.OnScaleGestureListener OR create class that extends ScaleGestureDetector.SimpleOnScaleGestureListener adapter class implements methods from OnScaleGestureListener with dummy methods override only the methods you care about Create a ScaleGestureDetector with listener pass Motion events from onTouch

Scaling Example listener updates overall scale factor shows current scale factor in TextView

Scale Example

Drag Gestures Similar to handling Scale gestures Implement View.OnDragListener one method, onDrag(View v, DragEvent de) Drag event phases: start continuing dropped ended

Complex gestures

Complex Gestures Non standard gestures require lots of code to recognize Android 1.6 introduced new APIs to store, load, draw, and recognize gestures Gesture Builder app on emulator emulator must include virtual SD card allows creating set of gestures for your application limited success with jelly bean emulators App on class GitHub repo

Complex Gestures Each gesture associated with name Limited to single pointer multiple gestures can have same name variations on same gesture, better chance of recognizing Move gestures from emulator to application res/raw folder

Gesture Data File DDMS file explorer

Complex Gestures Recognizing gestures via a GestureOverlayView simple drawing board on top of view that shows and records user gestures When gesture complete GestureLibrary queried to see if gesture is recognized Predictions of entered gesture and those in the library

Animal Sounds App

Predictions

onCreate

Listener