aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/org/connectbot/ConsoleActivity.java
diff options
context:
space:
mode:
authoradb2001 <adb2001@hotmail.com>2015-08-31 20:59:01 +0200
committeradb2001 <adb2001@hotmail.com>2015-08-31 20:59:01 +0200
commitab0e900fff24e88f1a1c4e888b1e9b812e0b75c0 (patch)
treeb007d89c98906794a204b1b66d86d6c05cc5c6e6 /app/src/main/java/org/connectbot/ConsoleActivity.java
parent5f9f8a3ce2c390ea4530635f9c260902fe217958 (diff)
downloadconnectbot-ab0e900fff24e88f1a1c4e888b1e9b812e0b75c0.tar.gz
connectbot-ab0e900fff24e88f1a1c4e888b1e9b812e0b75c0.tar.bz2
connectbot-ab0e900fff24e88f1a1c4e888b1e9b812e0b75c0.zip
Provide visual feedback for virtual keyboard
Diffstat (limited to 'app/src/main/java/org/connectbot/ConsoleActivity.java')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index 4051a45..5dc741f 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -227,7 +227,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
/**
* Handle repeatable virtual keys and touch events
*/
- public class KeyRepeater implements Runnable, OnTouchListener {
+ public class KeyRepeater implements Runnable, OnTouchListener, OnClickListener {
private View mView;
private Handler mHandler;
private boolean mDown;
@@ -236,6 +236,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
mView = view;
mHandler = handler;
mView.setOnTouchListener(this);
+ mView.setOnClickListener(this);
mDown = false;
}
@@ -244,7 +245,7 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
mDown = true;
mHandler.removeCallbacks(this);
mHandler.postDelayed(this, KEYBOARD_REPEAT);
- onEmulatedKeyClicked(mView);
+ mView.performClick();
}
@Override
@@ -259,27 +260,39 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne
case MotionEvent.ACTION_DOWN:
mDown = false;
mHandler.postDelayed(this, KEYBOARD_REPEAT_INITIAL);
+ mView.setPressed(true);
return (true);
case MotionEvent.ACTION_CANCEL:
mHandler.removeCallbacks(this);
+ mView.setPressed(false);
return (true);
case MotionEvent.ACTION_UP:
mHandler.removeCallbacks(this);
+ mView.setPressed(false);
+
if (!mDown) {
- onEmulatedKeyClicked(mView);
+ mView.performClick();
}
return (true);
}
return false;
}
+
+ @Override
+ public void onClick(View view) {
+ onEmulatedKeyClicked(view);
+ }
}
private void onEmulatedKeyClicked(View v) {
TerminalView terminal = adapter.getCurrentTerminalView();
if (terminal == null) return;
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "onEmulatedKeyClicked(" + v.getId() + ")");
+ }
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
boolean hideKeys = false;