From 1a95ab399441cdf3e67d357df43f1ae1c3616ddd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 3 May 2014 22:47:09 -0400 Subject: initial commit --- .classpath | 9 ++++ .gitignore | 2 + .project | 33 ++++++++++++++ AndroidManifest.xml | 37 ++++++++++++++++ libs/android-support-v4.jar | Bin 0 -> 627582 bytes proguard-project.txt | 20 +++++++++ project.properties | 14 ++++++ res/drawable-hdpi/ic_launcher.png | Bin 0 -> 9397 bytes res/drawable-mdpi/ic_launcher.png | Bin 0 -> 5237 bytes res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 14383 bytes res/layout/ime.xml | 20 +++++++++ res/raw/gestures | Bin 0 -> 93080 bytes res/values-v11/styles.xml | 11 +++++ res/values-v14/styles.xml | 12 ++++++ res/values/strings.xml | 7 +++ res/values/styles.xml | 20 +++++++++ res/xml/method.xml | 2 + src/us/minak/DrawingSpaceView.java | 60 ++++++++++++++++++++++++++ src/us/minak/IMEService.java | 33 ++++++++++++++ src/us/minak/IMEView.java | 11 +++++ src/us/minak/OnGestureRecognizedListener.java | 26 +++++++++++ 21 files changed, 317 insertions(+) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 AndroidManifest.xml create mode 100644 libs/android-support-v4.jar create mode 100644 proguard-project.txt create mode 100644 project.properties create mode 100644 res/drawable-hdpi/ic_launcher.png create mode 100644 res/drawable-mdpi/ic_launcher.png create mode 100644 res/drawable-xhdpi/ic_launcher.png create mode 100644 res/layout/ime.xml create mode 100644 res/raw/gestures create mode 100644 res/values-v11/styles.xml create mode 100644 res/values-v14/styles.xml create mode 100644 res/values/strings.xml create mode 100644 res/values/styles.xml create mode 100644 res/xml/method.xml create mode 100644 src/us/minak/DrawingSpaceView.java create mode 100644 src/us/minak/IMEService.java create mode 100644 src/us/minak/IMEView.java create mode 100644 src/us/minak/OnGestureRecognizedListener.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..7bc01d9 --- /dev/null +++ b/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a22392a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/bin +/gen diff --git a/.project b/.project new file mode 100644 index 0000000..ef25403 --- /dev/null +++ b/.project @@ -0,0 +1,33 @@ + + + Minak + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..b061ef0 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar new file mode 100644 index 0000000..a7e9919 Binary files /dev/null and b/libs/android-support-v4.jar differ diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..4ab1256 --- /dev/null +++ b/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/res/drawable-hdpi/ic_launcher.png differ diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/res/drawable-mdpi/ic_launcher.png differ diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/res/drawable-xhdpi/ic_launcher.png differ diff --git a/res/layout/ime.xml b/res/layout/ime.xml new file mode 100644 index 0000000..510d40a --- /dev/null +++ b/res/layout/ime.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/res/raw/gestures b/res/raw/gestures new file mode 100644 index 0000000..3cc9d7c Binary files /dev/null and b/res/raw/gestures differ diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..2485e35 --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,7 @@ + + + Minak + Minak IME Label + Minak Settings Label + + diff --git a/res/values/styles.xml b/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/res/xml/method.xml b/res/xml/method.xml new file mode 100644 index 0000000..b8d98ff --- /dev/null +++ b/res/xml/method.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/us/minak/DrawingSpaceView.java b/src/us/minak/DrawingSpaceView.java new file mode 100644 index 0000000..7f9c3fa --- /dev/null +++ b/src/us/minak/DrawingSpaceView.java @@ -0,0 +1,60 @@ +/* + ******************************************************************************** + * Copyright (c) 2012 Samsung Electronics, Inc. + * All rights reserved. + * + * This software is a confidential and proprietary information of Samsung + * Electronics, Inc. ("Confidential Information"). You shall not disclose such + * Confidential Information and shall use it only in accordance with the terms + * of the license agreement you entered into with Samsung Electronics. + ******************************************************************************** + */ + +package us.minak; + +import java.util.List; + +import android.content.Context; +import android.gesture.Gesture; +import android.gesture.GestureLibraries; +import android.gesture.GestureLibrary; +import android.gesture.GestureOverlayView; +import android.gesture.GestureOverlayView.OnGesturePerformedListener; +import android.gesture.Prediction; +import android.util.AttributeSet; + +/** + * Represent a space where drawing gestures are performed. + */ +public class DrawingSpaceView extends GestureOverlayView implements OnGesturePerformedListener { + private static final double SCORE_TRESHOLD = 3.0; + private final GestureLibrary mGestureLibrary; + private OnGestureRecognizedListener mOnGestureRecognizedListener; + + public DrawingSpaceView(Context context, AttributeSet attrs) { + super(context, attrs); + mGestureLibrary = GestureLibraries.fromRawResource(context, R.raw.gestures); + mGestureLibrary.load(); + addOnGesturePerformedListener(this); + } + + public void setOnGestureRecognizedListener(OnGestureRecognizedListener onGestureRecognizedListener) { + mOnGestureRecognizedListener = onGestureRecognizedListener; + } + + @Override + public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { + final List predictions = mGestureLibrary.recognize(gesture); + Prediction bestPrediction = null; + if (!predictions.isEmpty()) { + bestPrediction = predictions.get(0); + } + if (mOnGestureRecognizedListener != null && bestPrediction != null) { + if (bestPrediction.score > SCORE_TRESHOLD) { + mOnGestureRecognizedListener.gestureRecognized(bestPrediction.name); + } else { + clear(false); + } + } + } +} diff --git a/src/us/minak/IMEService.java b/src/us/minak/IMEService.java new file mode 100644 index 0000000..ba09656 --- /dev/null +++ b/src/us/minak/IMEService.java @@ -0,0 +1,33 @@ +package us.minak; + +import android.inputmethodservice.InputMethodService; +import android.view.View; +import android.view.inputmethod.EditorInfo; + +public class IMEService extends InputMethodService { + private IMEView imeView; + /** + * Loads the configuration. + */ + @Override + public void onInitializeInterface() { + // TODO + } + + @Override + public View onCreateInputView() { + final IMEView view = (IMEView) getLayoutInflater().inflate(R.layout.ime, null); + + // TODO: there probably needs to be more stuff here + + this.imeView = view; + return view; + } + + /** + * Called to inform the input method that text input has started in an editor. + */ + public void onStartInput(EditorInfo info, boolean restarting) { + // TODO: get characters from this.imeView, and pass them to getCurrentInputConnection().commitText(..., 1); + } +} diff --git a/src/us/minak/IMEView.java b/src/us/minak/IMEView.java new file mode 100644 index 0000000..89d6d0a --- /dev/null +++ b/src/us/minak/IMEView.java @@ -0,0 +1,11 @@ +package us.minak; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.RelativeLayout; + +public class IMEView extends RelativeLayout{ + public IMEView(Context context, AttributeSet attrs) { + super(context, attrs); + } +} diff --git a/src/us/minak/OnGestureRecognizedListener.java b/src/us/minak/OnGestureRecognizedListener.java new file mode 100644 index 0000000..a30e8b8 --- /dev/null +++ b/src/us/minak/OnGestureRecognizedListener.java @@ -0,0 +1,26 @@ +/* + ******************************************************************************** + * Copyright (c) 2012 Samsung Electronics, Inc. + * All rights reserved. + * + * This software is a confidential and proprietary information of Samsung + * Electronics, Inc. ("Confidential Information"). You shall not disclose such + * Confidential Information and shall use it only in accordance with the terms + * of the license agreement you entered into with Samsung Electronics. + ******************************************************************************** + */ + +package us.minak; + +/** + * A simple interface for handling recognizing a gesture. + */ +public interface OnGestureRecognizedListener { + /** + * Invoked when a gesture is recognized. + * + * @param character + * The character represented by the gesture. + */ + void gestureRecognized(String character); +} -- cgit v1.2.3-54-g00ecf