Add '|' and arrow keys to "Special Chars"
Add 'Camera' button as a possible Control key Make 'Volume Down' the default control key.
This commit is contained in:
parent
104a929112
commit
ce9b91f02d
@ -1,7 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="jackpal.androidterm"
|
package="jackpal.androidterm"
|
||||||
android:versionName="1.0.20" android:versionCode="21">
|
android:versionName="1.0.21" android:versionCode="22">
|
||||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<application android:icon="@drawable/app_terminal"
|
<application android:icon="@drawable/app_terminal"
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
<item>Right Alt key</item>
|
<item>Right Alt key</item>
|
||||||
<item>Vol Up key</item>
|
<item>Vol Up key</item>
|
||||||
<item>Vol Down key</item>
|
<item>Vol Down key</item>
|
||||||
|
<item>Camera key</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Do not localize entryvalues -->
|
<!-- Do not localize entryvalues -->
|
||||||
@ -114,6 +115,7 @@
|
|||||||
<item>3</item>
|
<item>3</item>
|
||||||
<item>4</item>
|
<item>4</item>
|
||||||
<item>5</item>
|
<item>5</item>
|
||||||
|
<item>6</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="entries_ime_preference">
|
<string-array name="entries_ime_preference">
|
||||||
|
@ -134,7 +134,7 @@ public class Term extends Activity {
|
|||||||
private int mCursorBlink = 0;
|
private int mCursorBlink = 0;
|
||||||
private int mFontSize = 9;
|
private int mFontSize = 9;
|
||||||
private int mColorId = 2;
|
private int mColorId = 2;
|
||||||
private int mControlKeyId = 0;
|
private int mControlKeyId = 5; // Default to Volume Down
|
||||||
private int mUseCookedIME = 0;
|
private int mUseCookedIME = 0;
|
||||||
|
|
||||||
private static final String STATUSBAR_KEY = "statusbar";
|
private static final String STATUSBAR_KEY = "statusbar";
|
||||||
@ -163,10 +163,11 @@ public class Term extends Activity {
|
|||||||
KeyEvent.KEYCODE_ALT_LEFT,
|
KeyEvent.KEYCODE_ALT_LEFT,
|
||||||
KeyEvent.KEYCODE_ALT_RIGHT,
|
KeyEvent.KEYCODE_ALT_RIGHT,
|
||||||
KeyEvent.KEYCODE_VOLUME_UP,
|
KeyEvent.KEYCODE_VOLUME_UP,
|
||||||
KeyEvent.KEYCODE_VOLUME_DOWN
|
KeyEvent.KEYCODE_VOLUME_DOWN,
|
||||||
|
KeyEvent.KEYCODE_CAMERA
|
||||||
};
|
};
|
||||||
private static final String[] CONTROL_KEY_NAME = {
|
private static final String[] CONTROL_KEY_NAME = {
|
||||||
"Ball", "@", "Left-Alt", "Right-Alt", "Vol-Up", "Vol-Dn"
|
"Ball", "@", "Left-Alt", "Right-Alt", "Vol-Up", "Vol-Dn", "Camera"
|
||||||
};
|
};
|
||||||
|
|
||||||
private int mControlKeyCode;
|
private int mControlKeyCode;
|
||||||
@ -563,14 +564,19 @@ public class Term extends Activity {
|
|||||||
String controlKey = CONTROL_KEY_NAME[mControlKeyId];
|
String controlKey = CONTROL_KEY_NAME[mControlKeyId];
|
||||||
new AlertDialog.Builder(this).
|
new AlertDialog.Builder(this).
|
||||||
setTitle("Press " + controlKey + " and Key").
|
setTitle("Press " + controlKey + " and Key").
|
||||||
setMessage(controlKey + " Space ==> Control-@ (NUL)\n"
|
setMessage(controlKey + " Space : Control-@ (NUL)\n"
|
||||||
+ controlKey + " A..Z ==> Control-A..Z\n"
|
+ controlKey + " A..Z : Control-A..Z\n"
|
||||||
+ controlKey + " 1 ==> Control-[ (ESC)\n"
|
+ controlKey + " 1 : Control-[ (ESC)\n"
|
||||||
+ controlKey + " 5 ==> Control-_\n"
|
+ controlKey + " 2 : Control-_\n"
|
||||||
+ controlKey + " . ==> Control-\\\n"
|
+ controlKey + " 3 : Control-^\n"
|
||||||
+ controlKey + " 0 ==> Control-]\n"
|
+ controlKey + " 4 : Control-]\n"
|
||||||
+ controlKey + " 6 ==> Control-^").
|
+ controlKey + " 5 : | (pipe)\n"
|
||||||
show();
|
+ controlKey + " 6 : Left arrow\n"
|
||||||
|
+ controlKey + " 7 : Down arrow\n"
|
||||||
|
+ controlKey + " 8 : Up arrow\n"
|
||||||
|
+ controlKey + " 9 : Right arrow\n"
|
||||||
|
+ controlKey + " . : Control-\\"
|
||||||
|
).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doToggleSoftKeyboard() {
|
private void doToggleSoftKeyboard() {
|
||||||
@ -2873,8 +2879,10 @@ class EmulatorView extends View implements GestureDetector.OnGestureListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void mapAndSend(int c) throws IOException {
|
private void mapAndSend(int c) throws IOException {
|
||||||
mTermOut.write(
|
int result = mKeyListener.mapControlChar(c);
|
||||||
mKeyListener.mapControlChar(c));
|
if (result < TermKeyListener.KEYCODE_OFFSET) {
|
||||||
|
mTermOut.write(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean beginBatchEdit() {
|
public boolean beginBatchEdit() {
|
||||||
@ -4187,6 +4195,8 @@ class TermKeyListener {
|
|||||||
|
|
||||||
private boolean mCapsLock;
|
private boolean mCapsLock;
|
||||||
|
|
||||||
|
static public final int KEYCODE_OFFSET = 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a term key listener.
|
* Construct a term key listener.
|
||||||
*
|
*
|
||||||
@ -4215,12 +4225,22 @@ class TermKeyListener {
|
|||||||
result = 27;
|
result = 27;
|
||||||
} else if ((result == '\\') || (result == '.')) {
|
} else if ((result == '\\') || (result == '.')) {
|
||||||
result = 28;
|
result = 28;
|
||||||
} else if ((result == ']') || (result == '0')) {
|
} else if ((result == ']') || (result == '4')) {
|
||||||
result = 29;
|
result = 29;
|
||||||
} else if ((result == '^') || (result == '6')) {
|
} else if ((result == '^') || (result == '3')) {
|
||||||
result = 30; // control-^
|
result = 30; // control-^
|
||||||
} else if ((result == '_') || (result == '5')) {
|
} else if ((result == '_') || (result == '2')) {
|
||||||
result = 31;
|
result = 31;
|
||||||
|
} else if ((result == '5')) {
|
||||||
|
result = '|';
|
||||||
|
} else if ((result == '6')) {
|
||||||
|
result = KEYCODE_OFFSET + KeyEvent.KEYCODE_DPAD_LEFT;
|
||||||
|
} else if ((result == '7')) {
|
||||||
|
result = KEYCODE_OFFSET + KeyEvent.KEYCODE_DPAD_DOWN;
|
||||||
|
} else if ((result == '8')) {
|
||||||
|
result = KEYCODE_OFFSET + KeyEvent.KEYCODE_DPAD_UP;
|
||||||
|
} else if ((result == '9')) {
|
||||||
|
result = KEYCODE_OFFSET + KeyEvent.KEYCODE_DPAD_RIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4229,6 +4249,7 @@ class TermKeyListener {
|
|||||||
mCapKey.adjustAfterKeypress();
|
mCapKey.adjustAfterKeypress();
|
||||||
mControlKey.adjustAfterKeypress();
|
mControlKey.adjustAfterKeypress();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4239,21 +4260,8 @@ class TermKeyListener {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void keyDown(int keyCode, KeyEvent event, OutputStream out, boolean appMode) throws IOException {
|
public void keyDown(int keyCode, KeyEvent event, OutputStream out, boolean appMode) throws IOException {
|
||||||
if (keyCode >= 0 && keyCode < mKeyCodes.length) {
|
if (handleKeyCode(keyCode, out, appMode)) {
|
||||||
String code = null;
|
return;
|
||||||
if (appMode) {
|
|
||||||
code = mAppKeyCodes[keyCode];
|
|
||||||
}
|
|
||||||
if (code == null) {
|
|
||||||
code = mKeyCodes[keyCode];
|
|
||||||
}
|
|
||||||
if (code != null) {
|
|
||||||
int length = code.length();
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
out.write(code.charAt(i));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
int result = -1;
|
int result = -1;
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
@ -4288,11 +4296,33 @@ class TermKeyListener {
|
|||||||
|
|
||||||
result = mapControlChar(result);
|
result = mapControlChar(result);
|
||||||
|
|
||||||
if (result >= 0) {
|
if (result >= KEYCODE_OFFSET) {
|
||||||
|
handleKeyCode(result - KEYCODE_OFFSET, out, appMode);
|
||||||
|
} else if (result >= 0) {
|
||||||
out.write(result);
|
out.write(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean handleKeyCode(int keyCode, OutputStream out, boolean appMode) throws IOException {
|
||||||
|
if (keyCode >= 0 && keyCode < mKeyCodes.length) {
|
||||||
|
String code = null;
|
||||||
|
if (appMode) {
|
||||||
|
code = mAppKeyCodes[keyCode];
|
||||||
|
}
|
||||||
|
if (code == null) {
|
||||||
|
code = mKeyCodes[keyCode];
|
||||||
|
}
|
||||||
|
if (code != null) {
|
||||||
|
int length = code.length();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
out.write(code.charAt(i));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a keyUp event.
|
* Handle a keyUp event.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user