diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt | 10 | ||||
-rw-r--r-- | ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt | 2 |
2 files changed, 5 insertions, 7 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 { diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt index 0d56edd3..8b43e1f7 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt @@ -221,7 +221,7 @@ class TunnelListFragment : BaseFragment() { override fun onSelectedTunnelChanged(oldTunnel: ObservableTunnel?, newTunnel: ObservableTunnel?) { binding ?: return - lifecycleScope.launch(Dispatchers.Main) { + lifecycleScope.launch { val tunnels = Application.getTunnelManager().getTunnels() if (newTunnel != null) viewForTunnel(newTunnel, tunnels).setSingleSelected(true) if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels).setSingleSelected(false) |