diff options
author | Kenny Root <kenny@the-b.org> | 2009-01-21 07:46:17 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-01-21 07:46:17 +0000 |
commit | f4ade61e9ff1e80918509544e2bdf3a26bca5edc (patch) | |
tree | 573e78fe4b7b2c4f757ba0940f8f8d8d739ac22a /src | |
parent | 57af09b9c70cb09dea497963162a99cd53ee6ef3 (diff) | |
download | connectbot-f4ade61e9ff1e80918509544e2bdf3a26bca5edc.tar.gz connectbot-f4ade61e9ff1e80918509544e2bdf3a26bca5edc.tar.bz2 connectbot-f4ade61e9ff1e80918509544e2bdf3a26bca5edc.zip |
Allow the fine-tuning of touch selection with directional pad
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index c0b045e..fd9dbcc 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -99,6 +99,7 @@ public class ConsoleActivity extends Activity { private MenuItem disconnect, copy, paste, portForward, resize; protected TerminalBridge copySource = null; + private int lastTouchRow, lastTouchCol; private ServiceConnection connection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { @@ -415,6 +416,9 @@ public class ConsoleActivity extends Activity { // if copying, then ignore if (copySource != null && copySource.isSelectingForCopy()) return false; + + if (e1 == null || e2 == null) + return false; // if releasing then reset total scroll if(e2.getAction() == MotionEvent.ACTION_UP) { @@ -480,16 +484,31 @@ public class ConsoleActivity extends Activity { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: // recording starting area - area.setTop(row); - area.setLeft(col); - copySource.redraw(); - return false; + if (area.isSelectingOrigin()) { + area.setTop(row); + area.setLeft(col); + lastTouchRow = row; + lastTouchCol = col; + copySource.redraw(); + } + return true; case MotionEvent.ACTION_MOVE: + /* ignore when user hasn't moved since last time so + * we can fine-tune with directional pad + */ + if (row == lastTouchRow && col == lastTouchCol) + return true; + + // if the user moves, start the selection for other corner + area.finishSelectingOrigin(); + // update selected area area.setBottom(row); area.setRight(col); + lastTouchRow = row; + lastTouchCol = col; copySource.redraw(); - return false; + return true; case MotionEvent.ACTION_UP: /* If they didn't move their finger, maybe they meant to * select the rest of the text with the directional pad. |