diff options
-rw-r--r-- | doc/README.txt | 4 | ||||
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java | 30 | ||||
-rw-r--r-- | main/src/main/res/layout/config_converter.xml | 62 | ||||
-rwxr-xr-x | main/src/main/res/values/strings.xml | 1 |
4 files changed, 57 insertions, 40 deletions
diff --git a/doc/README.txt b/doc/README.txt index ba0ad06d..4e39f72b 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -21,9 +21,9 @@ svn co http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad - Install ndk (Version r9 is tested and used by me) - Make sure that ndk-build is in your build path. -Do ./misc/build-native.(sh|bat) in the root directory of the project. +Do cd main;./misc/build-native.(sh|bat) in the root directory of the project. After that build the project using "gradle build" (Or use Android Studio). -Building with Eclipse *might* still work but has not beeen teseted for a long time. +The project is converted to gradle and building with Eclipse is no longer supported. FAQ diff --git a/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java b/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java index 8e11802c..1ad9d9e3 100644 --- a/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java +++ b/main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java @@ -39,7 +39,7 @@ import java.util.*; import static de.blinkt.openvpn.views.FileSelectLayout.FileSelectCallback; -public class ConfigConverter extends ListActivity implements FileSelectCallback { +public class ConfigConverter extends Activity implements FileSelectCallback { public static final String IMPORT_PROFILE = "de.blinkt.openvpn.IMPORT_PROFILE"; private static final int RESULT_INSTALLPKCS12 = 7; @@ -47,8 +47,7 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback public static final String VPNPROFILE = "vpnProfile"; private VpnProfile mResult; - private transient ArrayAdapter<String> mArrayAdapter; - + private transient List<String> mPathsegments; private String mAliasName = null; @@ -56,6 +55,7 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback private Map<Utils.FileType, FileSelectLayout> fileSelectMap = new HashMap<Utils.FileType, FileSelectLayout>(); private String mEmbeddedPwFile; + private Vector<String> mLogEntries = new Vector<String>(); @Override public boolean onOptionsItemSelected(MenuItem item) { @@ -89,10 +89,10 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback outState.putSerializable(VPNPROFILE, mResult); outState.putString("mAliasName", mAliasName); - String[] logentries = new String[mArrayAdapter.getCount()]; - for (int i = 0; i < mArrayAdapter.getCount(); i++) { - logentries[i] = mArrayAdapter.getItem(i); - } + + + String[] logentries = mLogEntries.toArray(new String[mLogEntries.size()]); + outState.putStringArray("logentries", logentries); int[] fileselects = new int[fileSelectMap.size()]; @@ -473,18 +473,16 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.config_converter); - - mArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); - getListView().setAdapter(mArrayAdapter); - super.onCreate(savedInstanceState); - if (savedInstanceState != null && savedInstanceState.containsKey(VPNPROFILE)) { mResult = (VpnProfile) savedInstanceState.getSerializable(VPNPROFILE); mAliasName = savedInstanceState.getString("mAliasName"); mEmbeddedPwFile = savedInstanceState.getString("pwfile"); - mArrayAdapter.addAll(savedInstanceState.getStringArray("logentries")); + + for(String logItem : savedInstanceState.getStringArray("logentries")) + log (logItem); + for (int k : savedInstanceState.getIntArray("fileselects")) { addFileSelectDialog(Utils.FileType.getFileTypeByValue(k)); } @@ -563,7 +561,11 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback } private void log(String logmessage) { - mArrayAdapter.add(logmessage); + mLogEntries.add(logmessage); + TextView tv = new TextView(this); + tv.setText(logmessage); + LinearLayout logLayout = (LinearLayout) findViewById(R.id.config_convert_root); + logLayout.addView(tv); } private void doImport(InputStream is, String newName) { diff --git a/main/src/main/res/layout/config_converter.xml b/main/src/main/res/layout/config_converter.xml index f43d463e..ff0dcaa2 100644 --- a/main/src/main/res/layout/config_converter.xml +++ b/main/src/main/res/layout/config_converter.xml @@ -1,29 +1,43 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/config_convert_root" - android:orientation="vertical" > - <TextView +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/files_missing_hint" - android:visibility="gone" - android:id="@+id/files_missing_hint" - tools:visibilty="visible"/> + android:layout_height="match_parent" + android:layout_margin="@dimen/stdpadding" + android:orientation="vertical"> - <CheckBox - android:id="@+id/importpkcs12" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:checked="true" - android:text="@string/importpkcs12fromconfig" - android:visibility="gone" /> + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" + android:id="@+id/config_convert_root" + android:layout_height="wrap_content"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/files_missing_hint" + android:visibility="gone" + android:id="@+id/files_missing_hint" + tools:visibilty="visible"/> + + <CheckBox + android:id="@+id/importpkcs12" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:checked="true" + tools:visibilty="visible" + android:text="@string/importpkcs12fromconfig" + android:visibility="gone"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="10dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="@string/import_log" + android:id="@+id/textView"/> + + </LinearLayout> - <ListView - android:id="@android:id/list" - android:layout_width="fill_parent" - android:layout_height="fill_parent" /> -</LinearLayout>
\ No newline at end of file +</ScrollView>
\ No newline at end of file diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index 32839feb..157f8864 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -317,4 +317,5 @@ <string name="imported_from_file">[Imported from: %s]</string> <string name="files_missing_hint">Some files could not be found. Please select the files to import the profile:</string> <string name="openvpn_is_no_free_vpn">To use this app you need a VPN provider/VPN gateway supporting OpenVPN (often provided by your employer .Check out http://community.openvpn.net/ for more information on OpenVPN and how to setup your own OpenVPN server.</string> + <string name="import_log">Import log:</string> </resources> |