diff options
author | Jeremy Klein <jklein24@gmail.com> | 2016-01-08 11:03:45 -0800 |
---|---|---|
committer | Jeremy Klein <jklein24@gmail.com> | 2016-01-08 11:03:45 -0800 |
commit | 7b531f9b702934d2ea952f899a15ab9f2c6e768c (patch) | |
tree | 9e9ac604795a105f1fe140890762c2a779010359 | |
parent | 81405c036f22222062189f973b8dd625d7e5fa11 (diff) | |
parent | 1fbe941e07ed524e05a49dcea86917846d10405b (diff) | |
download | connectbot-7b531f9b702934d2ea952f899a15ab9f2c6e768c.tar.gz connectbot-7b531f9b702934d2ea952f899a15ab9f2c6e768c.tar.bz2 connectbot-7b531f9b702934d2ea952f899a15ab9f2c6e768c.zip |
Merge pull request #364 from arthurhsu/disconnectall
Add DisconnectAll to HostActivity's Options.
-rw-r--r-- | app/src/main/java/org/connectbot/HostListActivity.java | 35 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 1 |
2 files changed, 25 insertions, 11 deletions
diff --git a/app/src/main/java/org/connectbot/HostListActivity.java b/app/src/main/java/org/connectbot/HostListActivity.java index 3a7a383..a258633 100644 --- a/app/src/main/java/org/connectbot/HostListActivity.java +++ b/app/src/main/java/org/connectbot/HostListActivity.java @@ -17,17 +17,6 @@ package org.connectbot; -import java.util.List; - -import org.connectbot.bean.HostBean; -import org.connectbot.data.HostStorage; -import org.connectbot.service.OnHostStatusChangedListener; -import org.connectbot.service.TerminalBridge; -import org.connectbot.service.TerminalManager; -import org.connectbot.transport.TransportFactory; -import org.connectbot.util.HostDatabase; -import org.connectbot.util.PreferenceConstants; - import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; @@ -59,6 +48,17 @@ import android.widget.AdapterView; import android.widget.ImageView; import android.widget.TextView; +import org.connectbot.bean.HostBean; +import org.connectbot.data.HostStorage; +import org.connectbot.service.OnHostStatusChangedListener; +import org.connectbot.service.TerminalBridge; +import org.connectbot.service.TerminalManager; +import org.connectbot.transport.TransportFactory; +import org.connectbot.util.HostDatabase; +import org.connectbot.util.PreferenceConstants; + +import java.util.List; + public class HostListActivity extends AppCompatListActivity implements OnHostStatusChangedListener { public final static String TAG = "CB.HostListActivity"; public static final String DISCONNECT_ACTION = "org.connectbot.action.DISCONNECT"; @@ -77,6 +77,8 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta private MenuItem sortlast; + private MenuItem disconnectall; + private SharedPreferences prefs = null; protected boolean makingShortcut = false; @@ -233,6 +235,7 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta sortcolor.setVisible(!sortedByColor); sortlast.setVisible(sortedByColor); + disconnectall.setEnabled(bound.getBridges().size() > 0); return true; } @@ -273,6 +276,16 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta colors.setIcon(android.R.drawable.ic_menu_slideshow); colors.setIntent(new Intent(HostListActivity.this, ColorsActivity.class)); + disconnectall = menu.add(R.string.list_menu_disconnect); + disconnectall.setIcon(android.R.drawable.ic_menu_delete); + disconnectall.setOnMenuItemClickListener(new OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem menuItem) { + disconnectAll(); + return false; + } + }); + MenuItem settings = menu.add(R.string.list_menu_settings); settings.setIcon(android.R.drawable.ic_menu_preferences); settings.setIntent(new Intent(HostListActivity.this, SettingsActivity.class)); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 45ef38c..f11da40 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -432,6 +432,7 @@ <string name="list_menu_sortcolor">"Sort by color"</string> <!-- Selection choice to sort hosts by nickname. --> <string name="list_menu_sortname">"Sort by name"</string> + <string name="list_menu_disconnect">"Disconnect All"</string> <string name="list_menu_settings">"Settings"</string> <string name="list_host_disconnect">"Disconnect"</string> |