Skip to content

Commit 00e6fb3

Browse files
committed
Fixes for keyboard and vibration for on-screen keys.
1 parent 828539a commit 00e6fb3

24 files changed

+23
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ release
77
*/build
88
debug/
99
release/
10+
.gradle
-2.32 MB
Binary file not shown.
-17 Bytes
Binary file not shown.
-1 Bytes
Binary file not shown.
-17 Bytes
Binary file not shown.

.gradle/6.5/fileHashes/fileHashes.bin

-408 KB
Binary file not shown.
-17 Bytes
Binary file not shown.
-18.4 KB
Binary file not shown.

.gradle/6.5/gc.properties

Whitespace-only changes.
-657 KB
Binary file not shown.
-81.5 KB
Binary file not shown.
-17 Bytes
Binary file not shown.
-27.8 KB
Binary file not shown.
-17 Bytes
Binary file not shown.

.gradle/buildOutputCleanup/cache.properties

-2
This file was deleted.
-90.1 KB
Binary file not shown.

.gradle/checksums/checksums.lock

-17 Bytes
Binary file not shown.

.gradle/checksums/md5-checksums.bin

-21.6 KB
Binary file not shown.

.gradle/checksums/sha1-checksums.bin

-27.2 KB
Binary file not shown.

.gradle/vcs-1/gc.properties

Whitespace-only changes.

connectbot/src/main/java/com/iiordanov/bssh/ConsoleActivity.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ public void onClick(View view) {
476476

477477
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
478478
handler.sendTab();
479-
479+
terminal.bridge.vibrate();
480+
480481
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
481482
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
482483
}
@@ -491,6 +492,7 @@ public void onClick(View view) {
491492

492493
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
493494
handler.metaPress(TerminalKeyListener.META_CTRL_ON);
495+
terminal.bridge.vibrate();
494496

495497
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
496498
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
@@ -515,6 +517,7 @@ public void onClick(View view) {
515517

516518
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
517519
handler.sendEscape();
520+
terminal.bridge.vibrate();
518521

519522
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
520523
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
@@ -539,6 +542,7 @@ public void onClick(View view) {
539542

540543
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
541544
handler.sendUp();
545+
terminal.bridge.vibrate();
542546
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
543547
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
544548
}
@@ -553,6 +557,7 @@ public void onClick(View view) {
553557

554558
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
555559
handler.sendLeft();
560+
terminal.bridge.vibrate();
556561
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
557562
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
558563
}
@@ -567,6 +572,7 @@ public void onClick(View view) {
567572

568573
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
569574
handler.sendDown();
575+
terminal.bridge.vibrate();
570576
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
571577
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
572578
}
@@ -581,6 +587,7 @@ public void onClick(View view) {
581587

582588
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
583589
handler.sendRight();
590+
terminal.bridge.vibrate();
584591
ConsoleActivity.this.handler.removeCallbacks(fadeOutOnScreenKeys);
585592
ConsoleActivity.this.handler.postDelayed(fadeOutOnScreenKeys, KEYBOARD_DISPLAY_TIME);
586593
}
@@ -1561,4 +1568,4 @@ private void hideActionBar() {
15611568
}
15621569
}
15631570
*/
1564-
}
1571+
}

connectbot/src/main/java/com/iiordanov/bssh/TerminalView.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ public boolean onCheckIsTextEditor() {
298298

299299
@Override
300300
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
301-
outAttrs.imeOptions |=
302-
EditorInfo.IME_FLAG_NO_EXTRACT_UI |
303-
EditorInfo.IME_FLAG_NO_ENTER_ACTION |
304-
EditorInfo.IME_ACTION_NONE;
301+
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN |
302+
EditorInfo.IME_FLAG_NO_EXTRACT_UI |
303+
EditorInfo.IME_FLAG_NO_ENTER_ACTION |
304+
EditorInfo.IME_ACTION_NONE;
305305
outAttrs.inputType = EditorInfo.TYPE_NULL |
306306
EditorInfo.TYPE_TEXT_VARIATION_PASSWORD |
307307
EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD |
@@ -315,7 +315,9 @@ public boolean deleteSurroundingText (int leftLength, int rightLength) {
315315
for (int i = 0; i < leftLength; i++) {
316316
this.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
317317
}
318-
// TODO: forward delete
318+
for (int i = 0; i < rightLength; i++) {
319+
this.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_FORWARD_DEL));
320+
}
319321
return true;
320322
}
321323
};

connectbot/src/main/java/com/iiordanov/bssh/service/TerminalBridge.java

+4
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,10 @@ public synchronized void tryKeyVibrate() {
502502
manager.tryKeyVibrate();
503503
}
504504

505+
public synchronized void vibrate() {
506+
manager.vibrate();
507+
}
508+
505509
/**
506510
* Request a different font size. Will make call to parentChanged() to make
507511
* sure we resize PTY if needed.

connectbot/src/main/java/com/iiordanov/bssh/service/TerminalManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
102102

103103
private Vibrator vibrator;
104104
private volatile boolean wantKeyVibration;
105-
public static final long VIBRATE_DURATION = 30;
105+
public static final long VIBRATE_DURATION = 5;
106106

107107
private boolean wantBellVibration;
108108

@@ -537,7 +537,7 @@ public void tryKeyVibrate() {
537537
vibrate();
538538
}
539539

540-
private void vibrate() {
540+
public void vibrate() {
541541
if (vibrator != null)
542542
vibrator.vibrate(VIBRATE_DURATION);
543543
}

0 commit comments

Comments
 (0)