diff options
-rw-r--r-- | AndroidManifest.xml | 4 | ||||
-rw-r--r-- | res/layout/faq.xml | 31 | ||||
-rw-r--r-- | res/layout/file_dialog_main.xml | 7 | ||||
-rw-r--r-- | res/values/strings.xml | 8 | ||||
-rw-r--r-- | res/xml/general_settings.xml | 18 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/FaqFragment.java | 9 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/FileSelectionFragment.java | 29 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/GeneralSettings.java | 13 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/LaunchVPN.java | 29 |
9 files changed, 104 insertions, 44 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 0adf7b44..980e8903 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -17,8 +17,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.blinkt.openvpn" - android:versionCode="38" - android:versionName="0.5.12a" > + android:versionCode="39" + android:versionName="0.5.13" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/res/layout/faq.xml b/res/layout/faq.xml index 4107ea7e..b18446c0 100644 --- a/res/layout/faq.xml +++ b/res/layout/faq.xml @@ -8,17 +8,22 @@ android:layout_height="wrap_content" android:orientation="vertical" > - + <TextView + style="@style/faqhead" + android:text="@string/faq_howto_title" /> + + <TextView + android:id="@+id/faq_howto" + style="@style/faqitem" /> + <TextView style="@style/faqhead" android:text="@string/faq_system_dialogs_title" /> - - + <TextView style="@style/faqitem" android:text="@string/faq_system_dialogs" /> - - + <TextView style="@style/faqhead" android:text="@string/tap_mode" /> @@ -35,22 +40,18 @@ style="@style/faqitem" android:text="@string/faq_security" /> - <TextView style="@style/faqhead" - android:text="@string/broken_images" - /> - + android:text="@string/broken_images" /> + <TextView - style="@style/faqitem" - android:id="@+id/brokenimages" /> - - + android:id="@+id/brokenimages" + style="@style/faqitem" /> + <TextView style="@style/faqhead" android:text="@string/faq_shortcut" /> - - + <TextView style="@style/faqitem" android:text="@string/faq_howto_shortcut" /> diff --git a/res/layout/file_dialog_main.xml b/res/layout/file_dialog_main.xml index 68af9b18..2a623dc6 100644 --- a/res/layout/file_dialog_main.xml +++ b/res/layout/file_dialog_main.xml @@ -25,6 +25,13 @@ android:layout_height="wrap_content" android:text="@string/select_file" > </Button> + + <Button + android:id="@+id/fdClear" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/clear" > + </Button> </LinearLayout> <LinearLayout diff --git a/res/values/strings.xml b/res/values/strings.xml index 6e280c19..d4604db7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -235,6 +235,8 @@ <string name="export_config_title">ICS Openvpn Config</string> <string name="warn_no_dns">No DNS servers being used. Name resolution may not work. Consider setting custom DNS Servers</string> <string name="dns_add_error">Could not add DNS Server \"%1$s\", rejected by the system: %2$s</string> - - -</resources>
\ No newline at end of file + <string name="faq_howto"><p>Get a working config (tested on your computer or download from your provider/organisation)</p><p>If it is a single file no with no extra pem/pks12 files you can email the file yourself and open the attachment. If you have multiple files put them on your sd card.</p><p>Click on the email attachment/Use the folder icon in the vpn list to import the config file</p><p>If there are errors about missing files put the missing files on your sd card.</p><p>Click on the save symbol to add the imported VPN to your VPN list</p><p>Connect the VPN by clicking on the name of the VPN</p><p>If there are error or warnings in the log try to understand the warnings/error and try to fix them</p> </string> + <string name="faq_howto_title">Quick Start</string> + <string name="setting_loadtun_summary">Try to load the tun.ko kernel module before trying to connect. Needs rooted devices.</string> + <string name="setting_loadtun">Load tun module</string> +</resources> diff --git a/res/xml/general_settings.xml b/res/xml/general_settings.xml index 69316d18..73b66b00 100644 --- a/res/xml/general_settings.xml +++ b/res/xml/general_settings.xml @@ -7,11 +7,6 @@ android:summary="@string/netchange_summary" android:title="@string/netchange" /> <CheckBoxPreference - android:defaultValue="false" - android:key="useCM9Fix" - android:summary="@string/owner_fix_summary" - android:title="@string/owner_fix" /> - <CheckBoxPreference android:defaultValue="true" android:key="showlogwindow" android:summary="@string/show_log_summary" @@ -22,4 +17,17 @@ android:summary="@string/keppstatus_summary" android:title="@string/keepstatus" /> + <PreferenceCategory android:title="Device specifics Hacks" > + <CheckBoxPreference + android:defaultValue="false" + android:key="useCM9Fix" + android:summary="@string/owner_fix_summary" + android:title="@string/owner_fix" /> + <CheckBoxPreference + android:defaultValue="false" + android:key="loadTunModule" + android:summary="@string/setting_loadtun_summary" + android:title="@string/setting_loadtun" /> + </PreferenceCategory> + </PreferenceScreen>
\ No newline at end of file diff --git a/src/de/blinkt/openvpn/FaqFragment.java b/src/de/blinkt/openvpn/FaqFragment.java index 09c6cbdc..c4d1913d 100644 --- a/src/de/blinkt/openvpn/FaqFragment.java +++ b/src/de/blinkt/openvpn/FaqFragment.java @@ -3,6 +3,7 @@ package de.blinkt.openvpn; import android.app.Fragment; import android.os.Bundle; import android.text.Html; +import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; @@ -25,7 +26,15 @@ public class FaqFragment extends Fragment { TextView bImages = (TextView) v.findViewById(R.id.brokenimages); bImages.setText(Html.fromHtml(getActivity().getString(R.string.broken_images_faq))); bImages.setMovementMethod(LinkMovementMethod.getInstance()); + + TextView quickstart = (TextView) v.findViewById(R.id.faq_howto); + Spanned htmltext = Html.fromHtml(getActivity().getString(R.string.faq_howto)); + quickstart.setText(htmltext); + quickstart.setMovementMethod(LinkMovementMethod.getInstance()); + return v; + + } diff --git a/src/de/blinkt/openvpn/FileSelectionFragment.java b/src/de/blinkt/openvpn/FileSelectionFragment.java index c030bba0..1761c395 100644 --- a/src/de/blinkt/openvpn/FileSelectionFragment.java +++ b/src/de/blinkt/openvpn/FileSelectionFragment.java @@ -47,7 +47,8 @@ public class FileSelectionFragment extends ListFragment { private File selectedFile; private HashMap<String, Integer> lastPositions = new HashMap<String, Integer>(); private String mStartPath; - private Button importFile; + private Button mImportFile; + private Button mClearButton; private boolean mHideImport=false; @@ -71,11 +72,22 @@ public class FileSelectionFragment extends ListFragment { } }); + mClearButton = (Button) v.findViewById(R.id.fdClear); + mClearButton.setEnabled(false); + mClearButton.setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + + } + }); + mClearButton.setVisibility(View.GONE); - importFile = (Button) v.findViewById(R.id.importfile); - importFile.setEnabled(false); - importFile.setOnClickListener(new OnClickListener() { - + + mImportFile = (Button) v.findViewById(R.id.importfile); + mImportFile.setEnabled(false); + mImportFile.setOnClickListener(new OnClickListener() { + @Override public void onClick(View v) { ((FileSelect) getActivity()).importFile(selectedFile.getPath()); @@ -83,9 +95,10 @@ public class FileSelectionFragment extends ListFragment { }); if(mHideImport== true) { - importFile.setVisibility(View.GONE); + mImportFile.setVisibility(View.GONE); } + return v; } @@ -224,7 +237,7 @@ public class FileSelectionFragment extends ListFragment { if (file.isDirectory()) { selectButton.setEnabled(false); - importFile.setEnabled(false); + mImportFile.setEnabled(false); if (file.canRead()) { lastPositions.put(currentPath, position); @@ -238,7 +251,7 @@ public class FileSelectionFragment extends ListFragment { selectedFile = file; v.setSelected(true); selectButton.setEnabled(true); - importFile.setEnabled(true); + mImportFile.setEnabled(true); } } diff --git a/src/de/blinkt/openvpn/GeneralSettings.java b/src/de/blinkt/openvpn/GeneralSettings.java index 24bf2616..b9c412c0 100644 --- a/src/de/blinkt/openvpn/GeneralSettings.java +++ b/src/de/blinkt/openvpn/GeneralSettings.java @@ -1,5 +1,8 @@ package de.blinkt.openvpn; +import java.io.File; + import android.os.Bundle; +import android.preference.Preference; import android.preference.PreferenceFragment; public class GeneralSettings extends PreferenceFragment { @@ -11,6 +14,16 @@ public class GeneralSettings extends PreferenceFragment { // Load the preferences from an XML resource addPreferencesFromResource(R.xml.general_settings); + Preference loadtun = findPreference("loadTunModule"); + if(!isTunModuleAvailable()) + loadtun.setEnabled(false); + } + + private boolean isTunModuleAvailable() { + // Check if the tun module exists on the file system + if(new File("/system/lib/modules/tun.ko").length() > 10) + return true; + return false; } diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index b057a392..7b1c6cce 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -350,21 +350,14 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { // Check if we want to fix /dev/tun SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean usecm9fix = prefs.getBoolean("useCM9Fix", false); + boolean loadTunModule = prefs.getBoolean("loadTunModule", false); if(usecm9fix && !mCmfixed ) { - ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c","chown system /dev/tun"}); - try { - Process p = pb.start(); - int ret = p.waitFor(); - if(ret ==0) - mCmfixed=true; - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } + execeuteSUcmd("chown system /dev/tun"); } + if(loadTunModule) + execeuteSUcmd("modprobe tun"); if (intent != null) { @@ -383,6 +376,20 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } + private void execeuteSUcmd(String command) { + ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c",command}); + try { + Process p = pb.start(); + int ret = p.waitFor(); + if(ret ==0) + mCmfixed=true; + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + private class startOpenVpnThread extends Thread { @Override |