diff options
Diffstat (limited to 'src/de/blinkt')
-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 |
4 files changed, 61 insertions, 19 deletions
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 |