From 2439ddcbfff697f95546583240e358c270226adc Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Tue, 6 May 2014 22:04:43 -0400 Subject: Revert "Andrew wants this" This reverts commit ad4b6b21bb90cb774d95e2040642c5c444c11810. Conflicts: src/us/minak/IMEView.java --- src/us/minak/IMEView.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/us') 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 mSymbolsQueue = new LinkedList(); + 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); -- cgit v1.2.3-54-g00ecf