From 1627dfc9aa8d6115adcbe396d5e8788bdc26ae46 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 3 Feb 2015 16:13:58 +0100 Subject: User cannot find the import button, add more of them --- main/build.gradle | 5 +- .../blinkt/openvpn/fragments/VPNProfileList.java | 68 +++++++++++++--------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/main/build.gradle b/main/build.gradle index 658958b9..912dcb59 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -18,8 +18,9 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 21 - versionCode = 108 - versionName = "0.6.27" + versionCode = 109 + versionName = "0.6.28" + useJack true } sourceSets { 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(); } -- cgit v1.2.3