cmd/tailscale: close overflow menu when the Android back button is pressed

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/3/head
Elias Naur 4 years ago
parent a2b15127dd
commit 05fc3ef433

@ -550,6 +550,12 @@ func (a *App) runUI() error {
switch e := e.(type) {
case system.DestroyEvent:
return e.Err
case *system.CommandEvent:
if e.Type == system.CommandBack {
if ui.onBack() {
e.Cancel = true
}
}
case system.FrameEvent:
gtx := layout.NewContext(&ops, e)
events := ui.layout(gtx, e.Insets, state)

@ -168,6 +168,14 @@ func newUI(store *stateStore) (*UI, error) {
return ui, nil
}
func (ui *UI) onBack() bool {
if !ui.menu.show {
return false
}
ui.menu.show = false
return true
}
func (ui *UI) layout(gtx layout.Context, sysIns system.Insets, state *clientState) []UIEvent {
ui.events = nil
if ui.enabled.Changed() {

Loading…
Cancel
Save