infinitered / bluepotion

Like RedPotion, but for Android
MIT License
74 stars 18 forks source link

Much better action bar and back button handling #30

Closed jamonholmgren closed 9 years ago

jamonholmgren commented 9 years ago

You can now do this:

class MyScreen < PMScreen
  action_bar true, back: true

end

When you open/close a screen, it'll automatically show or hide the action bar and the back button. Defaults to true/true.

@twerth

jamonholmgren commented 9 years ago

I also fixed a bug with the PMNavigationActivity where hitting the device back button would show an empty activity once you had popped all the fragments off the stack.

jamonholmgren commented 9 years ago

Also added another hook:

def on_back_selected(item)
  super # will close the current screen
  # or do custom logic here, like a confirm dialog
  SomeAlert.confirm "Are you sure?" do |yesno|
    super if yesno == "yes"
  end
end
jamonholmgren commented 9 years ago

I wonder if we should change the hook to on_back_pressed and capture the OS back button too.

twerth commented 9 years ago

should I merge this?

jamonholmgren commented 9 years ago

Should be good to go!