diff --git a/app/src/main/java/com/wireguard/android/ConfigActivity.java b/app/src/main/java/com/wireguard/android/ConfigActivity.java
index 61ccbc14..881f3f9a 100644
--- a/app/src/main/java/com/wireguard/android/ConfigActivity.java
+++ b/app/src/main/java/com/wireguard/android/ConfigActivity.java
@@ -16,6 +16,7 @@ import com.wireguard.config.Config;
public class ConfigActivity extends BaseConfigActivity {
private static final String KEY_EDITOR_STATE = "editorState";
+ private static final int REQUEST_IMPORT = 1;
private static final String TAG_DETAIL = "detail";
private static final String TAG_EDIT = "edit";
private static final String TAG_LIST = "list";
@@ -129,6 +130,16 @@ public class ConfigActivity extends BaseConfigActivity {
}
}
+ @Override
+ public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
+ if (requestCode == REQUEST_IMPORT) {
+ if (resultCode == RESULT_OK)
+ VpnService.getInstance().importFrom(data.getData());
+ } else {
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+ }
+
@Override
public void onBackPressed() {
super.onBackPressed();
@@ -184,6 +195,12 @@ public class ConfigActivity extends BaseConfigActivity {
// Try to make the editing fragment visible.
setIsEditing(true);
return true;
+ case R.id.menu_action_import:
+ final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+ intent.setType("*/*");
+ startActivityForResult(intent, REQUEST_IMPORT);
+ return true;
case R.id.menu_action_save:
// This menu item is handled by the editing fragment.
return false;
diff --git a/app/src/main/res/drawable/ic_open.xml b/app/src/main/res/drawable/ic_open.xml
new file mode 100644
index 00000000..f76831cd
--- /dev/null
+++ b/app/src/main/res/drawable/ic_open.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/menu/config_list.xml b/app/src/main/res/menu/config_list.xml
index ef1651f6..9a0a481c 100644
--- a/app/src/main/res/menu/config_list.xml
+++ b/app/src/main/res/menu/config_list.xml
@@ -6,4 +6,10 @@
android:icon="@drawable/ic_action_add"
android:showAsAction="always"
android:title="@string/add" />
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index bc2ec7a9..61602b12 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -42,4 +42,5 @@
Settings
Status
Toggle
+ Import