Skip to content

Commit b39b23b

Browse files
author
rjmatthews62
committed
Fixed funny keyboard character with full keyboards and enabled Ctrl key functions.
Added support for 'digits' in fullscreenui
1 parent 726b19b commit b39b23b

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

android/Common/src/com/googlecode/android_scripting/facade/ui/ViewInflater.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.graphics.drawable.Drawable;
1010
import android.net.Uri;
1111
import android.text.InputType;
12+
import android.text.method.DigitsKeyListener;
1213
import android.util.DisplayMetrics;
1314
import android.view.Gravity;
1415
import android.view.View;
@@ -457,6 +458,8 @@ private void setProperty(View view, ViewGroup root, String attr, String value)
457458
setInteger(view, attr, getInteger(InputType.class, value));
458459
} else if (attr.equals("background")) {
459460
setBackground(view, value);
461+
} else if (attr.equals("digits") && view instanceof TextView) {
462+
((TextView) view).setKeyListener(DigitsKeyListener.getInstance(value));
460463
} else if (attr.startsWith("nextFocus")) {
461464
setInteger(view, attr + "Id", calcId(value));
462465
} else if (attr.equals("textSize")) {

android/ScriptingLayerForAndroid/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
package="com.googlecode.android_scripting"
5-
android:installLocation="auto" android:versionCode="510" android:versionName="5x10">
5+
android:installLocation="auto" android:versionCode="511" android:versionName="5x11">
66
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
77
<uses-permission android:name="net.dinglisch.android.tasker.PERMISSION_RUN_TASKS"></uses-permission>
88
<application

android/ScriptingLayerForAndroid/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# Indicates whether an apk should be generated for each density.
1111
split.density=false
12-
android.library.reference.1=../QuickAction
1312
# Project target.
1413
target=android-8
1514
apk-configurations=
15+
android.library.reference.1=../QuickAction

android/ScriptingLayerForAndroid/src/org/connectbot/service/TerminalKeyListener.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
import de.mud.terminal.VDUBuffer;
3131
import de.mud.terminal.vt320;
3232

33+
import java.io.IOException;
34+
3335
import org.connectbot.TerminalView;
3436
import org.connectbot.transport.AbsTransport;
3537
import org.connectbot.util.PreferenceConstants;
3638
import org.connectbot.util.SelectionArea;
3739

38-
import java.io.IOException;
39-
4040
/**
4141
* @author kenny
4242
* @author modified by raaar
@@ -60,6 +60,7 @@ public class TerminalKeyListener implements OnKeyListener, OnSharedPreferenceCha
6060
// All the transient key codes
6161
public final static int META_TRANSIENT = META_CTRL_ON | META_ALT_ON | META_SHIFT_ON;
6262

63+
public final static int KEYBOARD_META_CTRL_ON = 0x1000; // Ctrl key mask for API 11+
6364
private final TerminalManager manager;
6465
private final TerminalBridge bridge;
6566
private final VDUBuffer buffer;
@@ -184,6 +185,10 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
184185
}
185186

186187
int key = keymap.get(keyCode, curMetaState);
188+
if ((curMetaState & KEYBOARD_META_CTRL_ON) != 0) {
189+
metaState |= META_CTRL_ON;
190+
key = keymap.get(keyCode, 0);
191+
}
187192

188193
if ((metaState & META_CTRL_MASK) != 0) {
189194
metaState &= ~META_CTRL_ON;
@@ -206,10 +211,11 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
206211
}
207212

208213
// handle pressing f-keys
209-
if ((hardKeyboard && !hardKeyboardHidden) && (curMetaState & KeyEvent.META_SHIFT_ON) != 0
210-
&& sendFunctionKey(keyCode)) {
211-
return true;
212-
}
214+
// Doesn't work properly with asus keyboards... may never have worked. RM 09-Apr-2012
215+
/*
216+
* if ((hardKeyboard && !hardKeyboardHidden) && (curMetaState & KeyEvent.META_SHIFT_ON) != 0
217+
* && sendFunctionKey(keyCode)) { return true; }
218+
*/
213219

214220
if (key < 0x80) {
215221
transport.write(key);

0 commit comments

Comments
 (0)