aboutsummaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorJeffrey Sharkey <jsharkey@jsharkey.org>2008-12-29 23:43:42 +0000
committerJeffrey Sharkey <jsharkey@jsharkey.org>2008-12-29 23:43:42 +0000
commit25e660d37f9d3625db2fe608cd9c7985d9d2fdfa (patch)
tree4a9f4a40b650e6fd72b010261a95e42319d3c40f /src/org
parentad9a45cf8055707d9f77da90c3f44c8208a5f23c (diff)
downloadconnectbot-25e660d37f9d3625db2fe608cd9c7985d9d2fdfa.tar.gz
connectbot-25e660d37f9d3625db2fe608cd9c7985d9d2fdfa.tar.bz2
connectbot-25e660d37f9d3625db2fe608cd9c7985d9d2fdfa.zip
* Added "bumpy arrows" so that arrow keys trigger vibration, useful for laggy connections. Also added preference to turn off if desired.
* Created windowNoTitle style to prevent brief flashing of title bar on ConsoleActivity, instead of requesting programatically. * Slight padding change to EULA screen.
Diffstat (limited to 'src/org')
-rw-r--r--src/org/connectbot/ConsoleActivity.java3
-rw-r--r--src/org/connectbot/TerminalView.java2
-rw-r--r--src/org/connectbot/service/TerminalBridge.java42
3 files changed, 39 insertions, 8 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java
index f4e1bf8..8e7f771 100644
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -281,7 +281,6 @@ public class ConsoleActivity extends Activity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- requestWindowFeature(Window.FEATURE_NO_TITLE);
this.setContentView(R.layout.act_console);
clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
@@ -434,10 +433,12 @@ public class ConsoleActivity extends Activity {
// otherwise consume as pgup/pgdown for every 5 lines
if(moved > 5) {
((vt320)terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_DOWN, ' ', 0);
+ terminal.bridge.tryKeyVibrate();
totalY = 0;
return true;
} else if(moved < -5) {
((vt320)terminal.bridge.buffer).keyPressed(vt320.KEY_PAGE_UP, ' ', 0);
+ terminal.bridge.tryKeyVibrate();
totalY = 0;
return true;
}
diff --git a/src/org/connectbot/TerminalView.java b/src/org/connectbot/TerminalView.java
index dfcd6f8..f7da203 100644
--- a/src/org/connectbot/TerminalView.java
+++ b/src/org/connectbot/TerminalView.java
@@ -39,7 +39,7 @@ import android.widget.Toast;
public class TerminalView extends View {
private final Context context;
- protected final TerminalBridge bridge;
+ public final TerminalBridge bridge;
private final Paint paint;
private final Paint cursorPaint;
diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java
index 60156eb..746cda3 100644
--- a/src/org/connectbot/service/TerminalBridge.java
+++ b/src/org/connectbot/service/TerminalBridge.java
@@ -49,6 +49,8 @@ import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnKeyListener;
+import android.os.Vibrator;
+import android.content.Context;
import com.trilead.ssh2.ChannelCondition;
import com.trilead.ssh2.Connection;
@@ -142,9 +144,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
protected KeyCharacterMap keymap = KeyCharacterMap.load(KeyCharacterMap.BUILT_IN_KEYBOARD);
public int charWidth = -1;
-
public int charHeight = -1;
-
private int charDescent = -1;
private float fontSize = -1;
@@ -675,6 +675,11 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
public void refreshKeymode() {
keymode = manager.getKeyMode();
}
+
+ private boolean bumpyArrows = false;
+ public Vibrator vibrator = null;
+
+ public static final long VIBRATE_DURATION = 30;
/**
* Handle onKey() events coming down from a {@link TerminalView} above us.
@@ -822,10 +827,26 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
case KeyEvent.KEYCODE_DEL: stdin.write(0x08); return true;
case KeyEvent.KEYCODE_ENTER: ((vt320)buffer).keyTyped(vt320.KEY_ENTER, ' ', event.getMetaState()); return true;
- case KeyEvent.KEYCODE_DPAD_LEFT: ((vt320)buffer).keyPressed(vt320.KEY_LEFT, ' ', event.getMetaState()); return true;
- case KeyEvent.KEYCODE_DPAD_UP: ((vt320)buffer).keyPressed(vt320.KEY_UP, ' ', event.getMetaState()); return true;
- case KeyEvent.KEYCODE_DPAD_DOWN: ((vt320)buffer).keyPressed(vt320.KEY_DOWN, ' ', event.getMetaState()); return true;
- case KeyEvent.KEYCODE_DPAD_RIGHT: ((vt320)buffer).keyPressed(vt320.KEY_RIGHT, ' ', event.getMetaState()); return true;
+ case KeyEvent.KEYCODE_DPAD_LEFT:
+ ((vt320)buffer).keyPressed(vt320.KEY_LEFT, ' ', event.getMetaState());
+ this.tryKeyVibrate();
+ return true;
+
+ case KeyEvent.KEYCODE_DPAD_UP:
+ ((vt320)buffer).keyPressed(vt320.KEY_UP, ' ', event.getMetaState());
+ this.tryKeyVibrate();
+ return true;
+
+ case KeyEvent.KEYCODE_DPAD_DOWN:
+ ((vt320)buffer).keyPressed(vt320.KEY_DOWN, ' ', event.getMetaState());
+ this.tryKeyVibrate();
+ return true;
+
+ case KeyEvent.KEYCODE_DPAD_RIGHT:
+ ((vt320)buffer).keyPressed(vt320.KEY_RIGHT, ' ', event.getMetaState());
+ this.tryKeyVibrate();
+ return true;
+
case KeyEvent.KEYCODE_DPAD_CENTER:
// TODO: Add some visual indication of Ctrl state
if (ctrlPressed) {
@@ -853,6 +874,10 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
return false;
}
+ public void tryKeyVibrate() {
+ if(bumpyArrows && vibrator != null)
+ vibrator.vibrate(VIBRATE_DURATION);
+ }
/**
* Request a different font size. Will make call to parentChanged() to make
@@ -886,6 +911,11 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal
int width = parent.getWidth();
int height = parent.getHeight();
+ this.bumpyArrows = manager.prefs.getBoolean(manager.res.getString(R.string.pref_bumpyarrows), true);
+ if(parent != null) {
+ this.vibrator = (Vibrator) parent.getContext().getSystemService(Context.VIBRATOR_SERVICE);
+ }
+
if (!forcedSize) {
// recalculate buffer size
int newTermWidth, newTermHeight;