diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-05-06 21:44:44 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-05-06 21:44:44 -0400 |
commit | ad4b6b21bb90cb774d95e2040642c5c444c11810 (patch) | |
tree | bea78a43dc35f214139e543726555cc1feed114a | |
parent | 43571cef6ca00ab5a9b6164c8310fe76044277b6 (diff) |
Andrew wants this
-rw-r--r-- | src/us/minak/IMEGestureOverlayView.java | 27 | ||||
-rw-r--r-- | src/us/minak/IMEView.java | 38 | ||||
-rw-r--r-- | src/us/minak/MetaCircle.java | 29 | ||||
-rw-r--r-- | src/us/minak/MetaExpression.java | 24 |
4 files changed, 16 insertions, 102 deletions
diff --git a/src/us/minak/IMEGestureOverlayView.java b/src/us/minak/IMEGestureOverlayView.java index 011df3e..1a88cd6 100644 --- a/src/us/minak/IMEGestureOverlayView.java +++ b/src/us/minak/IMEGestureOverlayView.java @@ -12,7 +12,6 @@ package us.minak; -import java.util.LinkedList; import java.util.List; import android.content.Context; @@ -22,6 +21,8 @@ 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; /** @@ -31,7 +32,6 @@ 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); @@ -56,19 +56,22 @@ public class IMEGestureOverlayView extends GestureOverlayView implements OnGestu mOnGestureRecognizedListener.putString(bestPrediction.name); } else { clear(false); - drawCircles((MetaCircle[]) this.circles.toArray()); } } } - + private final Paint mPaintRed = new Paint(); + private final Paint mPaintBlue = new Paint(); public void onDraw(Canvas canvas) { - canvas.getHeight(); - } - - public void drawCircles (MetaCircle[] circles) { - for (MetaCircle circle : circles) { - //draw circle - ; - } + 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); } } diff --git a/src/us/minak/IMEView.java b/src/us/minak/IMEView.java index 8bf1967..b7b136b 100644 --- a/src/us/minak/IMEView.java +++ b/src/us/minak/IMEView.java @@ -13,14 +13,11 @@ package us.minak; import java.util.LinkedList; -import java.util.List; import java.util.Locale; import java.util.Queue; import android.content.Context; -import android.graphics.Color; import android.util.AttributeSet; -import android.view.MotionEvent; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; @@ -34,27 +31,7 @@ public class IMEView extends RelativeLayout { private Button mShiftButton; private ShiftState mShiftState = ShiftState.OFF; private final Queue<Character> mSymbolsQueue = new LinkedList<Character>(); - private float x; - private float y; - private boolean ongoingGesture = false; - - public boolean setTouchLocation(float x, float y) { - if (!ongoingGesture) { - this.x = x; - this.y = y; - return true; - } - return false; - } - - public void setState(boolean state) { - ongoingGesture = state; - } - - public boolean getState() { - return ongoingGesture; - } - + private enum ShiftState { OFF, ON, CAPS_LOCK }; @@ -84,11 +61,6 @@ public class IMEView extends RelativeLayout { final Button spaceButton = (Button) findViewById(R.id.space_btn); spaceButton.setOnClickListener(mButtonClickListener); spaceButton.setOnLongClickListener(mButtonLongClickListener); - - //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))); } public void setOnCharacterEnteredListener(StringReciever onCharacterEnteredListener) { @@ -147,13 +119,6 @@ public class IMEView extends RelativeLayout { } }; - private final OnTouchListener mOnTouchListener = new OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - return setTouchLocation(event.getX(), event.getY()); - } - }; - /** * Changes shift state to the next one (OFF -> ON -> CAPS LOCK). */ @@ -183,7 +148,6 @@ public class IMEView extends RelativeLayout { * The character to enter */ private void enterCharacter(String character) { - //for each circle in circles check to see if the touch was in the circle and apply the meta-key switch (mShiftState) { case OFF: mOnCharacterEnteredListener.putString(character); diff --git a/src/us/minak/MetaCircle.java b/src/us/minak/MetaCircle.java deleted file mode 100644 index 908842a..0000000 --- a/src/us/minak/MetaCircle.java +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100644 index 4398c42..0000000 --- a/src/us/minak/MetaExpression.java +++ /dev/null @@ -1,24 +0,0 @@ -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; - } -} |