summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/AddActivity.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/src/main/java/com/wireguard/android/AddActivity.java b/app/src/main/java/com/wireguard/android/AddActivity.java
index 7e31c876..080eecae 100644
--- a/app/src/main/java/com/wireguard/android/AddActivity.java
+++ b/app/src/main/java/com/wireguard/android/AddActivity.java
@@ -19,8 +19,13 @@ public class AddActivity extends BaseConfigActivity {
@Override
protected void onCurrentConfigChanged(final Config config) {
- // This is the result of ConfigEditFragment signalling that a configuration was created.
- if (config != null)
+ // Do nothing (this never happens).
+ }
+
+ @Override
+ protected void onEditingStateChanged(final boolean isEditing) {
+ // Go back to the main activity once the new configuration is created.
+ if (!isEditing)
finish();
}
@@ -28,10 +33,14 @@ public class AddActivity extends BaseConfigActivity {
protected void onServiceAvailable() {
super.onServiceAvailable();
final FragmentManager fm = getFragmentManager();
- if (fm.findFragmentById(R.id.master_fragment) == null) {
+ ConfigEditFragment fragment = (ConfigEditFragment) fm.findFragmentById(R.id.master_fragment);
+ if (fragment == null) {
+ fragment = new ConfigEditFragment();
final FragmentTransaction transaction = fm.beginTransaction();
- transaction.add(R.id.master_fragment, new ConfigEditFragment());
+ transaction.add(R.id.master_fragment, fragment);
transaction.commit();
}
+ // Prime the state for the fragment to tell us it is finished.
+ setIsEditing(true);
}
}