Click here to Skip to main content
13,256,123 members (50,515 online)
Click here to Skip to main content

Stats

29.3K views
437 downloads
31 bookmarked
Posted 14 Jan 2013

A Domain Specific Language for Android touch events: Part 1: Description and usage of the DSL

, 6 Dec 2013
A DSL for creating touch gestures in Android.
AndroidGestureDSL Version 1.1
AndroidGestureDSL
.classpath
.project
default.properties
proguard.cfg
res
drawable-hdpi
icon.png
drawable-ldpi
icon.png
drawable-mdpi
icon.png
layout
values
src
com
hfk
android
gestures
dsl
AndroidGestureDSLSample
.classpath
.project
default.properties
proguard.cfg
res
drawable-hdpi
icon.png
drawable-ldpi
icon.png
drawable-mdpi
icon.png
layout
values
src
com
hfk
android
sample
actions
conditions
gestures
package com.hfk.android.gestures.dsl;

import com.hfk.android.gestures.CheckNot;
import com.hfk.android.gestures.DoInvalidateGestureGestureAction;
import com.hfk.android.gestures.DoInvalidateRunningTimerAction;
import com.hfk.android.gestures.DoSignalGestureCompleted;
import com.hfk.android.gestures.IGestureAction;
import com.hfk.android.gestures.IGestureCondition;
import com.hfk.android.gestures.RelationType;
import com.hfk.android.gestures.TouchGesture;
import android.view.View;

public class GestureBuilder<V> {
	
	public GestureBuilder(V base)
	{
		this.base = base;
	}
	
	public NextGestureAfterCreate Create(TouchGesture gesture)
	{
		return new NextGestureAfterCreate(gesture);
	}
	
	public RangeTypeSelector within()
	{
		RangeTypeSelector result = new RangeTypeSelector(RelationType.Within /*(View)getBase()*/);
		return result;
	}
	
	public RangeTypeSelector exceed()
	{
		RangeTypeSelector result = new RangeTypeSelector(RelationType.Exceed /*(View)getBase()*/);
		return result;
	}
	
	public IGestureCondition not(IGestureCondition gestureCondition)
	{
		return new CheckNot(gestureCondition);
	}
	
	public IGestureAction nothing()
	{
		return null;
	}
	
	public TimerTimeConfiguration after()
	{
		return new TimerTimeConfiguration();
	}
	
	public DoInvalidateRunningTimerAction endCurrentTimer()
	{
		return new DoInvalidateRunningTimerAction();
	}
	
	public DoInvalidateGestureGestureAction invalidateGesture()
	{
		return new DoInvalidateGestureGestureAction();
	}
	
	public DoSignalGestureCompleted gestureIsCompleted()
	{
		return new DoSignalGestureCompleted();
	}
	
	public V getBase()
	{
		return base;
	}
	
	V base;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Serge Desmedt
Software Developer (Senior)
Belgium Belgium
No Biography provided

You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171114.1 | Last Updated 6 Dec 2013
Article Copyright 2013 by Serge Desmedt
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid