summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/us/minak/IMEGestureOverlayView.java22
-rw-r--r--src/us/minak/MetaCircle.java29
-rw-r--r--src/us/minak/MetaExpression.java24
3 files changed, 61 insertions, 14 deletions
diff --git a/src/us/minak/IMEGestureOverlayView.java b/src/us/minak/IMEGestureOverlayView.java
index 1a88cd6..b167c53 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;
@@ -21,7 +22,6 @@ import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
@@ -32,6 +32,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);
@@ -59,19 +60,12 @@ public class IMEGestureOverlayView extends GestureOverlayView implements OnGestu
}
}
}
- private final Paint mPaintRed = new Paint();
- private final Paint mPaintBlue = new Paint();
+
public void onDraw(Canvas canvas) {
- mPaintRed.setColor(Color.RED);
- mPaintBlue.setColor(Color.BLUE);
- canvas.drawCircle(
- 0F/*(float)(canvas.getWidth()/2.0)*/,
- 0F/*(float)(canvas.getHeight()/2.0)*/,
- 10F,
- mPaintRed);
- canvas.drawLine(0, 0,
- canvas.getWidth(),
- canvas.getHeight(),
- mPaintBlue);
+ for (MetaCircle circle : circles) {
+ final Paint p = new Paint();
+ p.setColor(circle.color);
+ canvas.drawCircle(circle.x, circle.y, circle.radius, p);
+ }
}
}
diff --git a/src/us/minak/MetaCircle.java b/src/us/minak/MetaCircle.java
new file mode 100644
index 0000000..908842a
--- /dev/null
+++ b/src/us/minak/MetaCircle.java
@@ -0,0 +1,29 @@
+package us.minak;
+
+/*
+ * Not sure if this should be drawable or what.
+ *
+ */
+public class MetaCircle {
+ public MetaExpression metaExpr;
+ 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;
+ }
+
+ public boolean containsPoint(float x, float y) {
+ return Math.pow(x - this.x, 2) + Math.pow(y - this.y, 2) < Math.pow(this.radius, 2) ? true : false;
+ }
+}
diff --git a/src/us/minak/MetaExpression.java b/src/us/minak/MetaExpression.java
new file mode 100644
index 0000000..4398c42
--- /dev/null
+++ b/src/us/minak/MetaExpression.java
@@ -0,0 +1,24 @@
+package us.minak;
+
+public class MetaExpression {
+ 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;
+ }
+}