From ff7d12e9cf8fe9e7255e535c29be3aa46cc3e7bc Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 11 Jun 2009 16:38:34 +0000 Subject: 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 --- res/layout/dia_portforward.xml | 9 ++++----- src/org/connectbot/PortForwardListActivity.java | 17 +++++++++++++---- 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 @@ @@ -94,11 +93,11 @@ 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 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"); -- cgit v1.2.3