summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java68
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();
}