Skip to content

Commit 072d160

Browse files
committed
1st commit and 1st workable UI of the Keyboard
0 parents  commit 072d160

27 files changed

+339
-0
lines changed

.classpath

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry kind="output" path="bin/classes"/>
8+
</classpath>

.project

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>StrokeFiveKeyboard</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Thu Feb 23 23:50:03 HKT 2012
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4+
org.eclipse.jdt.core.compiler.compliance=1.5
5+
org.eclipse.jdt.core.compiler.source=1.5

AndroidManifest.xml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.linkomnia.android.StrokeFiveKeyboard">
4+
<application android:label="@string/ime_name">
5+
<service android:name="StrokeFiveKeyboard"
6+
android:permission="android.permission.BIND_INPUT_METHOD">
7+
<intent-filter>
8+
<action android:name="android.view.InputMethod" />
9+
</intent-filter>
10+
<meta-data android:name="android.view.im" android:resource="@xml/method" />
11+
</service>
12+
</application>
13+
</manifest>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* AUTO-GENERATED FILE. DO NOT MODIFY.
2+
*
3+
* This class was automatically generated by the
4+
* aapt tool from the resource data it found. It
5+
* should not be modified by hand.
6+
*/
7+
8+
package com.linkomnia.android.StrokeFiveKeyboard;
9+
10+
public final class R {
11+
public static final class attr {
12+
}
13+
public static final class drawable {
14+
public static final int ic_launcher=0x7f020000;
15+
}
16+
public static final class id {
17+
public static final int keyboard=0x7f060000;
18+
}
19+
public static final class layout {
20+
public static final int main=0x7f030000;
21+
}
22+
public static final class string {
23+
public static final int ime_name=0x7f050000;
24+
}
25+
public static final class xml {
26+
public static final int method=0x7f040000;
27+
public static final int stroke5=0x7f040001;
28+
}
29+
}

proguard.cfg

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-optimizationpasses 5
2+
-dontusemixedcaseclassnames
3+
-dontskipnonpubliclibraryclasses
4+
-dontpreverify
5+
-verbose
6+
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7+
8+
-keep public class * extends android.app.Activity
9+
-keep public class * extends android.app.Application
10+
-keep public class * extends android.app.Service
11+
-keep public class * extends android.content.BroadcastReceiver
12+
-keep public class * extends android.content.ContentProvider
13+
-keep public class * extends android.app.backup.BackupAgentHelper
14+
-keep public class * extends android.preference.Preference
15+
-keep public class com.android.vending.licensing.ILicensingService
16+
17+
-keepclasseswithmembernames class * {
18+
native <methods>;
19+
}
20+
21+
-keepclasseswithmembers class * {
22+
public <init>(android.content.Context, android.util.AttributeSet);
23+
}
24+
25+
-keepclasseswithmembers class * {
26+
public <init>(android.content.Context, android.util.AttributeSet, int);
27+
}
28+
29+
-keepclassmembers class * extends android.app.Activity {
30+
public void *(android.view.View);
31+
}
32+
33+
-keepclassmembers enum * {
34+
public static **[] values();
35+
public static ** valueOf(java.lang.String);
36+
}
37+
38+
-keep class * implements android.os.Parcelable {
39+
public static final android.os.Parcelable$Creator *;
40+
}

project.properties

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-10

res/drawable-hdpi/ic_launcher.png

4.05 KB
Loading

res/drawable-ldpi/ic_launcher.png

1.68 KB
Loading

res/drawable-mdpi/ic_launcher.png

2.51 KB
Loading

res/layout/main.xml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.linkomnia.android.StrokeFiveKeyboard.Stroke5KeyBoardView
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:id="@+id/keyboard"
5+
android:layout_alignParentBottom="true"
6+
android:layout_width="match_parent"
7+
android:layout_height="wrap_content"
8+
/>

res/values/strings.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="ime_name">Stroke5Keyboard</string>
4+
5+
</resources>

res/xml/method.xml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<input-method xmlns:android="http://schemas.android.com/apk/res/android" />

res/xml/stroke5.xml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:keyWidth="10%p"
4+
android:horizontalGap="0px"
5+
android:verticalGap="0px"
6+
android:keyHeight="35dip"
7+
>
8+
9+
<Row android:keyHeight="70dip">
10+
<Key android:codes="109" android:keyLabel=""
11+
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
12+
<Key android:codes="47" android:keyLabel=""
13+
android:keyWidth="20%p"/>
14+
<Key android:codes="44" android:keyLabel="丿"
15+
android:keyWidth="20%p"/>
16+
<Key android:codes="46" android:keyLabel="\\"
17+
android:keyWidth="20%p"/>
18+
<Key android:codes="110" android:keyLabel="Z"
19+
android:keyWidth="20%p" android:keyEdgeFlags="right"/>
20+
</Row>
21+
22+
<Row>
23+
<Key android:codes="100" android:keyLabel=":o)"
24+
android:keyWidth="12.5%p" android:keyEdgeFlags="left"/>
25+
<Key android:codes="101" android:keyLabel=","
26+
android:keyWidth="12.5%p"/>
27+
<Key android:codes="102" android:keyLabel="."
28+
android:keyWidth="12.5%p"/>
29+
<Key android:codes="103" android:keyLabel="`"
30+
android:keyWidth="12.5%p"/>
31+
<Key android:codes="104" android:keyLabel="!"
32+
android:keyWidth="12.5%p"/>
33+
<Key android:codes="105" android:keyLabel="\?"
34+
android:keyWidth="12.5%p"/>
35+
<Key android:codes="106" android:keyLabel="delete"
36+
android:keyWidth="25%p" android:keyEdgeFlags="right"/>
37+
</Row>
38+
39+
<Row android:rowEdgeFlags="bottom">
40+
<Key android:codes="-3" android:keyLabel="lang"
41+
android:keyWidth="15%p" android:keyEdgeFlags="left"/>
42+
<Key android:codes="-2" android:keyLabel=".,?" android:keyWidth="15%p"/>
43+
<Key android:codes="-2" android:keyLabel="123" android:keyWidth="15%p"/>
44+
<Key android:codes="44" android:keyLabel="ABC"
45+
android:keyWidth="15%p"/>
46+
<Key android:codes="32" android:keyLabel="space"
47+
android:keyWidth="20%p" android:isRepeatable="true"/>
48+
<Key android:codes="10" android:keyLabel="return"
49+
android:keyWidth="20%p" android:keyEdgeFlags="right"/>
50+
</Row>
51+
</Keyboard>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.linkomnia.android.StrokeFiveKeyboard;
2+
3+
import android.content.Context;
4+
import android.content.res.Resources;
5+
import android.content.res.XmlResourceParser;
6+
import android.inputmethodservice.Keyboard;
7+
import android.inputmethodservice.Keyboard.Key;
8+
import android.inputmethodservice.Keyboard.Row;
9+
import android.view.inputmethod.EditorInfo;
10+
11+
public class Stroke5KeyBoard extends Keyboard {
12+
public Stroke5KeyBoard(Context context, int xmlLayoutResId) {
13+
super(context, xmlLayoutResId);
14+
}
15+
16+
public Stroke5KeyBoard(Context context, int layoutTemplateResId,
17+
CharSequence characters, int columns, int horizontalPadding) {
18+
super(context, layoutTemplateResId, characters, columns, horizontalPadding);
19+
}
20+
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.linkomnia.android.StrokeFiveKeyboard;
2+
3+
import android.content.Context;
4+
import android.inputmethodservice.Keyboard;
5+
import android.inputmethodservice.KeyboardView;
6+
import android.inputmethodservice.Keyboard.Key;
7+
import android.util.AttributeSet;
8+
import android.util.Log;
9+
10+
public class Stroke5KeyBoardView extends KeyboardView {
11+
12+
static final int KEYCODE_OPTIONS = -100;
13+
14+
public Stroke5KeyBoardView(Context context, AttributeSet attrs) {
15+
super(context, attrs);
16+
}
17+
18+
public Stroke5KeyBoardView(Context context, AttributeSet attrs, int defStyle) {
19+
super(context, attrs, defStyle);
20+
}
21+
22+
@Override
23+
protected boolean onLongPress(Key key) {
24+
Log.d("WANLEUNG", "onLongPress");
25+
if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
26+
getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
27+
return true;
28+
} else {
29+
return super.onLongPress(key);
30+
}
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package com.linkomnia.android.StrokeFiveKeyboard;
2+
3+
import android.inputmethodservice.InputMethodService;
4+
import android.inputmethodservice.Keyboard;
5+
import android.inputmethodservice.KeyboardView;
6+
import android.text.method.MetaKeyKeyListener;
7+
import android.util.Log;
8+
import android.view.KeyCharacterMap;
9+
import android.view.KeyEvent;
10+
import android.view.View;
11+
import android.view.inputmethod.CompletionInfo;
12+
import android.view.inputmethod.EditorInfo;
13+
import android.view.inputmethod.InputConnection;
14+
import android.view.inputmethod.InputMethodManager;
15+
16+
public class StrokeFiveKeyboard extends InputMethodService
17+
implements KeyboardView.OnKeyboardActionListener {
18+
/** Called when the activity is first created. */
19+
private KeyboardView mInputView;
20+
21+
22+
private Stroke5KeyBoard mStroke5;
23+
24+
@Override public void onCreate() {
25+
super.onCreate();
26+
27+
}
28+
29+
public void onInitializeInterface () {
30+
mStroke5 = new Stroke5KeyBoard(this, R.xml.stroke5);
31+
}
32+
33+
public View onCreateInputView () {
34+
mInputView = (KeyboardView) getLayoutInflater().inflate(
35+
R.layout.main, null);
36+
mInputView.setOnKeyboardActionListener(this);
37+
mInputView.setKeyboard(mStroke5);
38+
return mInputView;
39+
}
40+
41+
public void onKey(int primaryCode, int[] keyCodes) {
42+
// TODO Auto-generated method stub
43+
44+
}
45+
46+
public void onPress(int primaryCode) {
47+
// TODO Auto-generated method stub
48+
49+
}
50+
51+
public void onRelease(int primaryCode) {
52+
// TODO Auto-generated method stub
53+
54+
}
55+
56+
public void onText(CharSequence text) {
57+
// TODO Auto-generated method stub
58+
59+
}
60+
61+
public void swipeDown() {
62+
// TODO Auto-generated method stub
63+
64+
}
65+
66+
public void swipeLeft() {
67+
// TODO Auto-generated method stub
68+
69+
}
70+
71+
public void swipeRight() {
72+
// TODO Auto-generated method stub
73+
74+
}
75+
76+
public void swipeUp() {
77+
// TODO Auto-generated method stub
78+
79+
}
80+
}

0 commit comments

Comments
 (0)