aboutsummaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-07-24 18:15:56 -0700
committerKenny Root <kenny@the-b.org>2015-07-24 18:28:46 -0700
commit1540b4bdf52358b1cea5d92ad86de9ab564918f4 (patch)
tree5589f748f16e7468ba66bb9427d63e22cabad845 /app/src
parenta89be6e0f0ff1edfe9fc9b15c22e445339584f33 (diff)
downloadconnectbot-1540b4bdf52358b1cea5d92ad86de9ab564918f4.tar.gz
connectbot-1540b4bdf52358b1cea5d92ad86de9ab564918f4.tar.bz2
connectbot-1540b4bdf52358b1cea5d92ad86de9ab564918f4.zip
Change bridges access through method
This will help with unit testing.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/connectbot/ConsoleActivity.java11
-rw-r--r--app/src/main/java/org/connectbot/HostListActivity.java2
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalManager.java11
3 files changed, 12 insertions, 12 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java
index 77f8a3f..e7a8f7d 100644
--- a/app/src/main/java/org/connectbot/ConsoleActivity.java
+++ b/app/src/main/java/org/connectbot/ConsoleActivity.java
@@ -145,9 +145,6 @@ public class ConsoleActivity extends Activity {
// let manager know about our event handling services
bound.disconnectHandler = disconnectHandler;
-
- Log.d(TAG, String.format("Connected to TerminalManager and found bridges.size=%d", bound.bridges.size()));
-
bound.setResizeAllowed(true);
// clear out any existing bridges and record requested index
@@ -169,7 +166,7 @@ public class ConsoleActivity extends Activity {
}
// create views for all bridges on this service
- for (TerminalBridge bridge : bound.bridges) {
+ for (TerminalBridge bridge : bound.getBridges()) {
final int currentIndex = addNewTerminalView(bridge);
@@ -182,12 +179,6 @@ public class ConsoleActivity extends Activity {
}
public void onServiceDisconnected(ComponentName className) {
- // tell each bridge to forget about our prompt handler
- synchronized (bound.bridges) {
- for (TerminalBridge bridge : bound.bridges)
- bridge.promptHelper.setHandler(null);
- }
-
flip.removeAllViews();
updateEmptyVisible();
bound = null;
diff --git a/app/src/main/java/org/connectbot/HostListActivity.java b/app/src/main/java/org/connectbot/HostListActivity.java
index 7946e9a..2fd9560 100644
--- a/app/src/main/java/org/connectbot/HostListActivity.java
+++ b/app/src/main/java/org/connectbot/HostListActivity.java
@@ -447,7 +447,7 @@ public class HostListActivity extends ListActivity {
// Don't lose hosts that are connected via shortcuts but not in the database.
if (bound != null) {
- for (TerminalBridge bridge : bound.bridges) {
+ for (TerminalBridge bridge : bound.getBridges()) {
if (!hosts.contains(bridge.host))
hosts.add(0, bridge.host);
}
diff --git a/app/src/main/java/org/connectbot/service/TerminalManager.java b/app/src/main/java/org/connectbot/service/TerminalManager.java
index 8e7187f..1688d2a 100644
--- a/app/src/main/java/org/connectbot/service/TerminalManager.java
+++ b/app/src/main/java/org/connectbot/service/TerminalManager.java
@@ -70,7 +70,7 @@ import android.util.Log;
public class TerminalManager extends Service implements BridgeDisconnectedListener, OnSharedPreferenceChangeListener {
public final static String TAG = "CB.TerminalManager";
- public List<TerminalBridge> bridges = new LinkedList<TerminalBridge>();
+ private List<TerminalBridge> bridges = new LinkedList<TerminalBridge>();
public Map<HostBean, WeakReference<TerminalBridge>> mHostBridgeMap =
new HashMap<HostBean, WeakReference<TerminalBridge>>();
public Map<String, WeakReference<TerminalBridge>> mNicknameBridgeMap =
@@ -471,6 +471,10 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
}
}
+ public List<TerminalBridge> getBridges() {
+ return bridges;
+ }
+
public class TerminalBinder extends Binder {
public TerminalManager getService() {
return TerminalManager.this;
@@ -518,6 +522,11 @@ public class TerminalManager extends Service implements BridgeDisconnectedListen
if (bridges.size() == 0) {
stopWithDelay();
+ } else {
+ // tell each bridge to forget about their previous prompt handler
+ for (TerminalBridge bridge : bridges) {
+ bridge.promptHelper.setHandler(null);
+ }
}
return true;