diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-18 19:12:38 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-18 19:12:38 +0200 |
commit | 42423ebf890bc51a9d8d24539fb05a200d878885 (patch) | |
tree | 956218cce68e85c85b940b4378ce7630bf8e99cb | |
parent | 40eb17c3c472bf088568abe7082427f1ab891399 (diff) |
Version 0.5.5
- Add state to speed display
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | res/xml/main_headers.xml | 9 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LogWindow.java | 6 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVPN.java | 20 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVPNThread.java | 2 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/OpenVpnManagementThread.java | 11 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/Settings_Authentication.java | 1 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/Settings_IP.java | 1 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/Settings_Routing.java | 1 | ||||
-rw-r--r-- | todo.txt | 1 |
10 files changed, 30 insertions, 25 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index c74362e7..0f1004a7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -219,5 +219,6 @@ <string name="broken_image_cert">Got an excption trying to show the Android 4.0+ certificate selction dialog. This should never happens as this a standard feature of Android 4.0+. Maybe your Android ROM support for certificate storage is broken</string> <string name="ipv4">IPv4</string> <string name="ipv6">IPv6</string> - <string name="speed_waiting">Waiting for byte count messageā¦</string> + <string name="speed_waiting">Waiting for state messageā¦</string> + <string name="generalsettings">General Settings</string> </resources> diff --git a/res/xml/main_headers.xml b/res/xml/main_headers.xml index 71913f49..95bc6fe3 100644 --- a/res/xml/main_headers.xml +++ b/res/xml/main_headers.xml @@ -11,11 +11,10 @@ android:summary="@string/faq_summary" android:title="@string/faq" /> - <header - android:fragment="de.blinkt.openvpn.AboutFragment" - android:summary="@string/about_summary" - android:title="@string/about" /> - +<!-- <header + android:fragment="de.blinkt.openvpn.GeneralSettings" + android:title="@string/generalsettings" /> --> + </preference-headers>
\ No newline at end of file diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index 2e2612d3..b38951df 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -28,9 +28,9 @@ import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import de.blinkt.openvpn.OpenVPN.LogListener; -import de.blinkt.openvpn.OpenVPN.SpeedListener; +import de.blinkt.openvpn.OpenVPN.StateListener; -public class LogWindow extends ListActivity implements SpeedListener { +public class LogWindow extends ListActivity implements StateListener { private String[] mBconfig=null; @@ -270,7 +270,7 @@ public class LogWindow extends ListActivity implements SpeedListener { } @Override - public void updateSpeed(final String logmessage) { + public void updateState(final String logmessage) { runOnUiThread(new Runnable() { @Override diff --git a/src/de/blinkt/openvpn/OpenVPN.java b/src/de/blinkt/openvpn/OpenVPN.java index 1d9eb6e0..40fe3afd 100644 --- a/src/de/blinkt/openvpn/OpenVPN.java +++ b/src/de/blinkt/openvpn/OpenVPN.java @@ -10,15 +10,15 @@ public class OpenVPN { public static LinkedList<String> logbuffer = new LinkedList<String>(); private static Vector<LogListener> logListener=new Vector<OpenVPN.LogListener>(); - private static Vector<SpeedListener> speedListener=new Vector<OpenVPN.SpeedListener>(); + private static Vector<StateListener> stateListener=new Vector<OpenVPN.StateListener>(); private static String[] mBconfig; public interface LogListener { void newLog(String logmessage); } - public interface SpeedListener { - void updateSpeed(String logmessage); + public interface StateListener { + void updateState(String logmessage); } synchronized static void logMessage(int level,String prefix, String message) @@ -46,12 +46,12 @@ public class OpenVPN { } - synchronized static void addSpeedListener(SpeedListener sl){ - speedListener.add(sl); + synchronized static void addSpeedListener(StateListener sl){ + stateListener.add(sl); } - synchronized static void removeSpeedListener(SpeedListener sl) { - speedListener.remove(sl); + synchronized static void removeSpeedListener(StateListener sl) { + stateListener.remove(sl); } @@ -77,9 +77,9 @@ public class OpenVPN { } - public static void updateSpeedString(String msg) { - for (SpeedListener sl : speedListener) { - sl.updateSpeed(msg); + public static void updateStateString(String msg) { + for (StateListener sl : stateListener) { + sl.updateState(msg); } } } diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java index 89cd0a59..dcd5f4ec 100644 --- a/src/de/blinkt/openvpn/OpenVPNThread.java +++ b/src/de/blinkt/openvpn/OpenVPNThread.java @@ -58,7 +58,7 @@ public class OpenVPNThread implements Runnable { //mInterface = null;
- mService.getHandler().sendEmptyMessage(R.string.disconnected);
+ OpenVPN.updateStateString("No process running");
// Not a good place to do it, but will do
OpenVPN.logBuilderConfig(null);
Log.i(TAG, "Exiting");
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java index 82d6f00d..c10cdb1e 100644 --- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java @@ -161,10 +161,13 @@ public class OpenVpnManagementThread implements Runnable { } else if (cmd.equals("HOLD")) {
managmentCommand("hold release\n");
managmentCommand("bytecount " + mBytecountinterval + "\n");
+ managmentCommand("state on\n");
} else if (cmd.equals("NEED-OK")) {
processNeedCommand(argument);
} else if (cmd.equals("BYTECOUNT")){
processByteCount(argument);
+ } else if (cmd.equals("STATE")){
+ processState(argument);
} else if (cmd.equals("LOG")) {
String[] args = argument.split(",",3);
// 0 unix time stamp
@@ -183,6 +186,12 @@ public class OpenVpnManagementThread implements Runnable { }
}
+ private void processState(String argument) {
+ String[] args = argument.split(",",2);
+ OpenVPN.updateStateString(args[1]);
+ }
+
+
private void processByteCount(String argument) {
// >BYTECOUNT:{BYTES_IN},{BYTES_OUT}
int comma = argument.indexOf(',');
@@ -200,7 +209,7 @@ public class OpenVpnManagementThread implements Runnable { humanReadableByteCount(diffin, false),
humanReadableByteCount(out, false),
humanReadableByteCount(diffout, false));
- OpenVPN.updateSpeedString(netstat);
+ OpenVPN.updateStateString(netstat);
}
diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java index 6d6960e9..b2e84087 100644 --- a/src/de/blinkt/openvpn/Settings_Authentication.java +++ b/src/de/blinkt/openvpn/Settings_Authentication.java @@ -9,7 +9,6 @@ import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener; -import android.preference.PreferenceFragment; import android.preference.SwitchPreference; diff --git a/src/de/blinkt/openvpn/Settings_IP.java b/src/de/blinkt/openvpn/Settings_IP.java index f1e495c8..d6fd19d4 100644 --- a/src/de/blinkt/openvpn/Settings_IP.java +++ b/src/de/blinkt/openvpn/Settings_IP.java @@ -4,7 +4,6 @@ import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.SwitchPreference; diff --git a/src/de/blinkt/openvpn/Settings_Routing.java b/src/de/blinkt/openvpn/Settings_Routing.java index 8305f4db..202c45c1 100644 --- a/src/de/blinkt/openvpn/Settings_Routing.java +++ b/src/de/blinkt/openvpn/Settings_Routing.java @@ -4,7 +4,6 @@ import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; public class Settings_Routing extends OpenVpnPreferencesFragment implements OnPreferenceChangeListener { @@ -17,7 +17,6 @@ Ideas: Missing configuration options: IPv6 support: -- Make GUI IPv6 fit - fix bogus tun-ipv6 warning Tap support: |