oulan / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

Add hook for Android/PhoneGap back button integration #305

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Feature request.

Tight integration with android back button will use iui history stack instead 
of the browsers history stack. (requires phone gap to the best of my knowledge) 

function androidBackButtonListener (){
   if (first page in history list)
      device.exitApp();
   else
      iui.goBack();
}

document.addEventListener("backbutton", androidBackButtonListener, false);

This can be implemented in various ways, either inside iui, or iui can expose 
some of the history functionality so users can implement it themselves (add a 
page to the tutorials/faq).

NOTICE:
When opening the page, iui will add the default selected page to the history, 
creating two history entries [#, #first-page]. This is why my current 
implementation does:

if (iui.getHistory().length <= 1)
   device.exitApp();
...
This includes both 0 and 1 history lengths.

Original issue reported on code.google.com by san0f...@gmail.com on 28 Sep 2011 at 1:55

GoogleCodeExporter commented 9 years ago
Notice the code sample above is what a developer would write to do the 
integration, not necessarily part of iui. All iui has to do to support it is to 
make the history accessible to external javascript code.

Original comment by san0f...@gmail.com on 4 Oct 2011 at 2:46

GoogleCodeExporter commented 9 years ago

Original comment by msgilli...@gmail.com on 9 Jan 2012 at 6:59