TunnelEditorFragment: move backwards using fragment manager instead of hack
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
52a2ae36f6
commit
c56065fcfe
@ -117,13 +117,11 @@ class TunnelEditorFragment : BaseFragment(), AppSelectionListener {
|
|||||||
inputManager?.hideSoftInputFromWindow(focusedView.windowToken,
|
inputManager?.hideSoftInputFromWindow(focusedView.windowToken,
|
||||||
InputMethodManager.HIDE_NOT_ALWAYS)
|
InputMethodManager.HIDE_NOT_ALWAYS)
|
||||||
}
|
}
|
||||||
|
parentFragmentManager.popBackStackImmediate()
|
||||||
|
|
||||||
// Tell the activity to finish itself or go back to the detail view.
|
// If we just made a new one, save it to select the details page.
|
||||||
// TODO(smaeul): Remove this hack when fixing the Config ViewModel
|
if (selectedTunnel != tunnel)
|
||||||
// The selected tunnel has to actually change, but we have to remember this one.
|
selectedTunnel = tunnel
|
||||||
val savedTunnel = tunnel
|
|
||||||
if (savedTunnel === selectedTunnel) selectedTunnel = null
|
|
||||||
selectedTunnel = savedTunnel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
@ -221,7 +221,7 @@ class TunnelListFragment : BaseFragment() {
|
|||||||
|
|
||||||
override fun onSelectedTunnelChanged(oldTunnel: ObservableTunnel?, newTunnel: ObservableTunnel?) {
|
override fun onSelectedTunnelChanged(oldTunnel: ObservableTunnel?, newTunnel: ObservableTunnel?) {
|
||||||
binding ?: return
|
binding ?: return
|
||||||
lifecycleScope.launch(Dispatchers.Main) {
|
lifecycleScope.launch {
|
||||||
val tunnels = Application.getTunnelManager().getTunnels()
|
val tunnels = Application.getTunnelManager().getTunnels()
|
||||||
if (newTunnel != null) viewForTunnel(newTunnel, tunnels).setSingleSelected(true)
|
if (newTunnel != null) viewForTunnel(newTunnel, tunnels).setSingleSelected(true)
|
||||||
if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels).setSingleSelected(false)
|
if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels).setSingleSelected(false)
|
||||||
|
Loading…
Reference in New Issue
Block a user