diff options
author | Kenny Root <kenny@the-b.org> | 2009-01-07 03:26:40 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2009-01-07 03:26:40 +0000 |
commit | 5a5683a115b16a5ba0997baa54981f17253741e9 (patch) | |
tree | 1a96907e72667e91bceeefcf35d4e66b8682edb8 /src | |
parent | 300b642b98bf8e6642e4e20a332e74fa62ee7e88 (diff) | |
download | connectbot-5a5683a115b16a5ba0997baa54981f17253741e9.tar.gz connectbot-5a5683a115b16a5ba0997baa54981f17253741e9.tar.bz2 connectbot-5a5683a115b16a5ba0997baa54981f17253741e9.zip |
Allow hosts to be disconnected/closed once you have a dead session.
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 74 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 9 |
2 files changed, 45 insertions, 38 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 8e7f771..5bc7c4c 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -50,7 +50,6 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; -import android.view.Window; import android.view.WindowManager; import android.view.MenuItem.OnMenuItemClickListener; import android.view.View.OnClickListener; @@ -556,12 +555,7 @@ public class ConsoleActivity extends Activity { public boolean onMenuItemClick(MenuItem item) { // disconnect or close the currently visible session TerminalBridge bridge = ((TerminalView)view).bridge; - if (bridge.isSessionOpen() || !bridge.isDisconnected()) { - bridge.dispatchDisconnect(true); - } else { - // remove this bridge because it's been explicitly closed. - closeBridge(bridge); - } + bridge.dispatchDisconnect(true); return true; } }); @@ -692,43 +686,55 @@ public class ConsoleActivity extends Activity { } protected void shiftLeft() { + View overlay; + // Only show animation if there is something else to go to. - if (flip.getChildCount() <= 1) - return; + if (flip.getChildCount() > 1) { + // keep current overlay from popping up again + overlay = findCurrentView(R.id.terminal_overlay); + if (overlay != null) + overlay.startAnimation(fade_stay_hidden); + + flip.setInAnimation(slide_left_in); + flip.setOutAnimation(slide_left_out); + flip.showNext(); + } - // keep current overlay from popping up again - View overlay = findCurrentView(R.id.terminal_overlay); - if(overlay != null) overlay.startAnimation(fade_stay_hidden); - - flip.setInAnimation(slide_left_in); - flip.setOutAnimation(slide_left_out); - flip.showNext(); ConsoleActivity.this.updateDefault(); - - // show overlay on new slide and start fade - overlay = findCurrentView(R.id.terminal_overlay); - if(overlay != null) overlay.startAnimation(fade_out); - + + if (flip.getChildCount() > 1) { + // show overlay on new slide and start fade + overlay = findCurrentView(R.id.terminal_overlay); + if (overlay != null) + overlay.startAnimation(fade_out); + } + updatePromptVisible(); } protected void shiftRight() { + View overlay; + // Only show animation if there is something else to go to. - if (flip.getChildCount() <= 1) - return; - - // keep current overlay from popping up again - View overlay = findCurrentView(R.id.terminal_overlay); - if(overlay != null) overlay.startAnimation(fade_stay_hidden); + if (flip.getChildCount() > 1) { + // keep current overlay from popping up again + overlay = findCurrentView(R.id.terminal_overlay); + if (overlay != null) + overlay.startAnimation(fade_stay_hidden); + + flip.setInAnimation(slide_right_in); + flip.setOutAnimation(slide_right_out); + flip.showPrevious(); + } - flip.setInAnimation(slide_right_in); - flip.setOutAnimation(slide_right_out); - flip.showPrevious(); ConsoleActivity.this.updateDefault(); - - // show overlay on new slide and start fade - overlay = findCurrentView(R.id.terminal_overlay); - if(overlay != null) overlay.startAnimation(fade_out); + + if (flip.getChildCount() > 1) { + // show overlay on new slide and start fade + overlay = findCurrentView(R.id.terminal_overlay); + if (overlay != null) + overlay.startAnimation(fade_out); + } updatePromptVisible(); } diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index e6fda28..6d74f81 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -643,7 +643,7 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal */ public void dispatchDisconnect(boolean immediate) { // We don't need to do this multiple times. - if (disconnected) + if (disconnected && !immediate) return; // disconnection request hangs if we havent really connected to a host yet @@ -660,10 +660,11 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal authenticated = false; sessionOpen = false; - if (immediate) + if (immediate) { awaitingClose = true; - - if (!immediate) { + if (disconnectListener != null) + disconnectListener.onDisconnected(TerminalBridge.this); + } else { new Thread(new Runnable() { public void run() { boolean result = promptHelper.requestBooleanPrompt("Host has disconnected.\nClose session?"); |