SimonVT/android-menudrawer — pull request #35 by mnexo (2012-11-12 10:42:42+00:00)
Title: Support for placing the drawer above the content.

Hey Simon/Jake

First of all, thanks for sharing your app menu drawer implementation.

I've extended the library a little, adding support for placing the drawer above the content, useful for playback controls or other status information.

You can see a use case from one of our apps here where the ongoing cooking timers in a recipe app are displayed in a drawer above the recipe: https://dl.dropbox.com/u/1288556/GoCookTimers.png.

Notes on the implementation:

- All fields now representing width or height (depending on the drawer's gravity) have
been renamed from 'width' to 'size', e.g. mMenuWidth => mMenuSize.

- Added `MenuDrawer.MENU_POSITION_TOP` constant for use with the `gravity` argument in
the constructor of `MenuDrawerManager`. Also refactored the creation of the drawer in
the constructor into it's own helper method `createMenuDrawerForGravity`.

- Introduced HorizontalMenuDrawer specializing onMeasure and touch-related methods for
horizontally oriented drawers (could use a better name).

- TopDrawer is simply a clone of LeftDrawer, swapping the x and y axes as appropriate.

- Access modifiers on a few fields and methods in `MenuDrawer` had to be changed from
`private` to `protected` in order to specialize behavior in the new sub-classes.

- Due to lint warnings and errors with with MenuDrawer.postOnAnimate override (the
@TargetApi annotation doesn't seem to help with override methods..), I switched to
using ViewCompat.onPostAnimate instead of the hand-rolled one. This, obviously, has
the side effect of making the library depend on the support library. If you would
rather avoid that it should be fairly straightforward to roll back this change.

- I appologize for the many non-significant diffs (line wraps, formatting). I wasn't
able to set up my Eclipse formatter to fully match the rules you have. If you send
me an Eclipse formatter I'll happily fall in line.

- Added a sample activity demonstrating the use of TopDrawer.

Let me know what you think. Thanks!
Michael Nexo