aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/org/connectbot/ConsoleActivity.java
diff options
context:
space:
mode:
authorRyan Hansberry <rhansby@gmail.com>2015-10-07 11:20:21 -0700
committerRyan Hansberry <rhansby@gmail.com>2015-10-07 11:20:21 -0700
commit17f70f5e62c4c5bee31d418bb4c94fd356e36cec (patch)
tree48fb37447e1f98aa26c833764238a911a0f71dfd /app/src/main/java/org/connectbot/ConsoleActivity.java
parent9b8794d04cdfc2c226b6367c5c766bb9a79a1638 (diff)
downloadconnectbot-17f70f5e62c4c5bee31d418bb4c94fd356e36cec.tar.gz
connectbot-17f70f5e62c4c5bee31d418bb4c94fd356e36cec.tar.bz2
connectbot-17f70f5e62c4c5bee31d418bb4c94fd356e36cec.zip
Move old copying logic to TerminalView. Add comments to TerminalView.
Diffstat (limited to 'app/src/main/java/org/connectbot/ConsoleActivity.java')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java95
1 files changed, 1 insertions, 94 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index ba97f45..15b5e63 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -137,9 +137,6 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
private MenuItem disconnect, copy, paste, portForward, resize, urlscan;
- protected TerminalBridge copySource = null;
- private int lastTouchRow, lastTouchCol;
-
private boolean forcedOrientation;
private Handler handler = new Handler();
@@ -669,78 +666,6 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
}
}
});
-
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
- pager.setOnTouchListener(new OnTouchListener() {
- public boolean onTouch(View v, MotionEvent event) {
- TerminalBridge bridge = adapter.getCurrentTerminalView().bridge;
-
- boolean isCopyingInProgress =
- (copySource != null && copySource.isSelectingForCopy());
-
- // when copying, highlight the area
- if (isCopyingInProgress) {
- SelectionArea area = copySource.getSelectionArea();
- int row = (int) Math.floor(event.getY() / bridge.charHeight);
- int col = (int) Math.floor(event.getX() / bridge.charWidth);
-
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- // recording starting area
- if (area.isSelectingOrigin()) {
- area.setRow(row);
- area.setColumn(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.setRow(row);
- area.setColumn(col);
- lastTouchRow = row;
- lastTouchCol = col;
- copySource.redraw();
- 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.
- */
- if (area.getLeft() == area.getRight() &&
- area.getTop() == area.getBottom()) {
- return true;
- }
-
- // copy selected area to clipboard
- String copiedText = area.copyFrom(copySource.buffer);
-
- clipboard.setText(copiedText);
- Toast.makeText(ConsoleActivity.this, getString(R.string.console_copy_done, copiedText.length()), Toast.LENGTH_LONG).show();
- // fall through to clear state
-
- case MotionEvent.ACTION_CANCEL:
- // make sure we clear any highlighted area
- area.reset();
- copySource.setSelectingForCopy(false);
- copySource.redraw();
- return true;
- }
- }
-
- return true;
- }
- });
- }
}
/**
@@ -843,7 +768,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
copy.setEnabled(activeTerminal);
copy.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
- startCopyMode();
+ adapter.getCurrentTerminalView().startPreHoneycombCopyMode();
Toast.makeText(ConsoleActivity.this, getString(R.string.console_copy_start), Toast.LENGTH_LONG).show();
return true;
}
@@ -1111,24 +1036,6 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
}
/**
- * Only intended for pre-Honeycomb devices.
- */
- private void startCopyMode() {
- // mark as copying and reset any previous bounds
- TerminalView terminalView = (TerminalView) adapter.getCurrentTerminalView();
- copySource = terminalView.bridge;
-
- SelectionArea area = copySource.getSelectionArea();
- area.reset();
- area.setBounds(copySource.buffer.getColumns(), copySource.buffer.getRows());
-
- copySource.setSelectingForCopy(true);
-
- // Make sure we show the initial selection
- copySource.redraw();
- }
-
- /**
* Save the currently shown {@link TerminalView} as the default. This is
* saved back down into {@link TerminalManager} where we can read it again
* later.