aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-09-16 11:03:47 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-09-16 18:01:06 +0200
commitc56065fcfe9fb887cb7ccec23a7af22111f352bc (patch)
treeeced7c5f2b684829ca53590d2d904768d55e7a6d /ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
parentTunnelEditorFragment: avoid extra trip through event loop (diff)
downloadwireguard-android-c56065fcfe9fb887cb7ccec23a7af22111f352bc.tar.xz
wireguard-android-c56065fcfe9fb887cb7ccec23a7af22111f352bc.zip
TunnelEditorFragment: move backwards using fragment manager instead of hack
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt')
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt10
1 files changed, 4 insertions, 6 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
index b7912175..bb09c5eb 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
@@ -117,13 +117,11 @@ class TunnelEditorFragment : BaseFragment(), AppSelectionListener {
inputManager?.hideSoftInputFromWindow(focusedView.windowToken,
InputMethodManager.HIDE_NOT_ALWAYS)
}
+ parentFragmentManager.popBackStackImmediate()
- // Tell the activity to finish itself or go back to the detail view.
- // TODO(smaeul): Remove this hack when fixing the Config ViewModel
- // The selected tunnel has to actually change, but we have to remember this one.
- val savedTunnel = tunnel
- if (savedTunnel === selectedTunnel) selectedTunnel = null
- selectedTunnel = savedTunnel
+ // If we just made a new one, save it to select the details page.
+ if (selectedTunnel != tunnel)
+ selectedTunnel = tunnel
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {