Fix keymap loading bug that makes characters that have no alternate key have one. Reformatting.
This commit is contained in:
@@ -22,6 +22,7 @@ package cfpi_fpsi.eu.titanboard;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
@@ -37,7 +38,6 @@ import java.util.Deque;
|
||||
// TODO: Implement long-click for extra keys.
|
||||
// TODO: Implement auto-correct.
|
||||
// TODO: Implement auto-caps.
|
||||
// TODO: Implement language switcher.
|
||||
// TODO: Implement device recognition and a keymap picking based on it.
|
||||
// TODO: Make preferences accessible and saveable.
|
||||
|
||||
@@ -108,6 +108,8 @@ public class IME extends InputMethodService {
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.d("STATE", "Sending key: " + key + " whose keyCode is: " + keyCode);
|
||||
|
||||
conn.commitText(key, 1);
|
||||
mMetaKeyManager.adjustMetaStateAfterKeypress();
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package cfpi_fpsi.eu.titanboard;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
@@ -41,6 +43,9 @@ public class KeymapManager {
|
||||
|
||||
if (type == XmlPullParser.START_TAG && parser.getName().equals("keymap")) {
|
||||
keymap = new Keymap();
|
||||
lang = null;
|
||||
shortLabel = null;
|
||||
label = null;
|
||||
for (int i = 0; i < parser.getAttributeCount(); ++i) {
|
||||
switch (parser.getAttributeName(i)) {
|
||||
case "lang":
|
||||
@@ -54,13 +59,20 @@ public class KeymapManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.d("STATE", "BEGINNING OF KEYMAP: " + label);
|
||||
} else if (type == XmlPullParser.END_TAG && parser.getName().equals("keymap")) {
|
||||
Log.d("STATE", "END OF KEYMAP: " + label);
|
||||
keymap.mShortLabel = shortLabel;
|
||||
keymap.mLabel = label;
|
||||
mKeymaps.put(lang, keymap);
|
||||
}
|
||||
|
||||
if (type == XmlPullParser.START_TAG && parser.getName().equals("key")) {
|
||||
none = null;
|
||||
shift = null;
|
||||
alt = null;
|
||||
sym = null;
|
||||
shiftSym = null;
|
||||
for (int i = 0; i < parser.getAttributeCount(); ++i) {
|
||||
String attr = parser.getAttributeName(i);
|
||||
switch (attr) {
|
||||
@@ -84,6 +96,7 @@ public class KeymapManager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.d("STATE", "Key code: " + code + ". Value sym: " + sym);
|
||||
} else if (type == XmlPullParser.END_TAG && parser.getName().equals("key")) {
|
||||
keymap.put(code, new Key(none, shift, alt, sym, shiftSym));
|
||||
}
|
||||
|
||||
@@ -145,42 +145,38 @@ public class MetaKeyManager {
|
||||
setUsed(false);
|
||||
}
|
||||
|
||||
public void setPressed(boolean state) {
|
||||
mPressed = state;
|
||||
}
|
||||
|
||||
public void setLatched(boolean state) {
|
||||
mLatched = state;
|
||||
}
|
||||
|
||||
public void setLocked(boolean state) {
|
||||
mLocked = state;
|
||||
}
|
||||
|
||||
public void setUsed(boolean state) {
|
||||
mUsed = state;
|
||||
}
|
||||
|
||||
public void setKeyUpTime(long time) {
|
||||
mKeyUpTime = time;
|
||||
}
|
||||
|
||||
public boolean isPressed() {
|
||||
return mPressed;
|
||||
}
|
||||
|
||||
public void setPressed(boolean state) {
|
||||
mPressed = state;
|
||||
}
|
||||
|
||||
public boolean isLatched() {
|
||||
return mLatched;
|
||||
}
|
||||
|
||||
public void setLatched(boolean state) {
|
||||
mLatched = state;
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return mLocked;
|
||||
}
|
||||
|
||||
public void setLocked(boolean state) {
|
||||
mLocked = state;
|
||||
}
|
||||
|
||||
public boolean isUsed() {
|
||||
return mUsed;
|
||||
}
|
||||
|
||||
public void setUsed(boolean state) {
|
||||
mUsed = state;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return isPressed() || isLocked() || isLatched();
|
||||
}
|
||||
@@ -189,6 +185,10 @@ public class MetaKeyManager {
|
||||
return mKeyUpTime;
|
||||
}
|
||||
|
||||
public void setKeyUpTime(long time) {
|
||||
mKeyUpTime = time;
|
||||
}
|
||||
|
||||
public enum MetaKeyType {
|
||||
ALT,
|
||||
SHIFT,
|
||||
|
||||
@@ -491,7 +491,7 @@
|
||||
code="30"
|
||||
none="β"
|
||||
shift="Β" />
|
||||
<!-- C-->
|
||||
<!-- C-->
|
||||
<key
|
||||
alt=","
|
||||
code="31"
|
||||
@@ -617,171 +617,171 @@
|
||||
label="Russian"
|
||||
lang="ru_RU"
|
||||
short-label="RU">
|
||||
<!-- A-->
|
||||
<!-- A-->
|
||||
<key
|
||||
alt="@"
|
||||
code="29"
|
||||
none="ф"
|
||||
shift="Ф" />
|
||||
<!-- B-->
|
||||
<!-- B-->
|
||||
<key
|
||||
alt="7"
|
||||
code="30"
|
||||
none="и"
|
||||
shift="И"
|
||||
sym="ё"
|
||||
shiftSym="Ё" />
|
||||
shiftSym="Ё"
|
||||
sym="ё" />
|
||||
<!-- C-->
|
||||
<key
|
||||
alt=","
|
||||
code="31"
|
||||
none="c"
|
||||
shift="C" />
|
||||
<!-- D-->
|
||||
<!-- D-->
|
||||
<key
|
||||
alt="""
|
||||
code="32"
|
||||
none="в"
|
||||
shift="В"
|
||||
sym="б"
|
||||
shiftSym="Б" />
|
||||
<!-- E-->
|
||||
shiftSym="Б"
|
||||
sym="б" />
|
||||
<!-- E-->
|
||||
<key
|
||||
alt="_"
|
||||
code="33"
|
||||
none="у"
|
||||
shift="У" />
|
||||
<!-- F-->
|
||||
<!-- F-->
|
||||
<key
|
||||
alt="+"
|
||||
code="34"
|
||||
none="a"
|
||||
shift="A" />
|
||||
<!-- G-->
|
||||
<!-- G-->
|
||||
<key
|
||||
alt="*"
|
||||
code="35"
|
||||
none="п"
|
||||
shift="П" />
|
||||
<!-- H-->
|
||||
<!-- H-->
|
||||
<key
|
||||
alt="#"
|
||||
code="36"
|
||||
none="р"
|
||||
shift="Р" />
|
||||
<!-- I-->
|
||||
<!-- I-->
|
||||
<key
|
||||
alt="2"
|
||||
code="37"
|
||||
none="ш"
|
||||
shift="Ш" />
|
||||
<!-- J-->
|
||||
<!-- J-->
|
||||
<key
|
||||
alt="4"
|
||||
code="38"
|
||||
none="o"
|
||||
shift="O" />
|
||||
<!-- K-->
|
||||
<!-- K-->
|
||||
<key
|
||||
alt="5"
|
||||
code="39"
|
||||
none="л"
|
||||
shift="Л" />
|
||||
<!-- L-->
|
||||
<!-- L-->
|
||||
<key
|
||||
alt="6"
|
||||
code="40"
|
||||
none="д"
|
||||
shift="Д" />
|
||||
<!-- M-->
|
||||
<!-- M-->
|
||||
<key
|
||||
alt="9"
|
||||
code="41"
|
||||
none="ь"
|
||||
shift="Ь"
|
||||
sym="ъ"
|
||||
shiftSym="Ъ" />
|
||||
<!-- N-->
|
||||
shiftSym="Ъ"
|
||||
sym="ъ" />
|
||||
<!-- N-->
|
||||
<key
|
||||
alt="8"
|
||||
code="42"
|
||||
none="т"
|
||||
shift="T" />
|
||||
<!-- O-->
|
||||
<!-- O-->
|
||||
<key
|
||||
alt="3"
|
||||
code="43"
|
||||
none="щ"
|
||||
shift="Щ" />
|
||||
<!-- P, — z & ż -->
|
||||
<!-- P, — z & ż -->
|
||||
<key
|
||||
alt="0"
|
||||
code="44"
|
||||
none="з"
|
||||
shift="З"
|
||||
sym="ж"
|
||||
shiftSym="Ж" />
|
||||
<!-- Q-->
|
||||
shiftSym="Ж"
|
||||
sym="ж" />
|
||||
<!-- Q-->
|
||||
<key
|
||||
alt=":"
|
||||
code="45"
|
||||
none="й"
|
||||
shift="Й"
|
||||
sym="ю"
|
||||
shiftSym="Ю" />
|
||||
<!-- R-->
|
||||
shiftSym="Ю"
|
||||
sym="ю" />
|
||||
<!-- R-->
|
||||
<key
|
||||
alt="-"
|
||||
code="46"
|
||||
none="к"
|
||||
shift="K"
|
||||
sym="х"
|
||||
shiftSym="Х" />
|
||||
<!-- S-->
|
||||
shiftSym="Х"
|
||||
sym="х" />
|
||||
<!-- S-->
|
||||
<key
|
||||
alt="'"
|
||||
code="47"
|
||||
none="ы"
|
||||
shift="Ы" />
|
||||
<!-- T-->
|
||||
<!-- T-->
|
||||
<key
|
||||
alt="("
|
||||
code="48"
|
||||
none="e"
|
||||
shift="E"
|
||||
sym="э"
|
||||
shiftSym="Э" />
|
||||
<!-- U-->
|
||||
shiftSym="Э"
|
||||
sym="э" />
|
||||
<!-- U-->
|
||||
<key
|
||||
alt="1"
|
||||
code="49"
|
||||
none="г"
|
||||
shift="Г" />
|
||||
<!-- V-->
|
||||
<!-- V-->
|
||||
<key
|
||||
alt="."
|
||||
code="50"
|
||||
none="м"
|
||||
shift="M" />
|
||||
<!-- W-->
|
||||
<!-- W-->
|
||||
<key
|
||||
alt="/"
|
||||
code="51"
|
||||
none="ц"
|
||||
shift="Ц" />
|
||||
<!-- X-->
|
||||
<!-- X-->
|
||||
<key
|
||||
alt="?"
|
||||
code="52"
|
||||
none="ч"
|
||||
shift="Ч" />
|
||||
<!-- Y-->
|
||||
<!-- Y-->
|
||||
<key
|
||||
alt=")"
|
||||
code="53"
|
||||
none="н"
|
||||
shift="Н" />
|
||||
<!-- Z-->
|
||||
<!-- Z-->
|
||||
<key
|
||||
alt="!"
|
||||
code="54"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
android:settingsActivity="cfpi_fpsi.eu.titanboard.PreferencesActivity"
|
||||
android:supportsSwitchingToNextInputMethod="false ">
|
||||
<subtype
|
||||
android:label="Default"
|
||||
android:imeSubtypeMode="keyboard"
|
||||
android:isAsciiCapable="true"
|
||||
android:imeSubtypeMode="keyboard" />
|
||||
android:label="Default" />
|
||||
</input-method>
|
||||
Reference in New Issue
Block a user