diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-02-12 00:15:05 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-02-12 00:15:05 +0100 |
commit | 784387ef890a5c74b243a45fe4c7e5f0a6007ab9 (patch) | |
tree | 2addcd70728578545ca6f1ef0317f7ad9cfad290 /src/de/blinkt/openvpn/activities | |
parent | 99e3acbc8656509bc974a1772a6a648c829af665 (diff) |
More fine tuning of file import for 4.3/add hint for selecting files
Diffstat (limited to 'src/de/blinkt/openvpn/activities')
-rw-r--r-- | src/de/blinkt/openvpn/activities/ConfigConverter.java | 3 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/activities/FileSelect.java | 19 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/de/blinkt/openvpn/activities/ConfigConverter.java b/src/de/blinkt/openvpn/activities/ConfigConverter.java index 792c9796..cc84076d 100644 --- a/src/de/blinkt/openvpn/activities/ConfigConverter.java +++ b/src/de/blinkt/openvpn/activities/ConfigConverter.java @@ -329,7 +329,8 @@ public class ConfigConverter extends ListActivity implements FileSelectCallback fileSelectMap.put(type, fl); fl.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - ((LinearLayout) findViewById(R.id.config_convert_root)).addView(fl, 1); + ((LinearLayout) findViewById(R.id.config_convert_root)).addView(fl, 2); + findViewById(R.id.files_missing_hint).setVisibility(View.VISIBLE); fl.setData(value, this); int i = getFileLayoutOffset(type); fl.setCaller(this, i, type); diff --git a/src/de/blinkt/openvpn/activities/FileSelect.java b/src/de/blinkt/openvpn/activities/FileSelect.java index 8967b1bf..511dc736 100644 --- a/src/de/blinkt/openvpn/activities/FileSelect.java +++ b/src/de/blinkt/openvpn/activities/FileSelect.java @@ -128,18 +128,18 @@ public class FileSelect extends Activity { String data = ""; - byte[] filedata = readBytesFromFile(ifile) ; + byte[] fileData = readBytesFromFile(ifile) ; if(mBase64Encode) - data += Base64.encodeToString(filedata, Base64.DEFAULT); + data += Base64.encodeToString(fileData, Base64.DEFAULT); else - data += new String(filedata); + data += new String(fileData); mData =data; /* mInlineFragment.setData(data); getActionBar().selectTab(inlineFileTab); */ - saveInlineData(data); + saveInlineData(ifile.getName(), data); } catch (FileNotFoundException e) { fe = e; } catch (IOException e) { @@ -206,11 +206,14 @@ public class FileSelect extends Activity { } - public void saveInlineData(String string) { + public void saveInlineData(String fileName, String string) { Intent intent = new Intent(); - - intent.putExtra(RESULT_DATA,VpnProfile.INLINE_TAG + string); - setResult(Activity.RESULT_OK,intent); + + if(fileName==null) + intent.putExtra(RESULT_DATA, VpnProfile.INLINE_TAG + string); + else + intent.putExtra(RESULT_DATA,VpnProfile.DISPLAYNAME_TAG + fileName + VpnProfile.INLINE_TAG + string); + setResult(Activity.RESULT_OK, intent); finish(); } |