diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-05-03 20:09:27 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-05-03 20:09:27 -0400 |
commit | c4e1aa78bc868d2ee8c8fc01bf7224b98f5524dd (patch) | |
tree | 2530e6be1904aafd137c274a8bb2d00c7d4d4805 | |
parent | 1ee77c02826ebf8d1bdeb49cb0c2f9d199ebd679 (diff) |
Removed the Activity we don't really need and edited Minak.java
-rw-r--r-- | src/us/minak/Minak.java | 18 | ||||
-rw-r--r-- | src/us/minak/SketchpadActivity.java | 12 | ||||
-rw-r--r-- | src/us/minak/SketchpadView.java | 12 |
3 files changed, 12 insertions, 30 deletions
diff --git a/src/us/minak/Minak.java b/src/us/minak/Minak.java index e0f6787..30f7989 100644 --- a/src/us/minak/Minak.java +++ b/src/us/minak/Minak.java @@ -7,8 +7,8 @@ import android.view.inputmethod.EditorInfo; public class Minak extends InputMethodService { - private MinakView minview; - + private MinakView minakView; + @Override public void onStartInput(EditorInfo attribute, boolean restart) { if (minview != null) { @@ -19,14 +19,20 @@ public class Minak extends InputMethodService { } } } - + @Override public View onCreateInputView() { final MinakView mv = getLayoutInflater().inflate(R.layout.minak, null); - + // TODO set Listeners here - - minview = mv; + mv.setOnCharacterEnteredListener(new OnCharacterEnteredListener()) { + @Override + public void characterEntered(String character) { + getCurrentInputConnection().commitText(character, 1); + } + } + + minakView = mv; return mv; } } diff --git a/src/us/minak/SketchpadActivity.java b/src/us/minak/SketchpadActivity.java deleted file mode 100644 index c1479d0..0000000 --- a/src/us/minak/SketchpadActivity.java +++ /dev/null @@ -1,12 +0,0 @@ -package us.minak; - -public class SketchpadActivity { - public static final String INTENT_ACTION = "us.minak.SYMBOL_ENTERED"; - public static final String INTENT_EXTRA_NAME = "symbol"; - private static final Character[] SYMBOLS = new Character[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', - '@', '#', '$', '%', '^', '&', '*', '(', ')', '`', '-', '=', '~', '_', '+', '[', ']', '\\', '{', '}', '|', - ';', '\'', ':', '\'', ',', '.', '/', '<', '>', '?' }; - - - -}
\ No newline at end of file diff --git a/src/us/minak/SketchpadView.java b/src/us/minak/SketchpadView.java index 26cc19c..bbfd471 100644 --- a/src/us/minak/SketchpadView.java +++ b/src/us/minak/SketchpadView.java @@ -9,11 +9,8 @@ import android.gesture.Prediction; import android.util.AttributeSet; public class SketchpadView extends GestureOverlayView implements OnGesturePerformedListener{ - //Setting score thresh hold private static final double score_threshold = 3.0; - //loads gesture library private final GestureLibrary gestureLib; - //used to capture drawn gestures private onGestureRecognizedListener gestureRecognizer; public SketchpadView (Context context, AttributeSet attrs){ @@ -29,24 +26,15 @@ public class SketchpadView extends GestureOverlayView implements OnGesturePerfor @Override public void onGesturePerformed(GestureOverlayView view, Gesture gesture){ - //create list of predicted characters to be entered List<Prediction> predictions = gestureLib.recognize(gesture); Prediction bestPrediction = null; - //if we have a prediction if(!predictions.isEmpty()){ - //I believe that this just blidnly adds a predicted character without any checks - //we need to see if there is a way to actual get the best prediction - //if this lists them based on the best, then fuck me and ignore this/delete this bestPrediction = predictions.get(0); } - //if we have a gesture and a decent prediction if(gestureRecognizer != null && bestPrediction != null){ - //if the prediction is good enough if(bestPrediction.score > score_threshold){ - //we recognize it gestureRecognizer.gestureRecognized(bestPrediction.name); }else{ - //why? clear(false); } } |