diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-05-06 20:19:32 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-05-06 20:19:32 -0400 |
commit | 4f56606fbb9fea8d163340bd71cf3d2568e924cb (patch) | |
tree | 21fd6d8e5fe9543b27f70ba0b5591f9e88751c39 /src/us | |
parent | 3e9dc6d6711e80dfd06409428b465fad720faf50 (diff) |
Basic Cirle Implementation Update of Doom.
Diffstat (limited to 'src/us')
-rw-r--r-- | src/us/minak/IMEGestureOverlayView.java | 10 | ||||
-rw-r--r-- | src/us/minak/IMEView.java | 14 | ||||
-rw-r--r-- | src/us/minak/MetaCircle.java | 18 | ||||
-rw-r--r-- | src/us/minak/MetaExpression.java | 9 | ||||
-rw-r--r-- | src/us/minak/SettingsActivity.java | 3 |
5 files changed, 38 insertions, 16 deletions
diff --git a/src/us/minak/IMEGestureOverlayView.java b/src/us/minak/IMEGestureOverlayView.java index d856669..67d1798 100644 --- a/src/us/minak/IMEGestureOverlayView.java +++ b/src/us/minak/IMEGestureOverlayView.java @@ -12,6 +12,7 @@ package us.minak; +import java.util.LinkedList; import java.util.List; import android.content.Context; @@ -29,6 +30,7 @@ public class IMEGestureOverlayView extends GestureOverlayView implements OnGestu private static final double SCORE_TRESHOLD = 3.0; private final GestureLibrary mGestureLibrary; private StringReciever mOnGestureRecognizedListener; + public List<MetaCircle> circles = new LinkedList<MetaCircle>(); public IMEGestureOverlayView(Context context, AttributeSet attrs) { super(context, attrs); @@ -53,7 +55,15 @@ public class IMEGestureOverlayView extends GestureOverlayView implements OnGestu mOnGestureRecognizedListener.putString(bestPrediction.name); } else { clear(false); + drawCircles((MetaCircle[]) this.circles.toArray()); } } } + + public void drawCircles (MetaCircle[] circles) { + for (MetaCircle circle : circles) { + //draw circle + ; + } + } } diff --git a/src/us/minak/IMEView.java b/src/us/minak/IMEView.java index 258d88d..42ac322 100644 --- a/src/us/minak/IMEView.java +++ b/src/us/minak/IMEView.java @@ -18,18 +18,13 @@ import java.util.Locale; import java.util.Queue; import android.content.Context; -import android.gesture.Gesture; -import android.gesture.GestureLibrary; -import android.gesture.GestureOverlayView; -import android.gesture.Prediction; -import android.gesture.GestureOverlayView.OnGesturePerformedListener; +import android.graphics.Color; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; - /** * Represents the container for the drawing space and the two side panels. */ @@ -43,8 +38,6 @@ public class IMEView extends RelativeLayout { private float y; private boolean ongoingGesture = false; - public List<MetaCircle> circles = new LinkedList<MetaCircle>(); - public boolean setTouchLocation(float x, float y) { if (!ongoingGesture) { this.x = x; @@ -92,7 +85,10 @@ public class IMEView extends RelativeLayout { spaceButton.setOnClickListener(mButtonClickListener); spaceButton.setOnLongClickListener(mButtonLongClickListener); - //dynamic MetaCircle adding stuff here. + //dynamic MetaCircle adding stuff here. replace null with Shift or Ctrl or Meta or Alt or Hyper or whatever. + drawingSpaceView.circles.add(new MetaCircle((float)50.0, (float)50.0, (float)20.0, Color.RED, new MetaExpression(null))); + drawingSpaceView.circles.add(new MetaCircle((float)70.0, (float)70.0, (float)20.0, Color.RED, new MetaExpression(null))); + drawingSpaceView.circles.add(new MetaCircle((float)50.0, (float)30.0, (float)20.0, Color.RED, new MetaExpression(null))); // } diff --git a/src/us/minak/MetaCircle.java b/src/us/minak/MetaCircle.java index 8741e20..9023671 100644 --- a/src/us/minak/MetaCircle.java +++ b/src/us/minak/MetaCircle.java @@ -8,10 +8,20 @@ import android.graphics.Color; */ public class MetaCircle { public MetaExpression metaExpr; - public int x; - public int y; - public int radius; - public Color color; + public float x; + public float y; + public float radius; + public int color; public boolean expanded; public int expansion; //the level of expansion (if multiple circles are expanded, this decides precidence) + + MetaCircle(float x, float y, float radius, int color, MetaExpression metaExpr) { + this.metaExpr = metaExpr; + this.x = x; + this.y = y; + this.radius = radius; + this.color = color; + this.expanded = false; + this.expansion = 0; + } } diff --git a/src/us/minak/MetaExpression.java b/src/us/minak/MetaExpression.java index 82a9aa3..4398c42 100644 --- a/src/us/minak/MetaExpression.java +++ b/src/us/minak/MetaExpression.java @@ -1,17 +1,24 @@ package us.minak; public class MetaExpression { - public enum state { + public enum State { ON, OFF, LOCK } + public State state; private String value; public String getValue() { + //however we want to do return this return this.value; } public void setValue(String value) { this.value = value; } + + MetaExpression(String value) { + this.value = value; + this.state = State.OFF; + } } diff --git a/src/us/minak/SettingsActivity.java b/src/us/minak/SettingsActivity.java index a3dea5c..66b85da 100644 --- a/src/us/minak/SettingsActivity.java +++ b/src/us/minak/SettingsActivity.java @@ -222,8 +222,7 @@ public class SettingsActivity extends ListActivity { break; for (Gesture gesture : store.getGestures(name)) { - final Bitmap bitmap = gesture.toBitmap(mThumbnailSize, - mThumbnailSize, mThumbnailInset, mPathColor); + final Bitmap bitmap = gesture.toBitmap(mThumbnailSize, mThumbnailSize, mThumbnailInset, mPathColor); final NamedGesture namedGesture = new NamedGesture(); namedGesture.gesture = gesture; namedGesture.name = name; |