summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/android/AddActivity.java
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-22 01:27:29 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-22 01:27:29 -0500
commit5d04714eeae71e2404a3dd61b67a5348cbbc62a2 (patch)
tree43e108abc0f81593356f707e71e445a479445dcc /app/src/main/java/com/wireguard/android/AddActivity.java
parent90cd59c86686d4b9cb4d2cc4fca625843ccb3131 (diff)
ConfigAddActivity: Rename to AddActivity
Not everything needs to start with Config Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/AddActivity.java')
-rw-r--r--app/src/main/java/com/wireguard/android/AddActivity.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/android/AddActivity.java b/app/src/main/java/com/wireguard/android/AddActivity.java
new file mode 100644
index 00000000..7e31c876
--- /dev/null
+++ b/app/src/main/java/com/wireguard/android/AddActivity.java
@@ -0,0 +1,37 @@
+package com.wireguard.android;
+
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.os.Bundle;
+
+import com.wireguard.config.Config;
+
+/**
+ * Standalone activity for creating configurations.
+ */
+
+public class AddActivity extends BaseConfigActivity {
+ @Override
+ public void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.add_activity);
+ }
+
+ @Override
+ protected void onCurrentConfigChanged(final Config config) {
+ // This is the result of ConfigEditFragment signalling that a configuration was created.
+ if (config != null)
+ finish();
+ }
+
+ @Override
+ protected void onServiceAvailable() {
+ super.onServiceAvailable();
+ final FragmentManager fm = getFragmentManager();
+ if (fm.findFragmentById(R.id.master_fragment) == null) {
+ final FragmentTransaction transaction = fm.beginTransaction();
+ transaction.add(R.id.master_fragment, new ConfigEditFragment());
+ transaction.commit();
+ }
+ }
+}