aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2009-06-11 16:38:34 +0000
committerKenny Root <kenny@the-b.org>2009-06-11 16:38:34 +0000
commitff7d12e9cf8fe9e7255e535c29be3aa46cc3e7bc (patch)
tree8e8f60023e9711fd9d285fbfb1480db1f1332c06
parent58032b289fd6dddb8fcea4cceaf4ed7e29d7c9e8 (diff)
downloadconnectbot-ff7d12e9cf8fe9e7255e535c29be3aa46cc3e7bc.tar.gz
connectbot-ff7d12e9cf8fe9e7255e535c29be3aa46cc3e7bc.tar.bz2
connectbot-ff7d12e9cf8fe9e7255e535c29be3aa46cc3e7bc.zip
Port forward activity fixes
* Fix bug where you couldn't change port forward types while they were in use * Fixed layout to be 1.5 compliant * Changed example from source port "143" which is invalid to "8080" which would work git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@281 df292f66-193f-0410-a5fc-6d59da041ff2
-rw-r--r--res/layout/dia_portforward.xml9
-rw-r--r--src/org/connectbot/PortForwardListActivity.java17
2 files changed, 17 insertions, 9 deletions
diff --git a/res/layout/dia_portforward.xml b/res/layout/dia_portforward.xml
index fe7abcb..b40d0ca 100644
--- a/res/layout/dia_portforward.xml
+++ b/res/layout/dia_portforward.xml
@@ -75,12 +75,11 @@
<EditText
android:id="@+id/portforward_source"
- android:hint="143"
+ android:hint="8080"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:numeric="integer"
- android:singleLine="true"
android:layout_weight="1"
+ android:inputType="number"
/>
</TableRow>
@@ -94,11 +93,11 @@
<EditText
android:id="@+id/portforward_destination"
- android:hint="localhost:143"
+ android:hint="localhost:80"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:singleLine="true"
android:layout_weight="1"
+ android:inputType="textEmailAddress"
/>
</TableRow>
</TableLayout>
diff --git a/src/org/connectbot/PortForwardListActivity.java b/src/org/connectbot/PortForwardListActivity.java
index 1c48e18..319ec72 100644
--- a/src/org/connectbot/PortForwardListActivity.java
+++ b/src/org/connectbot/PortForwardListActivity.java
@@ -66,6 +66,8 @@ import android.widget.AdapterView.OnItemSelectedListener;
public class PortForwardListActivity extends ListActivity {
public final static String TAG = PortForwardListActivity.class.toString();
+ private static final int LISTENER_CYCLE_TIME = 500;
+
protected HostDatabase hostdb;
private List<PortForwardBean> portForwards;
@@ -281,6 +283,9 @@ public class PortForwardListActivity extends ListActivity {
.setPositiveButton(R.string.button_change, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
try {
+ if (hostBridge != null)
+ hostBridge.disablePortForward(pfb);
+
pfb.setNickname(nicknameEdit.getText().toString());
switch (typeSpinner.getSelectedItemPosition()) {
@@ -299,10 +304,14 @@ public class PortForwardListActivity extends ListActivity {
pfb.setDest(destEdit.getText().toString());
// Use the new settings for the existing connection.
- if (hostBridge != null) {
- hostBridge.disablePortForward(pfb);
- hostBridge.enablePortForward(pfb);
- }
+ if (hostBridge != null)
+ updateHandler.postDelayed(new Runnable() {
+ public void run() {
+ hostBridge.enablePortForward(pfb);
+ updateHandler.sendEmptyMessage(-1);
+ }
+ }, LISTENER_CYCLE_TIME);
+
if (!hostdb.savePortForward(pfb))
throw new SQLException("Could not save port forward");