diff options
author | Arne Schwabe <arne@rfc2549.org> | 2015-02-03 16:13:58 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2015-02-03 16:13:58 +0100 |
commit | 1627dfc9aa8d6115adcbe396d5e8788bdc26ae46 (patch) | |
tree | 41690bb62010486439db7c866acd5bd09aed4d32 /main/src | |
parent | 29c0c3eeb07d77c6a0b00cb42c82897148d4732d (diff) |
User cannot find the import button, add more of themv0.6.28
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java index 5bd552f8..01352916 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -208,19 +208,23 @@ public class VPNProfileList extends ListFragment { onAddOrDuplicateProfile(null); return true; } else if (itemId == MENU_IMPORT_PROFILE) { - boolean startOldFileDialog=true; - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) - startOldFileDialog = ! startFilePicker(); - - if (startOldFileDialog) - startImportConfig(); - - return true; + return startImportConfigFilePicker(); } else { return super.onOptionsItemSelected(item); } } + private boolean startImportConfigFilePicker() { + boolean startOldFileDialog=true; + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) + startOldFileDialog = ! startFilePicker(); + + if (startOldFileDialog) + startImportConfig(); + + return true; + } + @TargetApi(Build.VERSION_CODES.KITKAT) private boolean startFilePicker() { @@ -258,28 +262,34 @@ public class VPNProfileList extends ListFragment { dialog.setMessage(R.string.add_profile_name_prompt); dialog.setView(entry); - + dialog.setNeutralButton(R.string.menu_import_short, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + startImportConfigFilePicker(); + } + }); dialog.setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - String name = entry.getText().toString(); - if (getPM().getProfileByName(name)==null) { - VpnProfile profile; - if (mCopyProfile!=null) - profile= mCopyProfile.copy(name); - else - profile = new VpnProfile(name); - - addProfile(profile); - editVPN(profile); - } else { - Toast.makeText(getActivity(), R.string.duplicate_profile_name, Toast.LENGTH_LONG).show(); - } - } - - - }); + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + String name = entry.getText().toString(); + if (getPM().getProfileByName(name) == null) { + VpnProfile profile; + if (mCopyProfile != null) + profile = mCopyProfile.copy(name); + else + profile = new VpnProfile(name); + + addProfile(profile); + editVPN(profile); + } else { + Toast.makeText(getActivity(), R.string.duplicate_profile_name, Toast.LENGTH_LONG).show(); + } + } + + + }); dialog.setNegativeButton(android.R.string.cancel, null); dialog.create().show(); } |