From e8786cac42d92f0efa32a84417b4470e79a96bb9 Mon Sep 17 00:00:00 2001 From: alescdb Date: Sat, 22 Aug 2015 22:19:50 +0200 Subject: Scroll hint to the end (F12 key) Only show scroll hint if hard keyboard is not detected Conditional Log.d() --- .../main/java/org/connectbot/ConsoleActivity.java | 50 +++++++++++++--------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index ef47794..31ad68c 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -246,10 +246,12 @@ public class ConsoleActivity extends Activity implements BridgeDisconnectedListe @Override public boolean onTouch(View v, MotionEvent event) { - Log.d(TAG, "KeyRepeater.onTouch(" + v.getId() + ", " + - event.getAction() + ", " + - event.getActionIndex() + ", " + - event.getActionMasked() + ");"); + if (BuildConfig.DEBUG) { + Log.d(TAG, "KeyRepeater.onTouch(" + v.getId() + ", " + + event.getAction() + ", " + + event.getActionIndex() + ", " + + event.getActionMasked() + ");"); + } switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mDown = false; @@ -593,24 +595,30 @@ public class ConsoleActivity extends Activity implements BridgeDisconnectedListe } }); - // Show virtual keyboard and scroll back and forth - final HorizontalScrollView keyboardScroll = (HorizontalScrollView) findViewById(R.id.keyboard_hscroll); - showEmulatedKeys(); - keyboardScroll.postDelayed(new Runnable() { - @Override - public void run() { - final int xscroll = keyboardScroll.getMaxScrollAmount(); - Log.d(TAG, "smoothScrollBy(1)"); - keyboardScroll.smoothScrollBy(xscroll, 0); - keyboardScroll.postDelayed(new Runnable() { - @Override - public void run() { - Log.d(TAG, "smoothScrollBy(2)"); - keyboardScroll.smoothScrollBy(-xscroll, 0); + if(!hardKeyboard) { + // Show virtual keyboard and scroll back and forth + final HorizontalScrollView keyboardScroll = (HorizontalScrollView) findViewById(R.id.keyboard_hscroll); + showEmulatedKeys(); + keyboardScroll.postDelayed(new Runnable() { + @Override + public void run() { + final int xscroll = findViewById(R.id.button_f12).getRight(); + if (BuildConfig.DEBUG) { + Log.d(TAG, "smoothScrollBy(toEnd[" + xscroll + "])"); } - }, 1000); - } - }, 1000); + keyboardScroll.smoothScrollBy(xscroll, 0); + keyboardScroll.postDelayed(new Runnable() { + @Override + public void run() { + if (BuildConfig.DEBUG) { + Log.d(TAG, "smoothScrollBy(toStart[" + (-xscroll) + "])"); + } + keyboardScroll.smoothScrollBy(-xscroll, 0); + } + }, 1000); + } + }, 1000); + } tabs = (TabLayout) findViewById(R.id.tabs); if (tabs != null) -- cgit v1.2.3