Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 3rd, 2010  |  syntax: None  |  size: 2.24 KB  |  views: 90  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/apps/root_menu.c b/apps/root_menu.c
  2. index 5a8d40f..a65ceb5 100644
  3. --- a/apps/root_menu.c
  4. +++ b/apps/root_menu.c
  5. @@ -639,7 +639,15 @@ void root_menu(void)
  6.              case GO_TO_ROOT:
  7.                  if (last_screen != GO_TO_ROOT)
  8.                      selected = get_selection(last_screen);
  9. +#if (CONFIG_PLATFORM&PLATFORM_ANDROID)
  10. +                /* When we are in the main menu we want the hardware BACK
  11. +                 * button to be handled by Android instead of rockbox */
  12. +                android_ignore_back_button(true);
  13. +#endif
  14.                  next_screen = do_menu(&root_menu_, &selected, NULL, false);
  15. +#if (CONFIG_PLATFORM&PLATFORM_ANDROID)
  16. +                android_ignore_back_button(false);
  17. +#endif
  18.                  if (next_screen != GO_TO_PREVIOUS)
  19.                      last_screen = GO_TO_ROOT;
  20.                  break;
  21. diff --git a/firmware/target/hosted/android/app/button-application.c b/firmware/target/hosted/android/app/button-application.c
  22. index a7d75ef..5cbf6c7 100644
  23. --- a/firmware/target/hosted/android/app/button-application.c
  24. +++ b/firmware/target/hosted/android/app/button-application.c
  25. @@ -23,6 +23,12 @@
  26.  #include "button.h"
  27.  #include "android_keyevents.h"
  28.  
  29. +static bool ignore_back_button = false;
  30. +void android_ignore_back_button(bool yes)
  31. +{
  32. +    ignore_back_button = yes;
  33. +}
  34. +
  35.  int key_to_button(int keyboard_key)
  36.  {
  37.      switch (keyboard_key)
  38. @@ -30,7 +36,7 @@ int key_to_button(int keyboard_key)
  39.          default:
  40.              return BUTTON_NONE;
  41.          case KEYCODE_BACK:
  42. -            return BUTTON_BACK;
  43. +            return ignore_back_button ? BUTTON_NONE : BUTTON_BACK;
  44.          case KEYCODE_DPAD_UP:
  45.              return BUTTON_DPAD_UP;
  46.          case KEYCODE_DPAD_DOWN:
  47. diff --git a/firmware/target/hosted/android/app/button-target.h b/firmware/target/hosted/android/app/button-target.h
  48. index ca306d4..191f6e4 100644
  49. --- a/firmware/target/hosted/android/app/button-target.h
  50. +++ b/firmware/target/hosted/android/app/button-target.h
  51. @@ -29,6 +29,7 @@
  52.  void button_init_device(void);
  53.  int button_read_device(int *data);
  54.  unsigned multimedia_to_button(int keyboard_key);
  55. +void android_ignore_back_button(bool yes);
  56.  
  57.  /* Main unit's buttons */
  58.  #define BUTTON_MENU        0x00000001