|
package com.hfk.android.gestures;
import android.view.View;
import com.hfk.android.ScreenVector;
public class CheckRelationMilliSecondsOfTimingIdCondition implements IGestureCondition /*extends GestureConditionBase<View>*/ {
public CheckRelationMilliSecondsOfTimingIdCondition(/*View view,*/ RelationType relationType, int rangeValue, String key) {
//super(view);
this.relationType = relationType;
this.range = rangeValue;
this.dataKey = key;
}
@Override
public boolean checkCondition(GestureEvent motion, TouchGesture gesture) {
Long actionOnTime = (Long)gesture.getContext(dataKey);
if(actionOnTime != null)
{
switch(relationType)
{
case Equal:
return (long)(motion.getTime() - actionOnTime.longValue()) == range;
case Within:
return (long)(motion.getTime() - actionOnTime.longValue()) <= range;
case Exceed:
return (long)(motion.getTime() - actionOnTime.longValue()) >= range;
}
}
return true;
}
private RelationType relationType;
private int range;
private String dataKey;
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.