diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-05-06 22:04:43 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-05-06 22:04:43 -0400 |
commit | 2439ddcbfff697f95546583240e358c270226adc (patch) | |
tree | 7e8a794fa78ab82ba21c8c08f9a0366b9c4191a4 | |
parent | ec076ef7f4084f64c955527619551579217cb902 (diff) |
Revert "Andrew wants this"
This reverts commit ad4b6b21bb90cb774d95e2040642c5c444c11810.
Conflicts:
src/us/minak/IMEView.java
-rw-r--r-- | src/us/minak/IMEView.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/us/minak/IMEView.java b/src/us/minak/IMEView.java index 724d69d..7cdf4fd 100644 --- a/src/us/minak/IMEView.java +++ b/src/us/minak/IMEView.java @@ -13,11 +13,14 @@ 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; @@ -32,6 +35,27 @@ public class IMEView extends RelativeLayout { 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 }; @@ -61,6 +85,11 @@ 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) { @@ -119,6 +148,13 @@ 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). */ @@ -148,6 +184,7 @@ 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); |