summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2014-02-14 22:07:22 +0100
committerArne Schwabe <arne@rfc2549.org>2014-02-14 22:07:22 +0100
commit8c77caa3964175762d23a9790578724f336716d6 (patch)
tree782a7779c61cea923c2f0b889e575767a64eb988 /main/src
parent73a48d3cd466a730ef6cc01b5f8d9e0aa34cf389 (diff)
Make Config Converter layout work again on small devicesv0.6.8
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/activities/ConfigConverter.java30
-rw-r--r--main/src/main/res/layout/config_converter.xml62
-rwxr-xr-xmain/src/main/res/values/strings.xml1
3 files changed, 55 insertions, 38 deletions
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>