summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/us/minak/IMEService.java10
-rw-r--r--src/us/minak/IMEView.java10
-rw-r--r--src/us/minak/SketchPadActivity.java39
3 files changed, 58 insertions, 1 deletions
diff --git a/src/us/minak/IMEService.java b/src/us/minak/IMEService.java
index 6064be9..86c7864 100644
--- a/src/us/minak/IMEService.java
+++ b/src/us/minak/IMEService.java
@@ -1,5 +1,7 @@
package us.minak;
+import java.util.Queue;
+
import android.inputmethodservice.InputMethodService;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@@ -33,6 +35,12 @@ public class IMEService extends InputMethodService {
* 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);
+ if (imeView != null) {
+ final Queue<Character> symbolsQueue = imeView.getSymbolsQueue();
+ while (!symbolsQueue.isEmpty()) {
+ final Character character = symbolsQueue.poll();
+ getCurrentInputConnection().commitText(String.valueOf(character), 1);
+ }
+ }
}
}
diff --git a/src/us/minak/IMEView.java b/src/us/minak/IMEView.java
index d341ae5..aefded8 100644
--- a/src/us/minak/IMEView.java
+++ b/src/us/minak/IMEView.java
@@ -1,12 +1,17 @@
package us.minak;
+import java.util.LinkedList;
+import java.util.Queue;
+
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class IMEView extends RelativeLayout{
private final Context mContext;
+ private final Queue<Character> mSymbolsQueue = new LinkedList<Character>();
private OnCharacterEnteredListener mOnCharacterEnteredListener;
+
public IMEView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
@@ -31,4 +36,9 @@ public class IMEView extends RelativeLayout{
private void enterCharacter(String character) {
mOnCharacterEnteredListener.characterEntered(character);
}
+
+ public Queue<Character> getSymbolsQueue() {
+ return mSymbolsQueue;
+ }
+
}
diff --git a/src/us/minak/SketchPadActivity.java b/src/us/minak/SketchPadActivity.java
new file mode 100644
index 0000000..b415718
--- /dev/null
+++ b/src/us/minak/SketchPadActivity.java
@@ -0,0 +1,39 @@
+
+package us.minak;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.content.LocalBroadcastManager;
+import android.view.View;
+import android.view.Window;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.GridView;
+import android.widget.AdapterView.OnItemClickListener;
+
+public class SketchPadActivity extends Activity {
+ 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', '!',
+ '@', '#', '$', '%', '^', '&', '*', '(', ')', '`', '-', '=', '~', '_', '+', '[', ']', '\\', '{', '}', '|',
+ ';', '\'', ':', '\'', ',', '.', '/', '<', '>', '?' };
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ /*setContentView(R.layout.symbols);
+ final GridView gridView = (GridView) findViewById(R.id.symbols_gridview);
+ final ArrayAdapter<Character> adapter = new ArrayAdapter<Character>(this, android.R.layout.simple_list_item_1, SYMBOLS);
+ gridView.setAdapter(adapter);
+ gridView.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ final Intent intent = new Intent(INTENT_ACTION);
+ intent.putExtra(INTENT_EXTRA_NAME, SYMBOLS[position]);
+ LocalBroadcastManager.getInstance(SketchPadActivity.this).sendBroadcast(intent);
+ }
+ });*/
+ }
+} \ No newline at end of file